Community
cancel
Showing results for 
Search instead for 
Did you mean: 
OMari4
Beginner
609 Views

Converting model from tf to .xml and .bin results in Illegal instruction (core dumped)

Jump to solution

I am trying to convert a tensorflow model using mo_tf.py with the following command.

python3 mo_tf.py --input_model ~/Downloads/frozen_model .pb --output_dir ~/Downloads/ --input_shape [1,3,416,416] --data_type FP16

I'm using ubuntu 16.04 on the Intel Up Squared 2 and it comes with preinstalled openvino r2019 2 and tensorflow==1.9.0.

 

The problem is that after I run this command, I get this output:

Common parameters:

   - Path to the Input Model:   /home/upsquared/Downloads/frozen_model.pb

   - Path for generated IR:   /home/upsquared/Downloads/

   - IR output name:   frozen_model

   - Log level:   ERROR

   - Batch:   Not specified, inherited from the model

   - Input layers:   Not specified, inherited from the model

   - Output layers:   Not specified, inherited from the model

   - Input shapes:   [1,3,416,416]

   - Mean values:   Not specified

   - Scale values:   Not specified

   - Scale factor:   Not specified

   - Precision of IR:   FP16

   - Enable fusing:   True

   - Enable grouped convolutions fusing:   True

   - Move mean values to preprocess section:   False

   - Reverse input channels:   False

TensorFlow specific parameters:

   - Input model in text protobuf format:   False

   - Offload unsupported operations:   False

   - Path to model dump for TensorBoard:   None

   - List of shared libraries with TensorFlow custom layers implementation:   None

   - Update the configuration file with input/output node names:   None

   - Use configuration file used to generate the model with Object Detection API:   None

   - Operations to offload:   None

   - Patterns to offload:   None

   - Use the config file:   None

Model Optimizer version:   1.5.12.49d067a0

Illegal instruction (core dumped)

 

 

0 Kudos
1 Solution
Luis_at_Intel
Moderator
300 Views

Issue Statement: trying to train a model (fine-tune) for license plate detection using Keras; train model on Mac, or Ubuntu or another computer as training takes time; then convert Keras -> TensorFlow -> IR; use converted model in UpSquared.

 

General Questions:

  • Is this a custom trained model?
    • It is custom trained to recognize license plates, using yolo3
  • How many classes does your model have?
    • It only has 1 class (License plate)
  • How are you converting from Keras to TensorFlow and freezing the model?
    • 'convert_to_tf.py' is the script that I used for converting from Keras to TF
  • Do you have the .weights file and the .names file?
    • I do not have the .weights and .names. There is a pre-trained model as backend, which is also in Keras and I am using that model to finetune just for my single class. In the 'Archive' you have the backend.h5, which is the base yolo3 pre-trained model and 'LP.h5' which is the fine tuned model, based on backend.h5, for just one class detection.

 

Solution found by @OMari4​ 

  • Used Google Colab with Ubuntu 16.04, Python 3.6 and TensorFlow 1.12.0.
  • Installed OpenVINO toolkit in opencolab
  • Installed TensorFlow 1.12.0
  • Use 'keras_to_tf.py' script to convert model to .pb format (attached to this post)
  • Convert .pb to IR format with the following command:
source /opt/intel/openvino/bin/setupvars.sh && \ python /opt/intel/openvino_2019.1.094/deployment_tools/model_optimizer/mo_tf.py \ --input_model /content/model/tf_model.pb --input_shape [1,416,416,3] \ --output_dir ir
  • The UpSquared system has Python 3.5 and TensorFlow 1.9, the converted IR model runs fine in this system.

 

View solution in original post

4 Replies
Luis_at_Intel
Moderator
300 Views

Hi @OMari4,

 

Thanks for contacting us. Would it be possible to share more details about your model? For example which network is it based on, are you using any custom layers, etc.. Also if possible please share your model so I can try and test to see if I get the same issue and can find a fix. You can share the model via Private Message in case you don't want to share it publicly.

 

 

Regards,

@Luis_at_Intel​ 

 

OMari4
Beginner
300 Views

Hi @Luis_at_Intel​ 

 

The network is based on yolo v3 model. It was first converted from keras to tensorflow, and now I'm trying to convert it from tensorflow to .xml and .bin so I can use it with openvino toolkit. It does not have any custom layers or any other custom operations. I can also share the model with you, so you can test the conversion.

 

Best,

OMari14

Luis_at_Intel
Moderator
300 Views

Hi @OMari4​ ,

 

I am having trouble with your frozen model, I cannot convert it to IR format. If you can please help me answer all the following questions:

  • Is this a custom trained model?
  • How many classes does your model have?
  • How are you converting from Keras to TensorFlow and freeezing the model?
  • Do you have the .weights file and the .names file?
  • You can send me these via Private Message if you prefer.

 

I will be waiting for your response.

 

 

Regards,

@Luis_at_Intel​ 

Luis_at_Intel
Moderator
301 Views

Issue Statement: trying to train a model (fine-tune) for license plate detection using Keras; train model on Mac, or Ubuntu or another computer as training takes time; then convert Keras -> TensorFlow -> IR; use converted model in UpSquared.

 

General Questions:

  • Is this a custom trained model?
    • It is custom trained to recognize license plates, using yolo3
  • How many classes does your model have?
    • It only has 1 class (License plate)
  • How are you converting from Keras to TensorFlow and freezing the model?
    • 'convert_to_tf.py' is the script that I used for converting from Keras to TF
  • Do you have the .weights file and the .names file?
    • I do not have the .weights and .names. There is a pre-trained model as backend, which is also in Keras and I am using that model to finetune just for my single class. In the 'Archive' you have the backend.h5, which is the base yolo3 pre-trained model and 'LP.h5' which is the fine tuned model, based on backend.h5, for just one class detection.

 

Solution found by @OMari4​ 

  • Used Google Colab with Ubuntu 16.04, Python 3.6 and TensorFlow 1.12.0.
  • Installed OpenVINO toolkit in opencolab
  • Installed TensorFlow 1.12.0
  • Use 'keras_to_tf.py' script to convert model to .pb format (attached to this post)
  • Convert .pb to IR format with the following command:
source /opt/intel/openvino/bin/setupvars.sh && \ python /opt/intel/openvino_2019.1.094/deployment_tools/model_optimizer/mo_tf.py \ --input_model /content/model/tf_model.pb --input_shape [1,416,416,3] \ --output_dir ir
  • The UpSquared system has Python 3.5 and TensorFlow 1.9, the converted IR model runs fine in this system.

 

View solution in original post

Reply