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

how quickly convert a model (*.py) to a graph and upload to NCS2

TNguy219
Beginner
945 Views

Hi

 

I have this model

http://www.chezmoi.dk/upload/YOLOV3-Tutorial-master.zip  (8MB)

 

https://i.imgur.com/ekvadYd.png

 

yolov3.weights, 248MB download from https://pjreddie.com/media/files/yolov3.weights

 

It ran successful on Google Colab. I want now implement this on my Windows10 with an "Intel NCS2"

 

How can i convert my trained model to a graph file on my windows 10 and upload to NCS2?

 

I this a quick/smart way to do it, is this possible? please help.

 

NB: I cant run on the model on my laptop due to an old nvidia card.

 

d:\_events\big data\object detection with tensorflow\YOLOV3-Tutorial-master>python tutorialDetect.py --images circus.jpg --det output

Loading network.....

Network successfully loaded

Traceback (most recent call last):

 File "tutorialDetect.py", line 97, in <module>

   model.cuda()

 File "D:\Program Files\Python37\lib\site-packages\torch\nn\modules\module.py", line 265, in cuda

   return self._apply(lambda t: t.cuda(device))

 File "D:\Program Files\Python37\lib\site-packages\torch\nn\modules\module.py", line 193, in _apply

   module._apply(fn)

 

 

0 Kudos
1 Solution
David_C_Intel
Employee
704 Views

Hi TNguy219,

 

Thanks for reaching out.

First you need to install the latest OpenVINO™ toolkit release (refer to this link for Windows* 10 installation). Then, use the model optimizer, you can check this Yolo* models guide for converting your YoloV3 model to IR format using this tool. After obtaining your IR files, you can run inference on the Intel® Neural Compute Stick 2.

You can use the Object Detection YOLO* V3 Python* Demo to test your model with the Intel® Nerual Compute Stick 2.

 

If you have more questions let us know.

 

Best regards,

 

David C.

Intel Customer Support Technician

A Contingent Worker at Intel

View solution in original post

0 Kudos
4 Replies
David_C_Intel
Employee
705 Views

Hi TNguy219,

 

Thanks for reaching out.

First you need to install the latest OpenVINO™ toolkit release (refer to this link for Windows* 10 installation). Then, use the model optimizer, you can check this Yolo* models guide for converting your YoloV3 model to IR format using this tool. After obtaining your IR files, you can run inference on the Intel® Neural Compute Stick 2.

You can use the Object Detection YOLO* V3 Python* Demo to test your model with the Intel® Nerual Compute Stick 2.

 

If you have more questions let us know.

 

Best regards,

 

David C.

Intel Customer Support Technician

A Contingent Worker at Intel

0 Kudos
TNguy219
Beginner
704 Views

Hello David C,

Thanks for the reply and the guide, i manage to make it. I wrote a guide on my language, which you can see here

https://drive.google.com/file/d/1pUsvsmX1-Y4dC0zfW6x59aHTqaf7kZ7F/view

look at page 30, the chapter "Covert và optimize pre-train model để load vào NCS2 Usb Stick"

 

You dont need to understand the language, look at the screendumps and the links.

I need to change 3 files before it works. Thanks to some posts i found from the Intel forum, all are list in the doc.

yolo_v3.json

d:\Program Files (x86) 2\IntelSWTools\openvino\deployment_tools\model_optimizer\mo\front\tf\extractor.py

d:\Program Files (x86) 2\IntelSWTools\openvino\deployment_tools\model_optimizer\mo\middle\passes\fusing\decomposition.py

 

Still too slow, I need to switch to yolov3-tiny, it is a lot better. But i think my old laptop need to decode the video stream so it takes extra time, better with a webcam, so no decode, only raw data from the cam.

 

Hoping this help for other who will try NCS2 in the future.

 

ps: if you plan to make a NCS3, please do it so it is backward compatible (openvino) and it will be great if it is a "single computer board", just like "Odroid XU4" (jetson nano).

THANKS

Tuan

0 Kudos
David_C_Intel
Employee
704 Views

Hello TNguy219,

Thank you for your reply.

Great job by doing that guide on your own! Now more people can read and understand more about how OpenVINO™ toolkit works.

The Object Detection YOLO* V3 Python* Demo you checked is able to detect objects on images as well. You also can modify the ".py" code for it to read a directory with images inside.

 

In case you have additional questions, be free to ask.

 

Best regards,

David C.

Intel Customer Support Technician

A Contingent Worker at Intel

0 Kudos
Reply