Skip to content

jnulzl/caffe_plus

Repository files navigation

Update

  • 2020-03-29 Add caffemodel2txt.cpp
  • 2020-03-28 Add some new layers, permute( fromssd) and Upsample(nearest and bilinear,only forward) based on origin caffe. Source is:
include/caffe/layers/permute_layer.hpp
src/caffe/layers/permute_layer.cpp
src/caffe/layers/permute_layer.cu
include/caffe/layers/upsample_layer.hpp
src/caffe/layers/upsample_layer.cpp
src/caffe/layers/upsample_layer.cu

Example

Caffemodle2txt layer

  • Convert a caffemodel to txt or txt to caffemodel
Usage:
	./build/tools/caffemodel2txt c2t[t2c] caffemodel_path[txt_path] txt_path[caffemodel_path]

Upsample layer

  • Upsample shape of bottom[0] to shape of bottom[1]
layer{
    name:"Upsample_nearest"
    type:"Upsample"
    bottom:"Conv2d_87" #Blob Conv2d_87's shape is [1,16,32,32]
    bottom:"Conv2d_84" #Blob Conv2d_84's shape is [1,16,48,48]
    top:"Upsample_nearest" #Blob Upsample_nearest's shape is [1,16,48,48]
    upsample_param{
	    mode: NEAREST # or BILINEAR
    }
}
  • Upsample shape of bottom to HEIGHT and WIDTH
layer{
    name:"Upsample_nearest"
    type:"Upsample"
    bottom:"Conv2d_87" #Blob Conv2d_87's shape is [1,16,32,32]
    top:"Upsample_nearest" #Blob Upsample_nearest's shape is [1,16,HEIGHT,WIDTH]
    upsample_param{
        mode: NEAREST # or BILINEAR
        height: HEIGHT
        width: WIDTH
    }
}
  • Upsample shape of bottom to HEIGHT_SCALE x bottom_height and WIDTH_SCALE x bottom_width
layer{
    name:"Upsample_nearest"
    type:"Upsample"
    bottom:"Conv2d_87" #Blob Conv2d_87's shape is [1,16,32,32]
    top:"Upsample_nearest" #Blob Upsample_nearest's shape is [1,16,32*HEIGHT_SCALE,32*WIDTH_SCALE]
    upsample_param{
        mode: NEAREST # or BILINEAR
        height_scale: HEIGHT_SCALE
        width_scale: WIDTH_SCALE
    }
}

Caffe

Build Status License

Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The Berkeley Vision and Learning Center (BVLC) and community contributors.

Check out the project site for all the details like

and step-by-step examples.

Custom distributions

Community

Join the chat at https://gitter.im/BVLC/caffe

Please join the caffe-users group or gitter chat to ask questions and talk about methods and models. Framework development discussions and thorough bug reports are collected on Issues.

Happy brewing!

License and Citation

Caffe is released under the BSD 2-Clause license. The BAIR/BVLC reference models are released for unrestricted use.

Please cite Caffe in your publications if it helps your research:

@article{jia2014caffe,
  Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
  Journal = {arXiv preprint arXiv:1408.5093},
  Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
  Year = {2014}
}