I converted the tensorflow pretrained model(frozen pb file) for MobilenetV1 downloaded from below link.
The command I use to convert is as follows:
python mo_tf.py --input_model C:\OpenVINO\TF_Models\mobilenet_v1_1.0_224_quant\mobilenet_v1_1.0_224_quant_frozen.pb -b 1 --output_dir C:\OpenVINO\TF_Models\mobilenet_v1_1.0_224_quant --reverse_input_channels --log_level=DEBUG
After that, I use classification_sample_async to run the inference Engine using below command.
classification_sample_async.exe -i C:\Users\user1\Downloads\Banana.bmp -m C:\OpenVINO\TF_Models\mobilenet_v1_1.0_224_quant\mobilenet_v1_1.0_224_quant_frozen.xml
Though the commands are executed successfully without any errors, I results are poor(not even close to correct classes).
I want to know whether I am missing some thing?
Dear Hareesh Gowtham, Please review the Model Optimizer Tensorflow Doc .
In particular note the columns --MEAN_VALUES and --SCALE for Mobilenet V1 models. You need to pass those into the mo_tf.py command. These are pre-processing which the images went through prior to training. Unless you tell Model Optimizer about such pre-processing, there is no way it can ever know about it.
Hope it helps,
Thank you for your answer.
I checked the document you mentioned.
The MEAN_VALUES and SCALE are for unfrozen model, But I am using Frozen Quantized model for mobilenetV1.
When I provide MEAN VALUES and SCALE which is in float [127.5,127.5,127.5] and 127.5 respectively to the model, it gives below error
ValueError: invalid literal for int() with base10: 'input'
Does quantized frozen model also require MEAN_VALUES and SCALE?
Dear Gowtham, Hareesh
OK. This is a Tensorflow-Lite model, right (since you say "quantized") ? Or did you pick your Mobilenet V1 from one of the Tensorflow Model Optimizer Supported and Validated List ?
Actually no, --mean_values and --scale are fed along with --input_model (as a frozen pb) to mo_tf.py. Doing a --h on mo_tf.py in 2019R3 gets this:
--mean_values MEAN_VALUES, -ms MEAN_VALUES
Mean values to be used for the input image per
channel. Values to be provided in the (R,G,B) or
[R,G,B] format. Can be defined for desired input of
the model, for example: "--mean_values
data[255,255,255],info[255,255,255]". The exact
meaning and order of channels depend on how the
original model was trained.
--scale SCALE, -s SCALE
All input values coming from original network inputs
will be divided by this value. When a list of inputs
is overridden by the --input parameter, this scale is
not applied for any input that does not match with the
original input of the model.
Did you input the values correctly ? Kindly give me your full model optimizer command after adding --mean_values and --scale.
Thank you for the information.
Yes I am using tensorflow lite quantized frozen model from Supported Frozen Quantized Topologies
I was using the below command:
python mo_tf.py --input_model C:\OpenVINO\TF_Models\mobilenet_v1_1.0_224_quant\mobilenet_v1_1.0_224_quant_frozen.pb -b 1 --output_dir C:\OpenVINO\TF_Models\mobilenet_v1_1.0_224_quant --reverse_input_channels --log_level=DEBUG --mean_values data(127.5,127.5,127.5) --scale 127.5
I figured out problem with --mean_values data(127.5,127.5,127.5) parameter.
I changed the layer name to input i.e. --mean_values input(127.5,127.5,127.5) and both model conversion and execution of sample works fine.
Again, thank you very much for the support.