Open Davidnet opened 6 years ago
+1 same issue.
There is no need to unzip the caffemodel, which is not a zip file according to issue 38. So I download the pre-trained model with following scripts:
#!/bin/bash
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
echo $DIR
wget -O $DIR/weights.caffemodel https://www.dropbox.com/sh/5wjmb5twfr5b0wo/AADEpW5a8-GSSt5pfJYCKxoOa?dl=1
wget -O $DIR/weights2.caffemodel https://www.dropbox.com/s/3i367gsl7sspeo1/cityscapes_weights_before_bn_merge.caffemodel?dl=1
# unzip $DIR/weights.caffemodel
# unzip $DIR/weights2.caffemodel
# rm $DIR/weights.caffemodel
# rm $DIR/weights2.caffemodel
Test the model with:
python2 test_segmentation.py
--model ../prototxts/enet_deploy_final.prototxt
--weights ../enet_weights_zoo/weights2.caffemodel # Also tried weights.caffemodel, but the result is the same
--colours ../scripts/cityscapes19.png
--input_image ../example_image/munich_000000_000019_leftImg8bit.png
--out_dir ../example_image
And the output:
WARNING: Logging before InitGoogleLogging() is written to STDERR
W1208 11:09:47.429265 3974812608 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface
W1208 11:09:47.429303 3974812608 _caffe.cpp:140] Use this instead (with the named "weights" parameter):
W1208 11:09:47.429308 3974812608 _caffe.cpp:142] Net('../prototxts/enet_deploy_final.prototxt', 1, weights='../enet_weights_zoo/weights2.caffemodel')
[libprotobuf ERROR google/protobuf/text_format.cc:288] Error parsing text-format caffe.NetParameter: 65:12: Message type "caffe.LayerParameter" has no field named "bn_param".
F1208 11:09:47.436847 3974812608 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: ../prototxts/enet_deploy_final.prototxt
*** Check failure stack trace: ***
[1] 77441 abort python2 test_segmentation.py --model ../prototxts/enet_deploy_final.prototxt
I am wondering if something is wrong with the weight.caffemodel
. Cause in original tutorial, the model name is cityscapes_weights.caffemodel
:
$ python test_segmentation.py --model ENet/prototxts/enet_deploy_final.prototxt \
--weights ENet/enet_weights_zoo/cityscapes_weights.caffemodel \
--colours ENet/scripts/cityscapes19.png \
--input_image ENet/example_image/munich_000000_000019_leftImg8bit.png \
--out_dir ENet/example_image/
Solved!
After googling around, I found 'bn_param' is not in standard caffe code. Thus Enet uses a special caffe and we have to compile it according to the tutorial. As i am using mac for test, I changed the cmake config like this:
$ cd ENet/caffe-enet
$ mkdir build && cd build
$ cmake -DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DCPU_ONLY=ON ..
$ make all -j8 && make pycaffe
HOWEVER, this is not the end, I met another Check failed
error similar to #21:
...
I1208 14:25:09.821938 3974812608 net.cpp:228] prelu1_0_4_prelu1_0_4_0_split does not need backward computation.
I1208 14:25:09.821945 3974812608 net.cpp:228] prelu1_0_4 does not need backward computation.
I1208 14:25:09.822002 3974812608 net.cpp:228] eltwise1_0_4 does not need backward computation.
I1208 14:25:09.822016 3974812608 net.cpp:228] conv1_0_4 does not need backward computation.
I1208 14:25:09.822024 3974812608 net.cpp:228] pool1_0_4 does not need backward computation.
I1208 14:25:09.822031 3974812608 net.cpp:228] conv1_0_2 does not need backward computation.
I1208 14:25:09.822038 3974812608 net.cpp:228] prelu1_0_1 does not need backward computation.
I1208 14:25:09.822046 3974812608 net.cpp:228] conv1_0_1 does not need backward computation.
I1208 14:25:09.822054 3974812608 net.cpp:228] prelu1_0_0 does not need backward computation.
I1208 14:25:09.822060 3974812608 net.cpp:228] conv1_0_0 does not need backward computation.
I1208 14:25:09.822068 3974812608 net.cpp:228] prelu0_1_prelu0_1_0_split does not need backward computation.
I1208 14:25:09.822077 3974812608 net.cpp:228] prelu0_1 does not need backward computation.
I1208 14:25:09.822083 3974812608 net.cpp:228] bn0_1 does not need backward computation.
I1208 14:25:09.822130 3974812608 net.cpp:228] concat0_1 does not need backward computation.
I1208 14:25:09.822139 3974812608 net.cpp:228] pool0_1 does not need backward computation.
I1208 14:25:09.822146 3974812608 net.cpp:228] conv0_1 does not need backward computation.
I1208 14:25:09.822154 3974812608 net.cpp:228] data_data_0_split does not need backward computation.
I1208 14:25:09.822161 3974812608 net.cpp:228] data does not need backward computation.
I1208 14:25:09.822167 3974812608 net.cpp:270] This network produces output deconv6_0_0
I1208 14:25:09.822378 3974812608 net.cpp:283] Network initialization done.
I1208 14:25:09.830493 3974812608 net.cpp:761] Ignoring source layer label_data_1_split
F1208 14:25:09.831578 3974812608 net.cpp:767] Check failed: target_blobs.size() == source_layer.blobs_size() (2 vs. 1) Incompatible number of blobs for layer conv1_0_0
*** Check failure stack trace: ***
[1] 84532 abort python2 test_segmentation.py --model ../prototxts/enet_deploy_final.prototxt
Finally Solved!
In #38, it is suggest not to unzip weight2.caffemodel
, but weight.caffemodel
should be unziped.
After unzip the model, I get 2 different models:
../enet_weights_zoo
├── README.md
├── cityscapes_weights.caffemodel
├── cityscapes_weights.sh
├── cityscapes_weights_before_bn_merge.caffemodel
├── weights.caffemodel
└── weights2.caffemodel
So just use cityscapes_weights.caffemodel
as the tutorial said!
On a fresh checkout and downloading directly on dropbox, when running the test_segmentation.py (as shown in the tutorial) (I'm suspecting on the wieghts on dropbox)
Could you check the dropbox files?
Thanks for the awesome work!