Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Yogesh_P_Intel
Employee
171 Views

How to register custom layer for the Model Optimizer for a non super user.

Hi,

I am following this [https://github.com/intel-iot-devkit/smart-video-workshop/blob/master/custom-layer/README.md] exercise from non-root user who does not have access to edit /opt/intel folder in the step "Register custom layer for the Model Optimizer". I am not able to register the layer as it is not supported from user's permission. Is there a way to register a custom layer from a non-root user?

I tried couple of flags from mo_tf.py script inorder to register the Layer. But I got error while trying those steps. Follwing are the error Scenarios :- 

Script parameter : tensorflow_custom_layer_libraries 


Argument: 
/opt/intel/openvino/deployment_tools/model_optimizer/mo_tf.py --input_meta_graph model.ckpt.meta --batch 1 --output "ModCosh/Activation_8/softmax_output" --extensions $SV/custom-layer/extgen_output/user_mo_extensions --output_dir $SV/custom-layer/create_tf_model/tf_model --tensorflow_custom_layer_libraries $SV/custom-layer/extgen_output/user_mo_extensions/ops/cosh.py

Error :

[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  /home/u26212/custom/smart-video-workshop/custom-layer/extgen_output/user_mo_extensions/ops/cosh.py: invalid ELFheader
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2019.1.094/deployment_tools/model_optimizer/mo/main.py", line 312, in main
    return driver(argv)
  File "/opt/intel/openvino_2019.1.094/deployment_tools/model_optimizer/mo/main.py", line 263, in driver
    is_binary=not argv.input_model_is_text)
  File "/opt/intel/openvino_2019.1.094/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 74, in tf2nx
    tf.load_op_library(library)
  File "/home/u26212/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 60, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/u26212/custom/smart-video-workshop/custom-layer/extgen_output/user_mo_extensions/ops/cosh.py: invalid ELF header

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------


Script parameter : --tensorflow_use_custom_operations_config


Argument: 

/opt/intel/openvino/deployment_tools/model_optimizer/mo_tf.py --input_meta_graph model.ckpt.meta --batch 1 --output "ModCosh/Activation_8/softmax_output" --extensions $SV/custom-layer/extgen_output/user_mo_extensions --output_dir $SV/custom-layer/create_tf_model/tf_model --tensorflow_use_custom_operations_config $SV/custom-layer/extgen_output/user_mo_extensions/ops/cosh.py


Error :

[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.front.tf.tensorflow_use_custom_operations_config.TensorflowUseCustomOperationsConfig'>): Failed to parse custom replacements configuration file '/home/u26212/custom/smart-video-workshop/custom-layer/extgen_output/user_mo_extensions/ops/cosh.py': Expecting value: line 1 column 1 (char 0).
 For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html),question #70.
 

 

Kindly help is there is some way to do this 

0 Kudos
1 Reply
Shubha_R_Intel
Employee
171 Views

Dear Pandey, Yogesh,

I just answered the same question in the below IDZ post:

https://software.intel.com/en-us/forums/computer-vision/topic/829353

Also you can find an R3 compliant tutorial here:

https://github.com/intel-iot-devkit/smart-video-workshop

As for this issue:

 I am not able to register the layer as it is not supported from user's permission. Is there a way to register a custom layer from a non-root user?

Building a custom-layer does not require root privileges. However, you may be trying to install or write extension files into the OpenVino (Model Optimizer) installation directory which definitely would require Admin or Super User rights. 

Thanks,

Shubha

 

Reply