I follow Intel tutorial(https://software.intel.com/en-us/articles/OpenVINO-Using-TensorFlow) to convert inception_v3 model to .xml & .bin,
but top_1~top_5 scores with OpenVINO are different to scores with tensorflow
(reference: "classify_openvino_imagenet_r3.csv", "classify_tf_imagenet.csv" and test images are in openvino_issue.zip)
The classification by inception_v3 on tensorflow I refer as following:
And inference code you can refer the annex : classify_tf_imagenet.py (in openvino_issue.zip )
command: $ python3 classify_tf_imagenet.py
OpenVINO R3 step:
1. I use export_inference_graph.py (https://github.com/tensorflow/models/tree/master/research/slim#exporting-the-inference-graph)
to generate pb file.
2. freeze model
$ python3 /usr/local/lib/python3.5/dist-packages/tensorflow/python/tools/freeze_graph.py \
--input_graph inception_v3_inf_graph.pb \
--input_checkpoint inception_v3.ckpt \
--output_node_names InceptionV3/Predictions/Reshape_1 \
3. convert .xml & .bin
$ cd <INSTALL_DIR>/deployment_tools/model_optimizer
$ python3 mo_tf.py \
--input_model /home/admin/frozen_inception_v3.pb \
--input_shape [1,299,299,3] \
--input input \
--model_name imagenet_classify_r3 \
The classification of openvino code : classify_openvino_imagenet_r3.py
command: $ python3 classify_openvino_imagenet_r3.py (in openvino_issue.zip)
The results are not the same, do you have any idea?
Thanks for your help.
I've checked/tested your code, I found 1 problem. Within your classify_tf_imagenet.py you use the tf model called "object_graph.pb" the topology is different from inception V3, so the different result should be expected. Could you try to use the same model for testing? Also for R4, the classification model in Slim has better way to convert and inject the mean/scale values, so you don't need to do the multiply and subtraction within the python code. Please refer to document in R4 called "Converting Tensorflow-Slim Image Classification Model Library Models"