ResNet-50 Testing
I am trying to get ResNet-50 to run on nvidia's 0.16 branch of caffe and I get the following error.
F0711 15:52:32.952157 23976 net.cpp:797] Check failed: target_blobs.size() == source_layer.blobs_size() (5 vs. 3) Incompatible number of blobs for layer bn_conv1
However, my version of the main branch of caffe runs this network just fine and it was cloned in the beginning of June. I have attached the prototxt, ResNet-50-deploy.txt file I am using in case that helps.
0.16 is a development branch. Can you try 0.15 which is the current slated release branch?
I still get the same error on both branches
Ah, yes. BVLC caffe uses a different setup for batchnorm where they separate out scale, bias and actual batchnorm. We don't because it kills performance. You need to collapse it down into one layer like:
layer {
name: "conv1_bn"
type: "BatchNorm"
bottom: "conv1_output"
top: "conv1_bn"
param {
lr_mult: 1
}
param {
lr_mult: 1
}
batch_norm_param {
scale_filler {
type: "constant"
value: 1
}
bias_filler {
type: "constant"
value: 0
}
moving_average_fraction: .9
}
}
I made those changes and now I am getting the following error.
F0711 17:54:51.704648 9299 net.cpp:404] Top blob 'conv1' produced by multiple sources
You likely have top: "conv1" in multiple places.
Here is my new deploy file after making those changes. ResNet-50-deploy.txt
I had a typo which created the blob error. After correcting the typo, I am not getting the blob error, but the same error I had initially after making the changes suggested by thatguymike.
I don't think batch-norm supports in-place computation (which your example uses).
I have same problem when I fine-tune ResNet network with pre-trained caffemodel provided by https://github.com/KaimingHe/deep-residual-networks
Between nvcaffe-0.14 and nvcaffe-0.15, required blob size of BN layer was increased from 3 to 5. Provided pre-trained model was made when blob size of BN layer was 3 but in current caffe blob size of BN layer is 5. Is there any way to upgrade caffemodel or add compatible code?
I got the same error , any one got a solution ?
@richardmarcum Do you solve the problem of this , by change the defination of bn prototxt? Tanks every much!!
Still not working, even after applying all the advice from this thread. @thatguymike @lukeyeager help please. Please provide us with a working ResNet prototxt compatible with latest Digits.
If your only problem is that you can't copy the weights from a pretrained model, then just rename those layers (see my SO post from this morning).
@IsaacYangSLA is working on a distribution method for DIGITS-compatible models (https://github.com/NVIDIA/DIGITS/pull/1077) but it's not ready yet.
I got the same error, and what @thatguymike suggested did not seem to work. I guess @dccho had a good idea how this error happens, can anyone fix this compatible problem? ResNet 50 is quite a popular model and the BatchNorm layer is widely used...
I have the same question, does someone solve this problem?
I got the smae error @dccho 's idea is make sense. Still have no way to fix it? @thatguymike
It looks like that Batchnorm layer and adjacent Scale layer are integrated in single Batchnorm layer in NVIDIA caffe. However original BVLC/caffe doesn't integrate them. That means any networks and pretrained models using batchnorm and scale layers with original Caffe cannot use in NVIDIA caffe and DIGITS.
This is addressed in 0.16