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.

[OpenVino] Error classification_sample.py

Kim_Hung__LE
Beginner
514 Views

Hello,

I'm actually following this tutorial to use a custom model trained by Tensorflow in OpenVino environnement with Intel Neural Compute Stick 2:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html

I'm using OpenVino 2019 R.2 with Tensorflow 1.13 on Linux Ubuntu 18.04. I succesfully converted the Tensorflow custom trained model to the IR model (.bin and . xml)

I tried to use Python script "classification_sample.py" in Inference Engine to deploy the converted model on an image. I use the following command:

python3 classification_sample.py -i /opt/sncf/NCS/2019_R2/openvino_2019.2.242/deployment_tools/model_optimizer/KHL_exemples/pathfinder.jpg -m /opt/sncf/NCS/2019_R2/openvino_2019.2.242/deployment_tools/model_optimizer/KHL_exemples/frozen_inference_graph_cartes_v2.xml --labels /opt/sncf/NCS/2019_R2/openvino_2019.2.242/deployment_tools/model_optimizer/KHL_exemples/frozen_inference_graph_cartes_v2.mapping -d MYRIAD

With "frozen_inference_graph_cartes_v2.xml" and "frozen_inference_graph_cartes_v2.mapping" are the converted models. I used MYRIAD because I use the Neural Compute Stick 2.

But I always get the following error message:

                                                        det_label = labels_map[id] if labels_map else "{}".format(id)

                                                  TypeError: only integer scalar arrays can be converted to a scalar index

I think there are problems with the mapping file, but I don't know how to solve the problem. Can you help me?

Thank you,

Kim Hung LE

0 Kudos
2 Replies
Kim_Hung__LE
Beginner
514 Views

For more details, when I converted the Tensorflow 1.13 custom trained model to IR model, I use the following command in Mode_Optimizer:

python3 mo_tf.py --input_model <inference_graph_dir>/frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/sncf/NCS/2019_R2/openvino_2019.2.242/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support_api_v1.13.json --tensorflow_object_detection_api_pipeline_config <inference_graph_dir>/pipeline.config --data_type FP16

 

0 Kudos
Shubha_R_Intel
Employee
514 Views

Dear Kim Hung LE

Thank you for using OpenVino 2019R2 . Your issue is that you cannot use "classification_sample.py" for a faster_rcnn (object detection) model. Instead try running this sample:

object_detection_demo_ssd_async.py

Also the C++ version:

object_detection_demo_ssd_async under demos and

object_detection_sample_ssd under samples

Hopefully this previous IDZ forum post should help you.

Thanks,

Shubha

0 Kudos
Reply