Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

Model Optimizer cannot handle Caffe model

redradist
Novice
1,211 Views

Hi all,

 

I am trying to run `hello_reshape_ssd` example and for this I run the following commands:

```console

alias ov_model_downloader=$OPENVINO_DIR/deployment_tools/open_model_zoo/tools/downloader/downloader.py
alias ov_model_optimizer=$OPENVINO_DIR/deployment_tools/model_optimizer/mo.py

ov_model_downloader --name ssd300

ov_model_optimizer --framework caffe --input_model ./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.caffemodel

```

And for last command I get the following error:

```console

[ FRAMEWORK ERROR ] Exception message: [Errno 2] No such file or directory: '<Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt'

Possible reasons:
1. <Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt does not exist
2. <Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt does not have a valid structure, for example, it was downloaded as html
3. <Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt contains custom layers or attributes that are not supported
in Model Optimizer by default.

After you made sure that <Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt has a valid structure and still see this issue, then
you need to generate a python parser for caffe.proto that was used when the model
was created.
Run "python3 generate_caffe_pb2.py --input_proto ${PATH_TO_CAFFE}/src/caffe/proto/caffe.proto"
For more information please refer to Model Optimizer FAQ, question #1. (https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html?question=1#question-1)


[ FRAMEWORK ERROR ] Model Optimizer is not able to parse <Some Dir>/OpenVINO/inference-engine/samples/hello_reshape_ssd/./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.prototxt

```

By some reason model optimizer cannot parse properly model that I downloaded from Open Model Zoo ...

 

Maybe I've missed some dependency ?

Seems like by some reason Model Optimizer detects this model as Tensorflow, because it tries to read .prototxt

0 Kudos
1 Solution
redradist
Novice
1,008 Views

I've checked ... issue fixed with Python 3.8 !!

View solution in original post

0 Kudos
11 Replies
Zulkifli_Intel
Moderator
1,161 Views

Hello Denis Kotov,


Thank you for contacting us.


To convert the Caffee model to IR:

python3 mo_caffee.py --input_model /path/to/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.caffeemodel --input_proto /path/to/deploy.pototxt


Please visit Hello Reshape SSD C++ Sample page for more information. 


Regards,

Zulkifli




0 Kudos
redradist
Novice
1,156 Views

I've checked it previously, but also I've read Model Optimizer documentation https://docs.openvinotoolkit.org/2021.2/openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Caffe.html

 

And there you can see there following line:

 

python3 mo.py --input_model <INPUT_MODEL>.caffemodel

 

 It seems like documentation is outdated ?

 

Also I've tested your command as it:

 

python3 $OPENVINO_DIR/deployment_tools/model_optimizer/mo_caffe.py --input_model ./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.caffemodel --input_proto ./public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/deploy.prototxt

 

And I still have got the same error ... (

 

 

0 Kudos
Zulkifli_Intel
Moderator
1,143 Views

Hello Denis Kotov,

 

What is the OpenVINO version that you use?

 

Try to put the full path to the input model and input proto. For instant:

python3 mo_caffee.py --input_model /opt/intel/openvino_2021.2.185/deployment_tools/open_model_zoo/tools/downloader/public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.caffemodel --input_proto /opt/intel/openvino_2021.2.185/deployment_tools/open_model_zoo/tools/downloader/public/ssd300/models/VGGNet/VOC0712Plus/deploy.prototxt/

 

Regards,

Zulkifli

 

0 Kudos
redradist
Novice
1,132 Views

I've tested with full path and the same issue ...

The version I am testing is `releases/2021/3`

And I am using downloaded models from Zoo that is located in current folder like `$PWD/public/ssd300/models/VGGNet/VOC0712Plus/SSD_300x300_ft/VGG_VOC0712Plus_SSD_300x300_ft_iter_160000.caffemodel`

0 Kudos
Zulkifli_Intel
Moderator
1,117 Views

Hello Denis Kotov,


Please try these steps. 

 

Install the dependencies.

Go to dependencies directory:

cd /opt/intel/openvino_2021/install_dependencies

Run the script:

sudo -E ./install_openvino_dependencies.sh

 

Set the environment variable:

source /opt/intel/openvino_2021/bin/setupvars.sh

 

Install the prerequisites:

Go to the Model Optimizer prerequisites directory:

cd /opt/intel/openvino_2021/deployment_tools/model_optimizer/install_prerequisites

Run the script:

sudo ./install_prerequisites.sh


Please inform us if you encounter any error while installing dependencies and prerequisites.


Regards,

Zulkifli


0 Kudos
redradist
Novice
1,096 Views

Nope ... still this issue:

[ ERROR ] Error while emitting attributes for layer relu1_1 (id = 5). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.

0 Kudos
Zulkifli_Intel
Moderator
1,079 Views

Hello Denis Kotov,


Can you share the Python version that you are using?


Regards,

Zulkifli


0 Kudos
redradist
Novice
1,033 Views
0 Kudos
redradist
Novice
1,016 Views

Seems like I have found the similar issue:

https://github.com/openvinotoolkit/openvino/issues/3823

 

Probably it is relate to python version ... I will check

0 Kudos
redradist
Novice
1,009 Views

I've checked ... issue fixed with Python 3.8 !!

0 Kudos
Zulkifli_Intel
Moderator
1,000 Views

Hello Denis,


This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question. 


Regards,

Zulkifli


0 Kudos
Reply