Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
100 Views

How to convert .pb or savedmodel to bin and xml?

hi,

i have been referring to the steps in the openvino on how to convert .pb and savedmodel using model optimizer but always encounter error. i trained simple model (for eg cars and jets) at this website: https://teachablemachine.withgoogle.com/train/image

then i converted the keras .h5 model from the website to .pb and savedmodel.

method 1 conversion using .pb

python mo_tf.py --input_model frozen_model.pb –-input_shape [1,224,224,3] –-tensorflow_subgraph_patterns “sequential_1_1/model1/bn_Conv1/.*”

method 2 conversion using savedmodel

python mo_tf.py --saved_model_dir model.savedmodel –-input_shape [1,224,224,3] –-tensorflow_subgraph_patterns “sequential_1_1/model1/bn_Conv1/.*”

note: i just installed latest 2020 OpenVINO

Pls advise. Been trying this for few days. 

0 Kudos
6 Replies
Highlighted
100 Views

Hi Liong,

It seems that there is an issue while saving the output file to the directory that you are working on.

There are two possible solutions for this issue.

  1. You can open the command prompt as Administrator and the re-run the command.
  2. You can also use -o parameter to save the output file in the specified output directory which does not require root access

Regards,

Ram prasad

0 Kudos
Highlighted
100 Views

hi Ram,

thanks for your advice, you are spot on! it successfully generated converted the .pb to xml and bin for method 1. however on the method 2 which is the saved file it is still giving error as attached. not sure how to interpret the error.

thanks
cltee

0 Kudos
Highlighted
100 Views

From the error log, the model optimizer requires --input parameter to be passed as command line argument.

Please add --input input_1 parameter along with the command used to convert the saved_model to IR files.

Regards,

Ram prasad

0 Kudos
Highlighted
100 Views

hi Ram,

it works! it manage to generate 3 files saved_model.bin, mapping, xml. However, when i ran Inference it produced other error. attached are the files that were used. 
appreciate your advice again. 

thanks
cltee

0 Kudos
Highlighted
100 Views

Can you confirm that you are using same models. If yes, is there any particular reason to use the saved model?

Also, Have you tried to inferencing of model using the 1st method?

Regards,

Ram prasad

0 Kudos
Highlighted
100 Views

yes same models, trained from the same dataset. it's just for learning purpose trying out different format .pb and savedmodel. 

yes i had tried inferencing using the 1st method. it works. but i notice the accuracy isn't high. anyway will experiment more. 

thanks
cltee

 

0 Kudos