jay-mahadeokar / pynetbuilder

pyNetBuilder is a modular pytonic interface with builtin modules for generating popular caffe prototxt network file definitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What's the mean file of the pretrained models?

kli-casia opened this issue · comments

Thanks @jay-mahadeokar
I am using your pretrained resnet50 model to test on imagenet val dataset.
The prototxt I use is https://github.com/jay-mahadeokar/pynetbuilder/blob/master/models/imagenet/resnet_50/test.prototxt
I use my own data layer as follows

layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  transform_param {
    crop_size: 224
    mean_value: 104
    mean_value: 117
    mean_value: 123
  }
  data_param {
    source: "/home/kli/extra2/ImageNetLMDB/ilsvrc12_val_lmdb"
    batch_size: 25
    backend: LMDB
  }
}

The model weights is download from https://www.dropbox.com/s/k382wr2bzi59m4c/resnet_50.caffemodel?dl=0

But caffe shows some error message

Cannot copy param 0 weights from layer 'conv_stage0_block0_proj_shortcut'; shape mismatch.  Source param shape is 256 64 1 1 (16384); target param shape is 128 64 1 1 (8192). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

The test command I use is

 ~/local/caffe-master/build/tools/caffe test -model test.prototxt -weights resnet_50.caffemodel -gpu 2 -iterations 2000

Looks like I have made some error in uploading the train.prototxt and test.prototxts ( in resnet_50 I might have copied resnet_50_1by2 by mistake) Give me some time to check and commit the correct ones.

Thank you very much @jay-mahadeokar

@kli-nlpr can you check once again? I uploaded the correct file and hopefully it should work. Haven't run it myself so let me know if there is still some bug.

Great, I works this time

I0910 10:13:48.260939 10409 caffe.cpp:308] Batch 1998, loss = 1.35442
I0910 10:13:48.406500 10409 caffe.cpp:308] Batch 1999, accuracy = 0.68
I0910 10:13:48.406550 10409 caffe.cpp:308] Batch 1999, loss = 1.40331
I0910 10:13:48.406558 10409 caffe.cpp:313] Loss: 1.25629
I0910 10:13:48.406581 10409 caffe.cpp:325] accuracy = 0.697541
I0910 10:13:48.406594 10409 caffe.cpp:325] loss = 1.25629 (* 1 = 1.25629 loss)

The overall accuracy is slightly lower than yours 0.697541 vs 0.7175.

Good to know you are able to run it! About accuracy im not sure what would be the difference. Maybe the way test images are resized/cropped? I have resized the images to 256x256, and I believe at test time center crop of 224x224 is taken. I used caffe on spark for my experiments.

Thank you very much for your timely help @jay-mahadeokar