Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DenseNet161 deploy prototxt (ceil_mode and round_mode) error #37

Open
mrgransky opened this issue Apr 30, 2020 · 9 comments
Open

DenseNet161 deploy prototxt (ceil_mode and round_mode) error #37

mrgransky opened this issue Apr 30, 2020 · 9 comments

Comments

@mrgransky
Copy link

mrgransky commented Apr 30, 2020

Loading .caffemodel and deploy.ptototxt in caffe for TEST phase returns the following error:

[libprotobuf ERROR google/protobuf/text_format.cc:288] Error parsing text-format caffe.NetParameter: 54:14: Message type "caffe.PoolingParameter" has no field named "ceil_mode".
F0430 20:48:24.400027 24399 upgrade_proto.cpp:90] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: MODELS/DenseNet161/ImageNet/deploy.prototxt
*** Check failure stack trace: ***
Aborted (core dumped

ur Baidu link (https://pan.baidu.com/s/1gfjD8cF) seems to be broken too! Do u have updated version of that link?

@LYC-vio
Copy link

LYC-vio commented May 14, 2020

I've found that this problem (has no field named "ceil_mode") could be solved by changing the "ceil_mode: false" line to "round_mode: FLOOR" in the prototxt file to fit the new version of Caffe. The new version of Caffe use round_mode: CEIL/FLOOR to choose which mode to use (default CEIL).

I have tested this modification on Densenet161 and it didn't seem to affect the performance.

Hope this can help.

@mrgransky
Copy link
Author

Tnx for the update, now I get the following error:

Cannot copy param 0 weights from layer 'conv1'; shape mismatch.  Source param shape is 96 3 7 7 (14112); target param shape is 64 3 7 7 (9408). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.
*** Check failure stack trace: ***
Aborted (core dumped)

It seems conv1 should be renamed to something cuz I found similar issue ppl solved this new problem here, but how do we fix it for DenseNet161?

Did u encounter the same problem?

@LYC-vio
Copy link

LYC-vio commented May 16, 2020

Sorry, I didn't encounter this problem. Maybe you can check whether your .caffemodel file matches the .prototxt file correctly... I mean, the conv1 layer of DenseNet_121 and DenseNet_169 is 64 3 7 while the conv1 layer of DenseNet_161 is 96 3 7, maybe you have mismatched DenseNet_169.caffemodel to DenseNet_161.prototxt or something like that I guess?

@mrgransky
Copy link
Author

Oohh! yes, u're absolutely right!
I had mistakenly had different weight.caffemodel and deploy.prototxt files! now it works flawless with modification u suggested: replace ceil_mode: false in deploy.prototxt to round_mode: FLOOR.
Cheers,

@LYC-vio
Copy link

LYC-vio commented May 17, 2020

Congrats! Happy to hear that!

@mrgransky mrgransky reopened this May 17, 2020
@mrgransky mrgransky changed the title DenseNet161 deploy prototxt error DenseNet161 deploy prototxt (ceil_mode and round_mode) error May 17, 2020
@mrgransky
Copy link
Author

In another PC in which caffe-gpu is installed via anaconda, I get error for both ceil_mode: false and round_mode: FLOOR though!

deploy.prototxt with ceil_mode: false:

[libprotobuf ERROR google/protobuf/text_format.cc:307] Error parsing text-format caffe.NetParameter: 54:14: Message type "caffe.PoolingParameter" has no field named "ceil_mode".
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0517 18:27:14.369987 16944 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: MODELS/DenseNet161/ImageNet/deploy.prototxt
*** Check failure stack trace: ***
Aborted

deploy.prototxt with round_mode: FLOOR:

[libprotobuf ERROR google/protobuf/text_format.cc:307] Error parsing text-format caffe.NetParameter: 54:15: Message type "caffe.PoolingParameter" has no field named "round_mode".
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0517 18:32:19.467856 17462 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: MODELS/DenseNet161/ImageNet/deploy.prototxt
*** Check failure stack trace: ***
Aborted

This is my python specification and caffe version:

Python 2.7.17 |Anaconda, Inc.| (default, Oct 21 2019, 19:04:46) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> caffe.__version__
'1.0.0'

I also noticed #32 is an open issue regarding this but is there any workaround for anaconda version of caffe?

@LYC-vio
Copy link

LYC-vio commented May 18, 2020

I don't have any idea about this error message... A possible solution is to check those corresponding lines mentioned by https://github.com/BVLC/caffe/pull/3057/files (see also #1) in caffe-gpu from anaconda to see what params are actually used and modify the .prototxt file.

@LYC-vio
Copy link

LYC-vio commented May 18, 2020

Alternatively, you can install another caffe from source code and use sys.path.insert to specify which caffe to use.
eg:

import sys
sys.path.insert(0,"path/to/your/caffe/python")
import caffe

@mrgransky
Copy link
Author

@LYC-vio I'm afraid installing caffe from source is an option cuz this a univ GPU clusters and we do not get sudo prriviledge for package installation/manipulation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants