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

Regarding Tensor flow Object Detection Model

zian123
Novice
1,098 Views

Hi, 

I am very new to this field, but I want to run a Tensorflow object detection model in Intel OpenVino. I am referring to a YouTube video for this one, but it is giving me an error. 

As I need to run the .pb file with the mo_tf.py , so I have given this command to my windows command line.

python mo_tf.py --input_model C:\Users\Md. Afique Amin Zian\Desktop\faster_rcnn_resnet101_coco_2018_01_28\frozen_inference_graph.pb --tensorflow_use_custom_operations_config C:\Program Files (x86)\IntelSWTools\openvino_2021.4.582\deployment_tools\model_optimizer\extensions\front\tf\faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config C:\Users\Md. Afique Amin Zian\Desktop\faster_rcnn_resnet101_coco_2018_01_28\pipeline.config

 

But this giving me this error:

[ ERROR ] The value for command line parameter "tensorflow_use_custom_operations_config" must be existing file/directory, but "C:\Program" does not exist.

The error looks like it cannot find the folder, but it is there in my local machine.

I don't know how to solve this. Again, I am using  The Latest Version of OpenVino.

Here is the video I am referring: https://www.youtube.com/watch?v=rUwayTZKnmA&list=WL&index=65&t=21s&ab_channel=AlSangam

Please Help me.

0 Kudos
4 Replies
Vladimir_Dudnik
Employee
1,084 Views

@zian123 video you are referring to is quite old, it refers to Intel Computer Vision SDK 2018 R5 release, the product was renamed to Intel OpenVINO some time ago, and the latest release is 2021.4.

The Tensorflow model faster_rcnn_resnet101_coco is included into OpenVINO Open Model Zoo, which is collection of Intel and Public pre-trained models validated to work with OpenVINO, set of scripts, which simplify downloading model and converting it to OpenVINO Intermediate Representation format (and even quantization to INT8 precision through OpenVINO Post Optimization Toolkit) and set of demo application to show how model perform.

 

To convert this model to IR you can run Model Optimizer directly, in this case you will need to know what command line parameter need to be specified for proper model conversion or alternatively, you may use Open Model Zoo model converter.py script, which will call Model Optimizer with specific parameters, they are kept in model.yml file for each model in Open Model Zoo (<openvino_install_dir>/deployment_tools/open_model_zoo/models/public/faster_rcnn_resnet101_coco/model.yml for this model)

 

Basically, for OpenVINO 2021.4, you will need to set up proper python environment, and from this environment you may just run

 

omz_downloader --name faster_rcnn_resnet101_coco

following by

omz_converter --name faster_rcnn_resnet101_coco

 

run command about with adding option --dry_run will simple print actual Model Optimizer command line, required to convert this model, see example below

Conversion command: c:\miniconda3\envs\py3.7-openvino-dev-2021.4\python.exe -m mo --framework=tf --data_type=FP32 --output_dir=c:\Temp\public\faster_rcnn_resnet101_coco\FP32 --model_name=faster_rcnn_resnet101_coco --reverse_input_channels --input_shape=[1,600,1024,3] --input=image_tensor --output=detection_scores,detection_boxes,num_detections --transformations_config=c:\miniconda3\envs\py3.7-openvino-dev-2021.4\lib\site-packages\mo/extensions/front/tf/faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config=c:\Temp\public\faster_rcnn_resnet101_coco/faster_rcnn_resnet101_coco_2018_01_28/pipeline.config --input_model=c:\Temp\public\faster_rcnn_resnet101_coco/faster_rcnn_resnet101_coco_2018_01_28/frozen_inference_graph.pb

 

Open Model Zoo provides C++ and Python object_detection_demo, which you may use to see how model work. For example, command below

python object_detection_demo.py -d CPU -i dog.jpg -m <path_to_mode>\faster_rcnn_resnet101_coco.xml -at ssd -t 0.8 --labels <omz_dir>\data\dataset_classes\coco_91cl_bkgr.txt --loop

 

will run demo and output window should look like screenshot below

object_detection_demo_dog.jpg

Regards,
  Vladimir

0 Kudos
zian123
Novice
1,063 Views

Hi Vladimir, 

Thanks for your reply. I really appreciate your answer, but a few things I didn't understand actually like omz_downloader. What is it? and how can I find it? 

I think I am making you confused, but let me clarify what I intended to do with Intel OpenVino. I want to use openVino for one of my personal project. 

My plan is to create a Custom Object Detection Model, for example I will train 10 types of fruits and then My model will scan and give me the detection result. So after my research I came to know that, first I have to train a model with Computer Vision frameworks and convert the model saved file to IR representaion(.XML and .bin file).  So, I have trained a model with Yolov3 and saved a .weight file. But when I tried to convert the saved file to IR to generate .xml and .bin file by seeing the OpenVino Documentation, it didnt work. 

In the documentation, I have found I have to run this code demo.py from https://github.com/mystic123/tensorflow-yolo-v3

then I found this error,

>python3 convert_weights_pb.py --class_names voc.names --data_format NHWC --weights_file latest.weights
Traceback (most recent call last):
  File "convert_weights_pb.py", line 5, in <module>
    import yolo_v3
  File "/deeplearning/tensorflow-yolo-v3/yolo_v3.py", line 6, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

 

After searching for the solution, I came to know that, This problem is occurring because of Tensorflow version, as Now My local machine has tensorflow 2 but it needs tensorflow 1 to run that code, but  I couldn't able to install tensorflow 1 because tensorflow 1 does not support the latest python version(3.9), so I have to downgrade my python version too. I tried to do it but got some other errors. So I quit Yolo.

Now I am looking for any pretrained model from any framework and then I am trying to convert it to IR representation. That's why I move to Tensrorflow(faster_rcnn_resnet101_coco) but this is also giving me error. Now I totally don't know what to do. 

I hope I make you understand about my intention and problem, can you please suggest me any model and how can I convert that  model to IR to create the .xml or .bin file. Any YouTube video, any link?? So that I can refer. If I manage to create the .xml and .bin file then I will do the custom training using that framework and the steps to generate IR files for my project. 

Please help me to solve this problem, its kind of urgent for me. I just need to know which pretrained model I can use? From where I can download it and then how can I convert it to IR Representation?

Thanks 

Zian

 

 

0 Kudos
Vladimir_Dudnik
Employee
1,033 Views

@zian123 Open Model Zoo is one of the OpenVINO product components and is available in your OpenVINO installation. By itself, Open Model Zoo is a collection of pre-trained models, both developed at Intel and some publicly available third-party models. It also contains set of demo applications and tools to download models. Open Model Zoo is intended to demonstrate what frameworks and CNN topologies are supported by OpenVINO, so regarding your case, if you find that faster_rcnn_resnet101_coco topology can fit your goal, you may re-train it on your specific case in original Tensorflow framework (you probably already noticed, OpenVINO is inference only product, at least for now). And then you may convert final model to OpenVINO IR, looking at either Model Optimizer documentation or Open Model Zoo as an collection of examples for similar models.

 

It would be worth to notice, that there is also OpenVINO Training Extensions, which is not part of OpenVINO install package, but it is available through github. It contains training pipelines for several computer vision tasks, which you may use as a base and train model on your own specific data.

 

Have you found answer in previous reply for question: I hope I make you understand about my intention and problem, can you please suggest me any model and how can I convert that  model to IR to create the .xml or .bin file. Any YouTube video, any link?? 

 

I hope this was provided in the line below:

Conversion command: c:\miniconda3\envs\py3.7-openvino-dev-2021.4\python.exe -m mo --framework=tf --data_type=FP32 --output_dir=c:\Temp\public\faster_rcnn_resnet101_coco\FP32 --model_name=faster_rcnn_resnet101_coco --reverse_input_channels --input_shape=[1,600,1024,3] --input=image_tensor --output=detection_scores,detection_boxes,num_detections --transformations_config=c:\miniconda3\envs\py3.7-openvino-dev-2021.4\lib\site-packages\mo/extensions/front/tf/faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config=c:\Temp\public\faster_rcnn_resnet101_coco/faster_rcnn_resnet101_coco_2018_01_28/pipeline.config --input_model=c:\Temp\public\faster_rcnn_resnet101_coco/faster_rcnn_resnet101_coco_2018_01_28/frozen_inference_graph.pb

 

0 Kudos
Wan_Intel
Moderator
989 Views

Hi Zian123,


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,

Wan


0 Kudos
Reply