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.
6554 Discussions

Help converting owned YOLOv4-tiny model to Openvino

Mars_Sun
Beginner
1,346 Views

Please help me solve the difficulty I am having while trying to convert YOLOv4-tiny model to openvino (I have converted my own trained yolov4 to tensorflow(yolov4_model.pb & yolov4_model_anchors.txt)).

I directly execute the following instructions:
python3 mo.py \
--saved_model_dir /home/shuttle/keras-YOLOv3-model-set/Mars_license_plate_detection/saved_model \
--input_shape [1,608,608,3] \
--model_name saved_model \
--output_dir /home/shuttle/keras-YOLOv3-model-set/Mars_license_plate_detection/openvino_saved_model

will produce an error:
[ FRAMEWORK ERROR ] Cannot load input model: SavedModel format load failure: SavedModel file does not exist at: /home/shuttle/keras-YOLOv3-model-set/Mars_license_plate_detection/saved_model/{saved_model.pbtxt|saved_model.pb}

So I changed yolov4_model.pb & yolov4_model_anchors.txt to saved_model.pb & saved_model.pbtxt, and executed the instructions again.

Still produces error:
[ FRAMEWORK ERROR ] Cannot load input model: SavedModel format load failure: Importing a SavedModel with tf.saved_model.load requires a 'tags=' argument if there is more than one MetaGraph. Got 'tags=None', but there are 0 MetaGraphs in the SavedModel with tag sets []. Pass a 'tags=' argument to load this SavedModel.

Can you tell me where the problem is?
Thank you in advanced and will be waiting for your reply,

0 Kudos
5 Replies
Peh_Intel
Moderator
1,310 Views

Hi Mars_Sun,

 

For your information, a model in the SavedModel format should consists of a directory with a saved_model.pb file and two subfolders: variables and assets.

 

Based on your description, you should convert the model with the inference graph in .pb format, with following command:

python3 mo.py \

--input_model /home/shuttle/keras-YOLOv3-model-set/Mars_license_plate_detection/saved_model/yolov4_model.pb \

--input_shape [1,608,608,3] \

--model_name saved_model \

--output_dir /home/shuttle/keras-YOLOv3-model-set/Mars_license_plate_detection/openvino_saved_model

 

 

Regards,

Peh

 

0 Kudos
Mars_Sun
Beginner
1,297 Views

Thanks, this method works for me.

After I re-executed the command, a new error occurred:
[ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.load.tf.loader.TFLoader'>): Graph contains 0 node after executing protobuf2nx. It may happen due to problems with loaded model. It considered as error because resulting IR will be empty which is not usual

I installed tensorflow 1.15.5 in Anaconda. Is it a version problem?

Best Regards,

0 Kudos
Peh_Intel
Moderator
1,280 Views

Hi Mars_Sun,

 

Regarding your new error, it seems like something wrong when freezing the model. Please ensure that you’re using the same TensorFlow version for the training and the freezing.



Regards,

Peh


0 Kudos
Mars_Sun
Beginner
1,254 Views

OK! Thanks for your help.

Best Regards,

0 Kudos
Peh_Intel
Moderator
1,188 Views

Hi Mars_Sun,


This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question. 



Regards,

Peh


0 Kudos
Reply