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.

Facing Issue while using Model Optimizer

Yogesh_P_Intel
Employee
659 Views
I am testing out model optimizer for custom layers and I got this Error. Could you help me in resolving this issue?
 
deeplearning@deep-learning-virtual-machine:/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer$  sudo python3 mo.py --input_model ../../../../../home/deeplearning/Downloads/faster_rcnn_models/ZF_fast
er_rcnn_final.caffemodel --input_proto ../../../../../home/deeplearning/Downloads/test.prototxt
Model Optimizer arguments
Batch: 1
Precision of IR: FP32
Enable fusing: True
Enable gfusing: True
Names of input layers: inherited from the model
Path to the Input Model: ../../../../../home/deeplearning/Downloads/faster_rcnn_models/ZF_faster_rcnn_final.caffemodel
Input shapes: inherited from the model
Log level: ERROR
Mean values: ()
IR output name: inherited from the model
Names of output layers: inherited from the model
Path for generated IR: /opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer
Reverse input channels: False
Scale factor: None
Scale values: ()
Version: 0.3.75.d6bae621
Input proto file: ../../../../../home/deeplearning/Downloads/test.prototxt
Path to CustomLayersMapping.xml: extensions/front/caffe/CustomLayersMapping.xml
Path to a mean file:
Offsets for a mean file: None
[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  'Python'
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/main.py", line 222, in main
    return driver(argv)
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/main.py", line 202, in driver
    custom_layers_mapping_path=custom_layers_mapping_path)
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/pipeline/caffe.py", line 106, in driver
    extract_node_attrs(graph, lambda node: caffe_extractor(node, check_for_duplicates(caffe_type_extractors)))
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/front/extractor.py", line 413, in extract_node_attrs
    supported, new_attrs = extractor(Node(graph, node))
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/pipeline/caffe.py", line 106, in <lambda>
    extract_node_attrs(graph, lambda node: caffe_extractor(node, check_for_duplicates(caffe_type_extractors)))
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/front/caffe/extractor.py", line 127, in caffe_extractor
    result.update(caffe_type_extractors[name](node))
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/front/common/register_custom_ops.py", line 95, in <lambda>
    node, cls, disable_omitting_optional, enable_flattening_optional_params),
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/front/common/register_custom_ops.py", line 27, in extension_extractor
    supported = ex.extract(node)
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/extensions/front/caffe/python_proposal-ext.py", line 13, in extract
    Op.get_op_class_by_name(__class__.op).update_node_stat(node, attrs)
  File "/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer/mo/ops/op.py", line 185, in get_op_class_by_name
    return __class__.registered_ops[name]
KeyError: 'Python'
 
[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------
0 Kudos
4 Replies
Alexander_D_Intel1
659 Views

Hi Yogesh,

This model contains Proposal layer with type 'Python'.

Currently Model Optimizer provides limited support to such layers.

However, you can still work with this model. In particular, you need to use additional extensions that should be taken from the Inference Engine sample.

Please refer to this document with the details: https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer#extending-the-model-optimizer-with-new-primitives

In particular, try to use the following command (taken from https://software.intel.com/en-us/articles/OpenVINO-InferEngine#inpage-nav-8-4-2):

python3 ${MO_ROOT_PATH}/mo_caffe.py --input_model <path_to_model>/VGG16_faster_rcnn_final.caffemodel --input_proto <path_to_model>/deploy.prototxt --extensions <path_to_object_detection_sample>/fasterrcnn_extensions
 

 Please let me know if you still face the problem.

 

 

0 Kudos
Yogesh_P_Intel
Employee
659 Views

Hi Alexander, 

Thanks for the reply.

I tried to use model optimizer with additional extensions. The Process is getting killed after 1~3 minutes.

yment_tools/model_optimizer$ sudo python3 mo_caffe.py --input_model ../../../../../home/deeplearning/Downloads/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel --input_proto ../../../../../home/deeplearning/Downloads/test.prototxt --extensions ../../deployment_tools/inference_engine/samples/object_detection_sample/fasterrcnn_extensions/
[sudo] password for deeplearning: 
Model Optimizer arguments
	Batch: 	1
	Precision of IR: 	FP32
	Enable fusing: 	True
	Enable gfusing: 	True
	Names of input layers: 	inherited from the model
	Path to the Input Model: 	../../../../../home/deeplearning/Downloads/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel
	Input shapes: 	inherited from the model
	Log level: 	ERROR
	Mean values: 	()
	IR output name: 	inherited from the model
	Names of output layers: 	inherited from the model
	Path for generated IR: 	/opt/intel/computer_vision_sdk_2018.1.249/deployment_tools/model_optimizer
	Reverse input channels: 	False
	Scale factor: 	None
	Scale values: 	()
	Version: 	0.3.75.d6bae621
	Input proto file: 	../../../../../home/deeplearning/Downloads/test.prototxt
	Path to CustomLayersMapping.xml: 	extensions/front/caffe/CustomLayersMapping.xml
	Path to a mean file: 	
	Offsets for a mean file: 	None
Killed

Does model Optimizer requires some specific set of hardware? I am trying to run it inside a 4GB 4Core Ubuntu 16.04 Vm.

 

 

Regards 

 

0 Kudos
Alexander_D_Intel1
659 Views

Hi Yogesh,

 

Have you used these links for ZF Faster-RCNN?

Prototxt: https://raw.githubusercontent.com/rbgirshick/py-faster-rcnn/master/models/pascal_voc/ZF/faster_rcnn_end2end/test.prototxt

Caffemodel: https://dl.dropboxusercontent.com/s/o6ii098bu51d139/faster_rcnn_models.tgz?dl=0

If not, please double check with those links. Are you still facing same issues?

 

Model Optimizer is a light-weight tool and does not require any advanced hardware.

Are you running on Windows?

0 Kudos
Yogesh_P_Intel
Employee
659 Views

I am able to test using the below command from this link :-

 

python3 mo_caffe.py --input_model /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/mobilenet-ssd.caffemodel -o $SV/object-detection/mobilenet-ssd/FP32 --scale 256 --mean_values [127,127,127]
 
 
0 Kudos
Reply