Git Product home page Git Product logo

caffe-unpooling's Introduction

caffe-unpooling

Caffe with unpooling layers and example usage.

Example usage

First, you need to prepare a deploy file. Please refer to examples/deconv_deploy.prototxt for detail.

Then, you can use python to see what exactly happened in your network. Please refer to examples/unpooling.ipynb and examples/deconv-vgg.ipynb for detail.

##Hope you have fun!

Please feel free to raise an issue when you have trouble using caffe-unpooling!

caffe-unpooling's People

Contributors

cypof avatar dgolden1 avatar ducha-aiki avatar eelstork avatar erictzeng avatar flx42 avatar jamt9000 avatar jeffdonahue avatar jyegerlehner avatar kloudkl avatar longjon avatar lukeyeager avatar mariolew avatar mavenlin avatar mohomran avatar mtamburrano avatar netheril96 avatar philkr avatar qipeng avatar rbgirshick avatar ronghanghu avatar sergeyk avatar sguada avatar shelhamer avatar ste-m5s avatar tdomhan avatar timmeinhardt avatar tnarihi avatar yangqing avatar yosinski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

caffe-unpooling's Issues

Unpooling backpropagation

Tried to train a model with unpooling layer, but unpooling backpropagation seems to be not implemented (8308 vision_layers.hpp:686] Not Implemented Yet)

unpooled_height_ and unpooled_width_ missing -1 in calculation

At lines 101-102 of UnpoolingLayer::Reshape

unpooled_height_ = static_cast((height_ - 1) * stride_h_ + kernel_h_ - 2 * pad_h_);
unpooled_width_ = static_cast((width_ - 1) * stride_w_ + kernel_w_ - 2 * pad_w_);

shouldn't these instead read

unpooled_height_ = static_cast((height_ - 1) * stride_h_ + kernel_h_ - 2 * pad_h_) - 1;
unpooled_width_ = static_cast((width_ - 1) * stride_w_ + kernel_w_ - 2 * pad_w_) - 1;

so that they match (in reverse) the lines 90-93 of PoolingLayer::Reshape

pooled_height_ = static_cast(ceil(static_cast(
height_ + 2 * pad_h_ - kernel_h_) / stride_h_)) + 1;
pooled_width_ = static_cast(ceil(static_cast(
width_ + 2 * pad_w_ - kernel_w_) / stride_w_)) + 1;

I may have this wrong, but the unpooled calculations for height and width appear to be missing needed a -1 on each of unpooled height and width calculations.

I'm having a problem with constrative_loss file

Good day,
Please, I'm having a problem setting up the caffe, because I get an error from the constrative_loss file, is like their is something wrong with file and how do I fix. thank you and I wait in anticipation for your reply.
Best Regards
Alex Gbenimachor

Below is the Error in the code.

src/caffe/layers/contrastive_loss_layer.cpp: In instantiation of ‘void caffe::ContrastiveLossLayer::Forward_cpu(const std::vector<caffe::Blob>&, const std::vector<caffe::Blob>&) [with Dtype = float]’:
src/caffe/layers/contrastive_loss_layer.cpp:116:1: required from here
src/caffe/layers/contrastive_loss_layer.cpp:54:30: error: no matching function for call to ‘max(float, double)’
Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/algorithm:61:0,
from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/6/bits/stl_algobase.h:219:5: note: candidate: template constexpr const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
/usr/include/c++/6/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:54:30: note: deduced conflicting types for parameter ‘const Tp’ (‘float’ and ‘double’)
Dtype dist = std::max(margin - sqrt(dist_sq
.cpu_data()[i]), 0.0);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/algorithm:61:0,
from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/6/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:54:30: note: deduced conflicting types for parameter ‘const Tp’ (‘float’ and ‘double’)
Dtype dist = std::max(margin - sqrt(dist_sq
.cpu_data()[i]), 0.0);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/algorithm:62:0,
from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/6/bits/stl_algo.h:3459:5: note: candidate: template constexpr _Tp std::max(std::initializer_list<_Tp>)
max(initializer_list<_Tp> __l)
^~~
/usr/include/c++/6/bits/stl_algo.h:3459:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:54:30: note: mismatched types ‘std::initializer_list<Tp>’ and ‘float’
Dtype dist = std::max(margin - sqrt(dist_sq
.cpu_data()[i]), 0.0);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/algorithm:62:0,
from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/6/bits/stl_algo.h:3465:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
max(initializer_list<_Tp> __l, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algo.h:3465:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:54:30: note: mismatched types ‘std::initializer_list<Tp>’ and ‘float’
Dtype dist = std::max(margin - sqrt(dist_sq
.cpu_data()[i]), 0.0);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:552: recipe for target '.build_release/src/caffe/layers/contrastive_loss_layer.o' failed
make: *** [.build_release/src/caffe/layers/contrastive_loss_layer.o] Error 1

DeConv training?

I have a trained model and I'm trying your pipeline for unspooling and visualizing the layers. Do I need a new train_val.protxt? Do I need to train again with the DeConv layers? I have updated my deploy.prototxt. Can you please help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.