Community
cancel
Showing results for 
Search instead for 
Did you mean: 
342 Views

NCS2 Sample codes in Python (Yolo V3 with Custom Dataset)

Hi...

Can someone guide me how to use my model (Yolo V3, Object Detection) which i trained using custom dataset in Python for NCS2?

I successfully converted the model to IR (Keras -> ONNX -> IR -> .bin and .xml).

I already tried PINTO0309 and modified some codes but still no luck.

Any help would be appreciated....

0 Kudos
7 Replies
JesusE_Intel
Moderator
342 Views

Hi Jhon,

Have you tried using your model with our Object Detection YOLOv3 Demo? If not, could you try it and let me know the outcome.

Also, which OpenVINO version are you using and what command did you use with the model optimizer to convert to IR?

Regards,

Jesus

342 Views

Hi Jesus,

Thank you for your respond. I'm using openvino_2019.3.379. We (me and my team) developed a Yolo V3 model using Keras and produced an .h5 file. I tried to convert the .h5 file to IR using convertion script (Keras to TF and TF to IR) but always failed. Then i tried to convert .h5 file to ONNX and by using mo_onnx.py i finally succeeded converting ONNX file to IR.

Using sample codes from OpenVINO-YoloV3 i use .bin & .xml files but always failed. Latest error message is: 

height = math.exp(output_blob[box_index + 3 * side_square]) * anchors[anchor_offset + 2 * n + 1]
OverflowError: math range error

 It' will be fantastic if you can guide me from the beginning -> recommended script for training Yolo V3 using own dataset and sample python codes to infere and to test the model using NCS2.

To make more easier to us, i already refactored sample codes from OpenVINO-YoloV3 and top issues that i'm facing now are:

  • Model input shape (i have different height & weight, but will try to develop a new Yolo V3 model using input size = 416)
  • NHWC vs NCHW(currently i have an NHWC model)

Btw, the model that i want to convert to IR is already tested and run successfully using GPU.

Regards,

Jhon R Putra 

JesusE_Intel
Moderator
342 Views

Hi Jhon,

I've trained a tiny YOLOv3 custom object detection using Darknet and deployed on the Intel NCS 2. I converted from Darknet to Tensorflow using the steps mentioned here: https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html

Note: The model was converted in NHWC format.

If I recall correctly, the error you are getting is due to the boundary boxes being drawn outside the image frame with OpenCV. Try calculating the location of the boundary box within range.

Regards,

Jesus

 

342 Views

Dear Jesus,

I've trained another tiny YOLOv3, converted to IR, deployed to NCS 2 and by using PINTO0309 i tested the model and finally the model detected some objects. But i found that the boundaries were not too precise and i also got some errors (index out of range) at line:

scale = output_blob[obj_index]

 Then i trained another tiny YOLOv3 and converted to IR using mo.py and the model was totally failed to run. The errors were still the same: index out of range.

I understand that anchors, num and coords are important variables. But unfortunately, even i generate the anchors using Darknet (AlexeyAB) and convert the model using mo.py and  yolo_v3_tiny.json (Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\extensions\front\tf), the result is still not as expected.

Until now i still can't find any articles/ papers that show complete and adequate steps that CUSTOM Yolo V3 is successfully deployed and tested using NCS 2.

 

Regards,

Jhon Ramawi Putra

 

 

JesusE_Intel
Moderator
342 Views

Hi Jhon,

Could you share your tiny YOLOv3 model from Darknet for me to try? I will send you a private message so you can share them.

Regards,

Jesus

342 Views

Hi Jesus,

Sure i will send you my model, few test images and results that were detected using GPU as comparison.

Regards,

Jhon R Putra

JesusE_Intel
Moderator
342 Views

Hi Jhon,

Thanks for sending over the files, I made some changes to your json file to match your Darknet configuration file and got better results. I sent the information over in a private message. Please let me know if that works for you.

Regards,

Jesus

Reply