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.

Model Optimizer VGG19 error

Truong__Dien_Hoa
New Contributor II
360 Views

I'm trying to convert the vgg_19 tensorflow slim model that I downloaded from here: https://github.com/tensorflow/models/tree/master/research/slim

Then I export the inference graph by running:

python3 models/research/slim/export_inference_graph.py --model_name vgg_19 --output_file ~/vgg_19.pb

However when I optimize it with openvino, the error below appears:

python3 /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo_tf.py --input_model ~/VGG19/vgg_19.pb --input_checkpoint ~/VGG19/vgg_19.ckpt -b 1 --mean_value [103.94,116.78,123.68] --scale 1

[ FRAMEWORK ERROR ]  Cannot load input model: Assign requires shapes of both tensors to match. lhs shape= [1,1,4096,1001] rhs shape= [1,1,4096,1000]

 

I think the problem come from the checkpoint file and the exported file doesn't have the same outputs shape, 1000 and 1001. I searched and found that this might be VGG Imagenet have a background class added to 1000 classes.

Can someone help me to fix this problem ?

Thank you

 

0 Kudos
1 Reply
Truong__Dien_Hoa
New Contributor II
360 Views

It seems like I can solve the problem when adding --labels_offset 1 in export_inference_graph.py

python3 models/research/slim/export_inference_graph.py --model_name vgg_19 --output_file ~/VGG19/vgg_19.pb --labels_offset 1

With that I can sucessfully create IR model

Haven't tested if the inference is ok.

 

0 Kudos
Reply