SqueezeNext
SqueezeNext copied to clipboard
Is there 'Scale1' layer in '2.0-SqNxt-23v5'?
Hi,
I downloaded your '2.0-SqNxt-23v5' caffemodel and tried converting it to CoreML model. However, Core ML Tools said, "Caffe layer 'Scale1' is defined in the .portotxt file but is missing from the .caffemodel file". Would you tell me your '2.0-SqNxt-23v5' model(_iter_150136.caffemodel) has 'Scale1' layer or not?
I have just tried to run your _iter_150136.caffemodel of '2.0-SqNxt-23v5' on my raspberrypi also. I got error messages like below. So I guess something wrong in caffemodel or deploy.prototxt.
I0723 12:40:33.415792 1293 upgrade_proto.cpp:79] Attempting to upgrade batch norm layers using deprecated params: /home/pi/SqueezeNext/_iter_150136.caffemodel I0723 12:40:33.416265 1293 upgrade_proto.cpp:82] Successfully upgraded batch norm layers using deprecated params. I0723 12:40:33.416329 1293 net.cpp:744] Ignoring source layer data I0723 12:40:33.416359 1293 net.cpp:744] Ignoring source layer label_data_1_split F0723 12:40:33.416440 1293 net.cpp:750] Check failed: target_blobs.size() == source_layer.blobs_size() (3 vs. 5) Incompatible number of blobs for layer BatchNorm1 *** Check failure stack trace: ***
Seeing the same error. I took the 1.0-SqNxt-23v5 model, trained it on my dataset, prepared deploy.prototxt by removing data and accuracy layers, but when trying to load network for inference, getting same
I0728 18:14:12.493096 2714620736 net.cpp:242] This network produces output prob
I0728 18:14:12.493439 2714620736 net.cpp:255] Network initialization done.
I0728 18:14:12.527724 2714620736 upgrade_proto.cpp:77] Attempting to upgrade batch norm layers using deprecated params: ../android/app/src/main/assets/squeezenext_0728_40.caffemodel
I0728 18:14:12.527822 2714620736 upgrade_proto.cpp:80] Successfully upgraded batch norm layers using deprecated params.
I0728 18:14:12.527838 2714620736 net.cpp:744] Ignoring source layer label_data_1_split
F0728 18:14:12.527879 2714620736 net.cpp:750] Check failed: target_blobs.size() == source_layer.blobs_size() (3 vs. 5) Incompatible number of blobs for layer BatchNorm1
@amirgholami , any ideas?
You need to use IntelCaffe (https://github.com/intelcaffe/caffe/) to load the model. The reason you see (3 vs. 5) error is because IntelCaffe fuses batch norm and convolution layers to optimization execution speed of those layers (a similar technique is used in Tensorflow as well). Please let me know if you still have problems running the code
I see, thanks for getting back on this @amirgholami . I'm trying to use the model for inference on mobile devices afterwards, so using IntelCaffe might be challenging. Do you know if it is possible to "export" the IntelCaffe model to something compatible with traditional Caffe?
If you set the following environment variable then it will not do the batch norm folding:
export DISABLE_BN_FOLDING=0
(You may need to read the model and then re-save it with this flag)
Thank you for your reply. So I have to use IntelCaffe to load and save the model with DISABLE_BN_FOLDING=0 anyway? Or can I do it with Caffe on raspberrypi?