Code Monkey home page Code Monkey logo

caffe-jacinto's People

Contributors

mathmanu avatar

Stargazers

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

Watchers

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

caffe-jacinto's Issues

error occur while compilation

Hi,
While compiling am getting the following error:
command used : make -j4

AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.0.17.0
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:600: recipe for target '.build_release/lib/libcaffe.so.0.17.0' failed
make: *** [.build_release/lib/libcaffe.so.0.17.0] Error 1
make: *** Waiting for unfinished jobs....

Note: while compiling with cmake its fine.

Kindly share your comments to fix it. Thanks.

Quantization

Hello,

I am working on both image classification examples (CIFAR/IMAGENET) and am struggling understanding where the quantization appears in your examples. Actually, i looked in the prototxt files provided in the sparsification phase but there is no quantization_param parameter in the convolutional/FC layers.

Quantization failed when testing SSD

First,I tried the quantization function in mnist, and it works well.
Then,I tried the quantization function on the SSD provided in caffe-jacinto-models and the original SSD.
Both of them failed with error == cudaSuccess (7 vs. 0) too many resources requested for lanuch.
Also I noticed that I could get the right result only if I set the iterations=1. (no matter what batch size i set or how many gpus i used.)
And in the log provided in caffe-jacinto-models, I can't find the test_quantize part,which makes me quiet confused.
So please tell me how to use the quantization function in SSD correctly.
Thank you very much.

Here is my log.

I0910 14:36:28.498530 13312 common.cpp:475] GPU 0 'TITAN Xp' has compute capability 6.1
I0910 14:36:29.036025 13312 caffe.cpp:902] This is NVCaffe 0.17.0 started at Mon Sep 10 14:36:28 2018
I0910 14:36:29.036056 13312 caffe.cpp:904] CuDNN version: 7104
I0910 14:36:29.036072 13312 caffe.cpp:905] CuBLAS version: 9000
I0910 14:36:29.036077 13312 caffe.cpp:906] CUDA version: 9000
I0910 14:36:29.036082 13312 caffe.cpp:907] CUDA driver version: 9010
I0910 14:36:29.036089 13312 caffe.cpp:908] Arguments:
[0]: /home/junxiang/caffe-jacinto/build/tools/caffe.bin
[1]: test_detection
[2]: --model=training/voc0712/JDetNet/20180828_14-57_ds_PSP_dsFac_32_hdDS8_1/test_quantize/test.prototxt
[3]: --iterations=496
[4]: --weights=training/voc0712/JDetNet/20180828_14-57_ds_PSP_dsFac_32_hdDS8_1/sparse/voc0712_ssdJacintoNetV2_iter_120000.caffemodel
…………………………………………

I0910 14:36:48.912307 13312 net.cpp:2195] Enabling quantization at output of: Concat mbox_loc
I0910 14:36:48.912477 13312 net.cpp:2195] Enabling quantization at output of: Concat mbox_conf
I0910 14:36:48.912649 13312 net.cpp:2195] Enabling quantization at output of: Concat mbox_priorbox
I0910 14:36:48.917215 13350 common.cpp:192] New stream 0x7fa3ac006960, device 0, thread 13350
F0910 14:36:48.941680 13312 permute_layer.cu:70] Check failed: error == cudaSuccess (7 vs. 0) too many resources requested for launch
*** Check failure stack trace: ***
@ 0x7fa4660295cd google::LogMessage::Fail()
@ 0x7fa46602b433 google::LogMessage::SendToLog()
@ 0x7fa46602915b google::LogMessage::Flush()
@ 0x7fa46602be1e google::LogMessageFatal::~LogMessageFatal()
@ 0x7fa467a7ce48 caffe::PermuteLayer<>::Forward_gpu()
@ 0x7fa4673e8a7f caffe::Layer<>::Forward()
@ 0x7fa4672561fe caffe::Net::ForwardFromTo()
@ 0x7fa46725633d caffe::Net::Forward()
@ 0x44cc4b test_detection()
@ 0x4521f2 main
@ 0x7fa4647ab830 __libc_start_main
@ 0x449699 _start
@ (nil) (unknown)

Thanks a lot!

Upgrade to NVIDIA Caffe 0.17

Hi,

NVIDIA Caffe 0.17 has been released with SSD support and enhancements for the latest versions of NCCL and Cuda libraires.

There is currently a bug in SSD NVIDIA#494 which is being resolved.

Do you have a timeline to upgrade to NVIDIA Caffe 0.17?

Thanks,

TIDL quantize

hi Manu,
Do you know the TIDL quantizatation which support by TI's tool——tidl_model_import.out.exe? would you please tell me about it's different with it caffe-jacinto.
thanks
best regards

Absorbing batch norm into conv weights

The Readme says "A tool is provided to absorb batch norm values into convolution weights". Could anyone point me to that tool, which I dont seem to be able to find. Thx!

Segmentation Fault

I have made a custom python layer for loss function. I have also put it into the python path. But I am getting this error. I am new to caffe, I am stuck here.Please Help!

PC: @ 0x7f05c1c4531a PyErr_Occurred
*** SIGSEGV (@0x48) received by PID 8931 (TID 0x7f05c51584c0) from PID 72; stack trace: ***
@ 0x7f05c14b04b0 (unknown)
@ 0x7f05c1c4531a PyErr_Occurred
@ 0x7f05c1c4a9a9 PyErr_ExceptionMatches
@ 0x7f05c1b821ef PyErr_PrintEx
@ 0x7f05c3d3cf81 caffe::GetPythonLayer()
@ 0x7f05c3a1993c caffe::LayerRegistry::CreateLayer()
@ 0x7f05c3d3308c caffe::Net::Init()
@ 0x7f05c3d350d4 caffe::Net::Net()
@ 0x7f05c38bb697 caffe::Solver::InitTrainNet()
@ 0x7f05c38bbc33 caffe::Solver::Init()
@ 0x7f05c38bc11c caffe::Solver::Solver()
@ 0x7f05c38d4f56 caffe::Creator_SGDSolver()
@ 0x41c746 caffe::SolverRegistry::CreateSolver()
@ 0x40fd35 train()
@ 0x40d1a8 main
@ 0x7f05c149b830 __libc_start_main
@ 0x40de49 _start
@ 0x0 (unknown)
Segmentation fault (core dumped)

AlexNet problem Batch Normalization caffe-0.16

Hello,

I am trying to finetune AlexNet with sparisification. I get the following error in caffe-jacinto (caffe-0.16) which i don't get when running the same process in caffe :

I0929 15:28:49.480206 19322 net.cpp:184] Created Layer fc6/bn (22)
I0929 15:28:49.480216 19322 net.cpp:561] fc6/bn <- fc6
I0929 15:28:49.480231 19322 net.cpp:530] fc6/bn -> fc6/bn
F0929 15:28:49.480550 19322 blob.hpp:252] Check failed: axis_index < num_axes() (2 vs. 2) axis 2 out of range for 2-D Blob with shape 100 4096 (409600)
*** Check failure stack trace: ***
@ 0x7f8d746ac5cd google::LogMessage::Fail()
@ 0x7f8d746ae433 google::LogMessage::SendToLog()
@ 0x7f8d746ac15b google::LogMessage::Flush()
@ 0x7f8d746aee1e google::LogMessageFatal::~LogMessageFatal()
@ 0x417f58 caffe::Blob::CanonicalAxisIndex()
@ 0x7f8d75519cce caffe::BatchNormLayer<>::LayerSetUp()
@ 0x7f8d756e2f29 caffe::Net::Init()
@ 0x7f8d756e492e caffe::Net::Net()
@ 0x7f8d752b3210 caffe::Solver::InitTrainNet()
@ 0x7f8d752b374d caffe::Solver::Init()
@ 0x7f8d752b3c22 caffe::Solver::Solver()
@ 0x7f8d752c0126 caffe::Creator_SGDSolver()
@ 0x41bce6 caffe::SolverRegistry::CreateSolver()
@ 0x4133e2 train()
@ 0x40deb8 main
@ 0x7f8d72de0830 __libc_start_main
@ 0x40eaf9 _start
@ (nil) (unknown)
root@6409698f2bc4:/workspace/imagenet-finetuning/Alexnet#

Best

Mobile SSD

Hi,
i am trying to train mobile SSD from https://github.com/chuanqi305/MobileNet-SSD. when trying to train only with quantization without sparse i dont see convergence: loss reaches 5.6 and stagnates.
the same phenomena happens when trying to train both from scratch and fine tunning.
I enabled global quantization and only in the first layer conv 0 specifically.
after running only one iteration of training i see that the weights of conv0 of the pre-trained network became 0.
few questions:
1.did you try mobile SSD?
2. Do you have some guidelines of how to train this netwrok?
3. why are the weights become 0 after first iteration?

thank you

Layerwise quantization

Hello manu,

is it correct to use setattr(layer.quantization_param.precision, 8) given the generated caffe_pb2 for setting the layerwise quantization ?

Also, is it possible to sparsify networks layer by layer ?

Thanks a lot,
Best

Batchnorm Fix

Hello Manu,

Do you think it would be possible for your team to fix this issue in caffe-jacinto?
NVIDIA#436

Thanks a lot,
Best

Quantization output varies (and other relevant issues)

Hi,

Is there any random number involved in the quantization process except the random value in stochastic rounding scheme?

I ask because I noticed that if I turn on quantization and feed a batch of 8 exact same testing images into my network, the semantic segmentation output turn out to be different for all 8 of them.

William

Edit 1: The output, although still varies, becomes more stable when power2_range is set to true.
Edit 2: The outputs of cpu mode and gpu mode are also different from one another.
Edit 3: Output becomes more stable when larger bitwidth is used.
Edit 4: Quantization actually starts after the first image during inference when Quantization_Start is set to 1

compatibility with caffe

Hello manu,

I tried to use a snapshot of a sparsified model from caffe-jacinto and to load it in caffe. However, I get an error stating that there is not enough weights and after checking the size of the 50% sparsified model I found that its half size of the original caffemodel. Would it be possible to have compatibility?

Thanks,
Best

caffe jacinto sparsification

Hello,

I am trying to fine-tune a model with sparsification. Actually, it corresponds to the alexnet architecture trained on imagenet data given here : https://github.com/cvjena/cnn-models . I am trying to finetune it with sparsification on a subset of imagenet data. My first step was to first test the accuracy of the model (Alexnet + caffemodel) provided on my subset of images using caffe only and I get results that are very close to what they obtained. My second step was to use caffe-jacinto to do the sparsification. Before doing that I tested the model the exact same way as in caffe with no sparsification using caffe-jacinto. Here is what I get :

W0811 14:14:31.177296 4905 net.cpp:811] Incompatible number of blobs for layer data/bn
W0811 14:14:31.177886 4905 net.cpp:819] Copying from data/bn to data/bn target blob 0
W0811 14:14:31.178071 4905 net.cpp:832] Shape mismatch, param: 0 layer: data/bn source: 3 (3) target: 1 3 1 1 (3).
W0811 14:14:31.178169 4905 net.cpp:819] Copying from data/bn to data/bn target blob 1
W0811 14:14:31.178247 4905 net.cpp:832] Shape mismatch, param: 1 layer: data/bn source: 3 (3) target: 1 3 1 1 (3).
W0811 14:14:31.178308 4905 net.cpp:819] Copying from data/bn to data/bn target blob 2
W0811 14:14:31.178381 4905 net.cpp:825] Cannot copy param 2 weights from layer 'data/bn'; shape mismatch. Source param shape is 1 (1); target param shape is 1 3 1 1 (3). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.
W0811 14:14:31.178517 4905 net.cpp:811] Incompatible number of blobs for layer conv1/bn
W0811 14:14:31.178555 4905 net.cpp:819] Copying from conv1/bn to conv1/bn target blob 0
W0811 14:14:31.178652 4905 net.cpp:832] Shape mismatch, param: 0 layer: conv1/bn source: 96 (96) target: 1 96 1 1 (96).
W0811 14:14:31.178719 4905 net.cpp:819] Copying from conv1/bn to conv1/bn target blob 1
W0811 14:14:31.178793 4905 net.cpp:832] Shape mismatch, param: 1 layer: conv1/bn source: 96 (96) target: 1 96 1 1 (96).
W0811 14:14:31.178854 4905 net.cpp:819] Copying from conv1/bn to conv1/bn target blob 2
W0811 14:14:31.178926 4905 net.cpp:825] Cannot copy param 2 weights from layer 'conv1/bn'; shape mismatch. Source param shape is 1 (1); target param shape is 1 96 1 1 (96). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

and so on for every batch normalization layer. however the testing moves forward to provide these poor results :
I0811 14:14:33.100739 4905 caffe.cpp:312] Batch 199, accuracy = 0
I0811 14:14:33.100769 4905 caffe.cpp:312] Batch 199, loss = 87
I0811 14:14:33.100780 4905 caffe.cpp:312] Batch 199, top5 = 0
I0811 14:14:33.100786 4905 caffe.cpp:317] Loss: 86.826
I0811 14:14:33.100814 4905 caffe.cpp:329] accuracy = 0.002
I0811 14:14:33.100836 4905 caffe.cpp:329] loss = 86.826 (* 1 = 86.826 loss)
I0811 14:14:33.100845 4905 caffe.cpp:329] top5 = 0.005

so it must be that the weights are not load correctly, my guess would be that the reshaping part is not set up correctly in the function void Net::CopyTrainedLayersFrom(const NetParameter& param) in net.cpp

PS: your full CIFAR example is perfectly working for me

Thank you,
Best,

Yassine

compile error - undefined reference to opencv functions

i am using opencv3.4.0, cuda 9.1, cudnn 7.1 in ubuntu 16.04, but getting error while compilation.
[note: i can compile sucessfully nvidia version of caffe and original caffe in same environment.]

[ 89%] Linking CXX executable upgrade_net_proto_text
[ 90%] Linking CXX executable upgrade_solver_proto_text
[ 92%] Linking CXX executable net_speed_benchmark
[ 92%] Built target test_net
[ 92%] Built target net_speed_benchmark
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_imageset.dir/build.make:140: recipe for target 'tools/convert_imageset' failed
make[2]: *** [tools/convert_imageset] Error 1
CMakeFiles/Makefile2:441: recipe for target 'tools/CMakeFiles/convert_imageset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_text.dir/build.make:140: recipe for target 'tools/upgrade_net_proto_text' failed
make[2]: *** [tools/upgrade_net_proto_text] Error 1
CMakeFiles/Makefile2:631: recipe for target 'tools/CMakeFiles/upgrade_net_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_text.dir/all] Error 2
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:140: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:555: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_annoset.dir/build.make:140: recipe for target 'tools/convert_annoset' failed
make[2]: *** [tools/convert_annoset] Error 1
CMakeFiles/Makefile2:593: recipe for target 'tools/CMakeFiles/convert_annoset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_annoset.dir/all] Error 2
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_binary.dir/build.make:140: recipe for target 'tools/upgrade_net_proto_binary' failed
make[2]: *** [tools/upgrade_net_proto_binary] Error 1
CMakeFiles/Makefile2:783: recipe for target 'tools/CMakeFiles/upgrade_net_proto_binary.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
[ 92%] Linking CXX executable extract_features
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::set(int, double)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::write(cv::Mat const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(cv::String const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::release()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_<int>, bool)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::get(int) const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::open(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::isOpened() const'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoWriter::~VideoWriter()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::~VideoCapture()'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::waitKey(int)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
../lib/libcaffe-nv.so.0.16.4: undefined reference to `cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/extract_features.dir/build.make:140: recipe for target 'tools/extract_features' failed
make[2]: *** [tools/extract_features] Error 1
CMakeFiles/Makefile2:745: recipe for target 'tools/CMakeFiles/extract_features.dir/all' failed
make[1]: *** [tools/CMakeFiles/extract_features.dir/all] Error 2
[ 93%] Linking CXX executable finetune_net
[ 93%] Built target finetune_net
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Build with CPU

Hi, Manu
I know that caffe-jacinto is fork from Nvcaffe, would you please tell that caffe-jacinto does support build with cpu ? I just want to run the example-caffe-jacinto/example/cpp_classification on TI's device platform AM5728(run the example on ARM, and then, dispatch the matrix compute to the DSP through LINALG lib). So, Is this feasible? if yes, would you please give me some guidence?
thanks
best regards
Bobo

centerLossLayer

add_centerLoss_error.txt
caffe.proto.txt
center_loss_layer.cpp.txt
center_loss_layer.cu.txt
center_loss_layer.hpp.txt

Hello, I want to train my model with caffe-jacinto-0.17 , but my net contain centerLoss layer, so I failed. I am try to add the 'center_Loss_layer.cpp/hpp/cu' to the src/include, but build the framework error, would you help me solve this question, thank you very much!

Otherwise, I don't understand how to set the parameters about sparse in solver.protext, are there any guidance documents?Besides, most of model was trained with three steps, first is initial, second is regularization, third is sparse, I want to know that does regularization_type:"L1" is necessary for sparse?
If I want to inference my model on my AM5728 platform with TIDL, do I have to add 'quantize:true' in my deploy.protext, thanks!

Support for RoiPooling Layer

Hello,
I see there are Layers for SSD like OD models. Is there any plan to include RoiPooling layer to run RCNN - like models?

Installation with Docker

Hello,

I am trying to install your new caffe-0.16 version using Docker but I am running into few problems.
Here is my Dockerfile :

+++++++++++++

FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
LABEL maintainer [email protected]

RUN apt-get update && apt-get install -y --no-install-recommends
build-essential \
cmake \
git \
wget \
libatlas-base-dev \
libboost-all-dev \
libgflags-dev \
libgoogle-glog-dev \
libhdf5-serial-dev \
libleveldb-dev \
liblmdb-dev \
libopencv-dev \
libprotobuf-dev \
libsnappy-dev \
protobuf-compiler \
python-dev \
python-numpy \
python-pip \
python-setuptools \
python-scipy && \
rm -rf /var/lib/apt/lists/*

ENV CAFFE_ROOT=/opt/caffe-jacinto
WORKDIR $CAFFE_ROOT

ENV CLONE_TAG=1.0

RUN git clone -b caffe-0.16 https://github.com/tidsp/caffe-jacinto

RUN git clone -b caffe-0.16 https://github.com/tidsp/caffe-jacinto-models

RUN cd caffe-jacinto && \
cp -f Makefile.config.example Makefile.config
RUN cd caffe-jacinto && \
sed -i '/USE_NCCL/s/^#//g' Makefile.config
RUN cd caffe-jacinto && \
sed -i '/WITH_PYTHON_LAYER/s/^#//g' Makefile.config
RUN cd caffe-jacinto && \
sed -i '/USE_CUDNN/s/^#//g' Makefile.config

RUN pip install --upgrade pip && \
cd caffe-jacinto/python && for req in $(cat requirements.txt) pydot; do pip install $req; done && cd .. && \
git clone https://github.com/NVIDIA/nccl.git && cd nccl && make -j install && cd .. && rm -rf nccl && \
mkdir build && cd build && \
cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 .. && \
make -j"$(nproc)"

ENV PYCAFFE_ROOT $CAFFE_ROOT/caffe-jacinto/python
ENV PYTHONPATH $PYCAFFE_ROOT:$PYTHONPATH
ENV PATH $CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$PATH
RUN echo "$CAFFE_ROOT/build/lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig

WORKDIR /workspace


+++++++++++++++++

Here is the error I get ::

nvcc fatal : Unsupported gpu architecture 'compute_70'
CMake Error at cuda_compile_generated_adagrad_solver.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adagrad_solver.cu.o

make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_adagrad_solver.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
src/caffe/CMakeFiles/caffe.dir/build.make:91: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_adagrad_solver.cu.o' failed
nvcc fatal : Unsupported gpu architecture 'compute_70'
CMake Error at cuda_compile_generated_hdf5_data_layer.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_hdf5_data_layer.cu.o

nvcc fatal : Unsupported gpu architecture 'compute_70'
nvcc fatal : Unsupported gpu architecture 'compute_70'
CMake Error at cuda_compile_generated_nesterov_solver.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_nesterov_solver.cu.o

src/caffe/CMakeFiles/caffe.dir/build.make:133: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_hdf5_data_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_hdf5_data_layer.cu.o] Error 1
CMake Error at cuda_compile_generated_lrn_layer.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_lrn_layer.cu.o

make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_nesterov_solver.cu.o] Error 1

...
...
...
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_layer.cu.o] Error 1
src/caffe/CMakeFiles/caffe.dir/build.make:315: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_layer.cu.o' failed
nvcc fatal : Unsupported gpu architecture 'compute_70'
CMake Error at cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o

CMake Error at cuda_compile_generated_slice_layer.cu.o.cmake:203 (message):
Error generating
/opt/caffe-jacinto/caffe-jacinto/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_slice_layer.cu.o

src/caffe/CMakeFiles/caffe.dir/build.make:378: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_concat_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_concat_layer.cu.o] Error 1
src/caffe/CMakeFiles/caffe.dir/build.make:455: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_inner_product_layer.cu.o' failed
src/caffe/CMakeFiles/caffe.dir/build.make:364: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_inner_product_layer.cu.o] Error 1
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o] Error 1
src/caffe/CMakeFiles/caffe.dir/build.make:413: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_slice_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_slice_layer.cu.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
CMakeFiles/Makefile2:272: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make: *** [all] Error 2
Makefile:127: recipe for target 'all' failed
The command '/bin/sh -c pip install --upgrade pip && cd caffe-jacinto/python && for req in $(cat requirements.txt) pydot; do pip install $req; done && cd .. && git clone https://github.com/NVIDIA/nccl.git && cd nccl && make -j install && cd .. && rm -rf nccl && mkdir build && cd build && cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 .. && make -j"$(nproc)"' returned a non-zero code: 2

Thank you,
Best,
Yassine

slower training speed

Hi,

I have compared the training speed between version 0.15 and 0.16, and found that 0.16 trains at a significantly slower speed with exactly the same settings. Why is that so?

Thanks.

William

Make runtest failed

Caffe jacinto build failed. Details are given below-

Make runtest

Please suggest solution.

GPU : Tesla K20c

Error:

make runtest
.build_release/tools/caffe
I0605 16:20:30.894817 3694 caffe.cpp:807] This is NVCaffe 0.16.4 started at Tue Jun 5 16:20:30 2018
I0605 16:20:30.895033 3694 caffe.cpp:810] CuDNN version: 6021
I0605 16:20:30.895043 3694 caffe.cpp:811] CuBLAS version: 8000
I0605 16:20:30.895050 3694 caffe.cpp:812] CUDA version: 8000
I0605 16:20:30.895058 3694 caffe.cpp:813] CUDA driver version: 9000
caffe: command line brew
usage: caffe

commands:
train train or finetune a model
test score a model
device_query show GPU diagnostic information
time benchmark model execution time

Flags from tools/caffe.cpp:
-ap_version (Average Precision type for object detection) type: string
default: "11point"
-display_sparsity (Display the amount of sparsity) type: bool
default: false
-gpu (Optional; run in GPU mode on given device IDs separated by ', '.Use
'-gpu all' to run on all available GPUs. The effective training batch
size is multiplied by the number of devices.) type: string default: ""
-iterations (The number of iterations to run.) type: int32 default: 50
-model (The model definition protocol buffer text file.) type: string
default: ""
-output (Prefix for output prototxt and caffemodel) type: string
default: ""
-show_per_class_result (Show per class result for object detection)
type: bool default: true
-sighup_effect (Optional; action to take when a SIGHUP signal is received:
snapshot, stop or none.) type: string default: "snapshot"
-sigint_effect (Optional; action to take when a SIGINT signal is received:
snapshot, stop or none.) type: string default: "stop"
-snapshot (Optional; the snapshot solver state to resume training.)
type: string default: ""
-solver (The solver definition protocol buffer text file.) type: string
default: ""
-threshold_fraction_high (Optional: fraction of weights to be zeroed)
type: double default: 0.90000000000000002
-threshold_fraction_low (Optional: fraction of weights to be zeroed)
type: double default: 0.40000000000000002
-threshold_fraction_mid (Optional: fraction of weights to be zeroed)
type: double default: 0.80000000000000004
-threshold_step_factor (Optional: step factor to find the optimal threshold
for each layer) type: double default: 1e-08
-threshold_value_max (Optional: vlues of weights below which are zeroed)
type: double default: 0.0001
-threshold_value_maxratio (Optional: determine threshold as a factor of
max) type: double default: 0.001
-weights (Optional; the pretrained weights to initialize finetuning,
separated by ', '. Cannot be set simultaneously with snapshot.)
type: string default: ""
.build_release/test/test_all.testbin 0 --gtest_shuffle
Cuda number of devices: 1
Setting to use device 0
Current device id: 0
Current device name: Tesla K20c
Note: Randomizing tests' orders with a seed of 77198 .
[==========] Running 1906 tests from 266 test cases.
[----------] Global test environment set-up.
[----------] 4 tests from SoftmaxWithLossLayerTest/3, where TypeParam = caffe::GPUDevice
[ RUN ] SoftmaxWithLossLayerTest/3.TestGradient
F0605 16:20:32.456480 3715 math_functions.cu:508] Check failed: error == cudaSuccess (8 vs. 0) invalid device function
*** Check failure stack trace: ***
@ 0x7fe4fff8c5cd google::LogMessage::Fail()
@ 0x7fe4fff8e433 google::LogMessage::SendToLog()
@ 0x7fe4fff8c15b google::LogMessage::Flush()
@ 0x7fe4fff8ee1e google::LogMessageFatal::~LogMessageFatal()
@ 0x7fe4fdef85d2 caffe::caffe_gpu_set<>()
@ 0x7fe4fda95c9d caffe::Tensor::gpu_set()
@ 0x7fe4fda95eb0 caffe::Tensor::set()
@ 0x4bea78 caffe::Layer<>::SetLossWeights()
@ 0x7fe4fde45249 caffe::SoftmaxWithLossLayer<>::LayerSetUp()
@ 0x4bb0a5 caffe::LayerBase::SetUp()
@ 0x4df53f caffe::GradientChecker<>::CheckGradientExhaustive()
@ 0x5f5ccc caffe::SoftmaxWithLossLayerTest_TestGradient_Test<>::TestBody()
@ 0x86e3a3 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x867d1a testing::Test::Run()
@ 0x867e68 testing::TestInfo::Run()
@ 0x867f45 testing::TestCase::Run()
@ 0x8681ff testing::internal::UnitTestImpl::RunAllTests()
@ 0x868533 testing::UnitTest::Run()
@ 0x46b909 main
@ 0x7fe4fcb2f830 __libc_start_main
@ 0x475329 _start
@ (nil) (unknown)
Makefile:565: recipe for target 'runtest' failed
make: *** [runtest] Aborted (core dumped)

Incorrect results for SSD Mobilenet model trained on caffe (forked from ssd caffe by weiliu)

I tried to run SSD Mobilentv1 model as per the instructions mentioned in the following git repo:
https://github.com/chuanqi305/MobileNet-SSD (just run the demo.py file, trained model and prototxt is given in the repo)

I am getting different (random and negative coordinates) output when I ran this code using caffe-jacinto. It works well with: https://github.com/weiliu89/caffe

Please let me know if I am doing something wrong!

Open CV issue on Jetson TX2

Hi, I am trying to install caffe-jacinto onto my jetson tx2 and I keep running to the following error:

CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::set(int, double)' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoWriter::write(cv::Mat const&)'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::open(cv::String const&)' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::release()'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_, bool)'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::isOpened() const' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::get(int) const'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoWriter::VideoWriter()' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::open(int)'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoWriter::isOpened() const' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoWriter::~VideoWriter()'
.build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::~VideoCapture()' .build_release/lib/libcaffe-nv.so: undefined reference to cv::VideoCapture::VideoCapture()'
collect2: error: ld returned 1 exit status
Makefile:655: recipe for target '.build_release/tools/get_image_size.bin' failed

any help?

Thanks

Incorrect results for certain models (Batch Normalization Issue)

There is a bug in the reading of Batch Norm weights that cause some models to produce incorrect results. These are example models that produce incorrect results: https://github.com/cvjena/cnn-models/tree/master/ResNet_preact

Solution: This issue has been fixed in NVIDIA/caffe in the lines starting here: https://github.com/NVIDIA/caffe/blob/caffe-0.17/src/caffe/net.cpp#L1161
I have placed the fix below. In this repo, in the file src/caffe/net.cpp you can find a function called CopyTrainedLayersFrom(). Copy that below code and replace in that file.

void Net::CopyTrainedLayersFrom(const NetParameter& param) {
int num_source_layers = param.layer_size();
for (int i = 0; i < num_source_layers; ++i) {
const LayerParameter& source_layer = param.layer(i);
const string& source_layer_name = source_layer.name();
const string& source_layer_type = source_layer.type();
const bool ignore_shape_mismatch = ((solver_==NULL) || solver_->param().ignore_shape_mismatch());
int target_layer_id = 0;
while (target_layer_id != layer_names_.size() &&
layer_names_[target_layer_id] != source_layer_name) {
++target_layer_id;
}
if (target_layer_id == layer_names_.size()) {
LOG(INFO) << "Ignoring source layer " << source_layer_name;
continue;
}
DLOG(INFO) << "Copying source layer " << source_layer_name;
vector<shared_ptr >& target_blobs =
layers_[target_layer_id]->blobs();
CHECK_EQ(target_blobs.size(), source_layer.blobs_size())
<< "Incompatible number of blobs for layer " << source_layer_name;
LOG(INFO) << "Copying source layer " << source_layer_name << " Type:"
<< source_layer_type << " #blobs=" << source_layer.blobs_size();
// check if BN is in legacy DIGITS format?
if (source_layer_type == "BatchNorm") {
for (int j = 0; j < target_blobs.size(); ++j) {
const bool kReshape = true;
target_blobs[j]->FromProto(source_layer.blobs(j), kReshape);
}
if (source_layer.blobs_size() == 5 && target_blobs[4]->count() == 1) {
// old format: 0 - scale , 1 - bias, 2 - mean , 3 - var, 4 - reserved
// new format: 0 - mean , 1 - var, 2 - reserved , 3- scale, 4 - bias
LOG(INFO) << "BN legacy DIGITS format detected ... ";
std::swap(target_blobs[0], target_blobs[2]);
std::swap(target_blobs[1], target_blobs[3]);
// ==> 0 - mean , 1 -var, 2 - scale , 3 - bias; 4 - reserved
std::swap(target_blobs[2], target_blobs[4]);
std::swap(target_blobs[3], target_blobs[4]);
LOG(INFO) << "BN Transforming to new format completed.";
}
if (source_layer.blobs_size() == 3) {
const float scale_factor = target_blobs[2]->cpu_data()[0] == 0.F ?
0.F : 1.F / target_blobs[2]->cpu_data()[0];
caffe_cpu_scale(target_blobs[0]->count(), scale_factor,
target_blobs[0]->cpu_data(),
target_blobs[0]->mutable_cpu_data());
caffe_cpu_scale(target_blobs[1]->count(), scale_factor,
target_blobs[1]->cpu_data(),
target_blobs[1]->mutable_cpu_data());
target_blobs[2]->mutable_cpu_data()[0] = 1.F;
}
} else {
for (int j = 0; j < target_blobs.size(); ++j) {
if (!target_blobs[j]->ShapeEquals(source_layer.blobs(j))) {
shared_ptr source_blob = Blob::create(target_blobs[j]->data_type(),
target_blobs[j]->diff_type());
const bool kReshape = true;
source_blob->FromProto(source_layer.blobs(j), kReshape);
if(ignore_shape_mismatch) {
LOG(WARNING) << "Cannot copy param " << j << " weights from layer '"
<< source_layer_name << "'; shape mismatch. Source param shape is "
<< source_blob->shape_string() << "; target param shape is "
<< target_blobs[j]->shape_string() << ". "
<< "To learn this layer's parameters from scratch rather than "
<< "copying from a saved net, rename the layer.";
} else {
LOG(FATAL) << "Cannot copy param " << j << " weights from layer '"
<< source_layer_name << "'; shape mismatch. Source param shape is "
<< source_blob->shape_string() << "; target param shape is "
<< target_blobs[j]->shape_string() << ". "
<< "To learn this layer's parameters from scratch rather than "
<< "copying from a saved net, rename the layer.";
}
}
const bool kReshape = false;
target_blobs[j]->FromProto(source_layer.blobs(j), kReshape);
}
}
}
CopyQuantizationRangeInLayers();
}

Build errors on Ubuntu 18.04

  • Building on Ubuntu 18.04 may face some road blocks - but they are solvable. The exact solution may vary slightly depending on the packages in your system. The following are some guidelines:

    (1) One issue is related to the opencv python package provided by anacoda. The solution is to remove that opencv python package (if you have it) and then install another one as follows.

    -- conda remove opencv

    -- conda install -c menpo opencv3

    (2) There may be symbol errors related to protobuf. Uninstalling system probuf library and installing anaconda protobuf package solved the issue in our case.

    -- sudo apt remove libprorobuf-dev

    -- conda install protobuf
    (3) If using CUDA 10, the following error may occur.
    cmake error: CUDA_cublas_device_LIBRARY (ADVANCED)
    This is due to an issue with cmake. Using cmake version >= 3.12.2 solves this issue. If anaconda has been installed recently, a recent version of cmake will be there in the anaconda bin directory and you can use it.

Softmax with weighted loss

Hi,

I notice that there is softmax_weighted_loss_layer in caffe-jacinto-0.15 but not in 0.16. Is it merged into softmax_loss_layer or is it removed totally?

If it is merged, how can I specify the weight in caffe-jacinto-0.16?
If it is removed, how can I use the weighted loss in caffe-jacinto-0.15?

Thanks.

William

Sparsification of Depthwise Separable Convolution

Hi,

I see in https://github.com/tidsp/caffe-jacinto/blob/caffe-0.16/src/caffe/net.cpp#L2078 that the sparsification process excludes thin layers and depthwise separable layers. I understand why thin layers are excluded as accuracy after sparsification may drop drastically. But why aren't DW separable layers sparsified?

Is there an easy workaround to make it work for DW separable layers? Or would the implementation be totally different from usual convolution layers?

Weighted Softmax Loss

Hi,

May I know what is the right way to use the 'label_weights' parameter in softmax loss layer to assign loss weights to different labels? To be more specific, how should I define the parameter in my train.prototxt?

William

Depthswise Convolution from existing Convolution Layer?

Hi,

I want to write MobileNet V1 and MobileNet V2 prototxt for caffe-jacinto.
And these 2 architecture has depthwise covolution as basis building block. As per my understanding of existing Convolution Layer, We can use it as depthwise convolution layer by mentioning number outputs equal to number of groups in conv layer parameter.

Is my understanding correct?
If depthwise convolution layer can be written using existing convolution layer, then why there is need to introduce new ConvolutionDepthwise Layer ?

Ref: TODO in the next release (not yet added): sp2823/caffe, BVCL/caffe/pull/5665 - ConvolutionDepthwise layer for faster depthwise separable convolutions.

Regards,
Sagar

Problem in the build of caffe-jacinto caffe-0.16

Hello,

there is a little problem during the installation with boost::basic_regex. I created a pull request that solves this problem.

Thank you,
Yassine

[ 98%] Linking CXX executable extract_features
cd /opt/caffe-jacinto/caffe-jacinto/build/tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/extract_features.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -Wall -std=c++11 -Wno-sign-compare -Wno-uninitialized -O3 -DNDEBUG CMakeFiles/extract_features.dir/extract_features.cpp.o -o extract_features -rdynamic ../lib/libcaffe-nv.so.0.16.4 ../lib/libproto.a -lboost_system -lboost_thread -lboost_filesystem -lboost_chrono -lboost_date_time -lboost_atomic -lpthread -lpthread -lglog -lgflags -lprotobuf /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5_hl.so /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so -lsz -lz -ldl -lm -lpthread -lpthread -lglog -lgflags -lprotobuf /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5_hl.so /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so -lsz -lz -ldl -lm -llmdb -lleveldb -lsnappy /usr/local/cuda/lib64/libcudart.so /usr/local/cuda/lib64/libcurand.so /usr/local/cuda/lib64/libcublas.so -lcudnn /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9 /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.9 /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.9 -llapack_atlas -lcblas -latlas -lpython2.7 -lboost_python /usr/local/lib/libnccl.so -lnvidia-ml -Wl,-rpath,/opt/caffe-jacinto/caffe-jacinto/build/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib:/usr/local/cuda/lib64:/usr/local/lib::::::::
../lib/libcaffe-nv.so.0.16.4: undefined reference to boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' collect2: error: ld returned 1 exit status tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:139: recipe for target 'tools/upgrade_solver_proto_text' failed make[2]: Leaving directory '/opt/caffe-jacinto/caffe-jacinto/build' make[2]: *** [tools/upgrade_solver_proto_text] Error 1 CMakeFiles/Makefile2:479: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2 ../lib/libcaffe-nv.so.0.16.4: undefined reference to boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits > >::do_assign(char const*, char const*, unsigned int)'
collect2: error: ld returned 1 exit status

missing a member function "sparsity_threshold_maxratio()"

It seems the latest build missing a function named "sparsity_threshold_maxratio()"

src/caffe/solver.cpp:419:49: error: ‘const class caffe::SolverParameter’ has no member named ‘sparsity_threshold_maxratio’
         float threshold_value_maxratio = param_.sparsity_threshold_maxratio(); //0.1; //0.2;

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.