ShichenLiu / CondenseNet

CondenseNet: Light weighted CNN for mobile devices
MIT License
694 stars 131 forks source link

Running pretrained networks #9

Closed lolz0r closed 6 years ago

lolz0r commented 6 years ago

Hi, Cool ideas in regard to condense net!

I seem to have an issue running the pretrained network 'converted_condensenet_8.pth.tar'. Running the command:

python main.py --model condensenet_converted -b 32 -j 20 ~/imagenet/ --stages 4-6-8-10-8 --growth 8-16-32-64-128 --gpu 1 --resume --evaluate-from ../converted_condensenet_8.pth.tar

Results in an error:

Traceback (most recent call last):

  File "main.py", line 479, in <module>
    main()
  File "main.py", line 168, in main
    model.load_state_dict(state_dict)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 487, in load_state_dict
    .format(name, own_state[name].size(), param.size()))
RuntimeError: While copying the parameter named module.features.denseblock_1.denselayer_1.conv_1.conv.weight, whose dimensions in the model are torch.Size([32, 4, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 2, 1, 1]).

It appears that perhaps the parameters for 'stages' or 'growth' may not be set correctly? Please let me know if you have any insights!

ShichenLiu commented 6 years ago

Hi,

You should explicitly give the condense-factor parameter to specify the model:

python main.py --model condensenet_converted -b 64 -j 4 /PATH/TO/imagenet --stages 4-6-8-10-8 --growth 8-16-32-64-128 --group-1x1 8 --group-3x3 8 --condense-factor 8 --evaluate-from ../converted_condensenet_8.pth.tar --gpu 0