Git Product home page Git Product logo

Comments (3)

thundertrick avatar thundertrick commented on May 12, 2024

+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/

from enet.

thundertrick avatar thundertrick commented on May 12, 2024

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

from enet.

thundertrick avatar thundertrick commented on May 12, 2024

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!

from enet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.