Yolov5: Using YOLOv5 with Neural Compute Stick2

Created on 29 Jul 2020  ·  15Comments  ·  Source: ultralytics/yolov5

❔Question

Hello, I have successfully converted the trained yolov5 model to Intermediate representation to use it with NCS2. However when I load the model to ncs2 it gives wrong results which are all negative values. Loading the same model on CPU runs without any problem and gives correct values. The question is can yolov5 be used in NCS2 and if yes what are the right steps to make it work correctly?
Thanks in advance

Additional context

Stale question

Most helpful comment

@hghari, very nice, @jimsu2012 and I did a similar conversion.

We just received the NCS in the mail today so will be trying to deploy in the next few days.

We will keep you posted of any success there!

All 15 comments

@hghari I'm not qualified to answer this as I have no experience with the cited hardware, but I'll leave this open for community support! Good luck.

@hghari I'm working on this direction as well - though I don't yet have a solution.

Let's stay in touch throughout the process :D

Did you start by converting ONXX to OpenVINO?

@glenn-jocher thanks
@Jacobsolawetz I would like to. thanks. Exactly I use export.py to convert the model to ONNX (with opset =10) and then use openvino to convert this model to IR (bin and xml).

@hghari, very nice, @jimsu2012 and I did a similar conversion.

We just received the NCS in the mail today so will be trying to deploy in the next few days.

We will keep you posted of any success there!

@Jacobsolawetz Looking forward to hear from you.

@Jacobsolawetz hi, I gave up using yolo v5 model because of inconsistencies between cpu and ncs2 results. Please inform me if you had any success. thanks

@hghari makes sense - none yet. Will post here if i find some success

I am working on this issue as well. There are two problems:

1) there's a bug in the code, the part on self.export and self.training somehow don't work as they should. When you put self.export = True it does not set the self.training value as False. Therefore you only get the bounding boxes, i.e. three outputs of size 1x3x80x80x9, 1x3x40x40x9 and 1x3x20x20x9 and I have checked and they match (with a good approximation) with the outputs of the PyTorch model.

2) If you resolve the part about self.export and self.training then you can convert the model successfully with opset =11 but the ONNX conversion fails with opset = 10.

@hghari hi, which model did you use to be able to convert into onnx and eventually into the IR of openvino? im using openvino 2020.1, pytorch 1.5 and seems like im stuck on converting the onnx model of yolov5s (which i edited the export script into opset 10) to openvino

I used the model provided on github

The same struggle here, please post any progress you might have!

The same struggle here, please post any progress you might have!

using the latest openvino, i managed to convert to IR, although weird behavior as mentioned in this response

I am working on this issue as well. There are two problems:

  1. there's a bug in the code, the part on self.export and self.training somehow don't work as they should. When you put self.export = True it does not set the self.training value as False. Therefore you only get the bounding boxes, i.e. three outputs of size 1x3x80x80x9, 1x3x40x40x9 and 1x3x20x20x9 and I have checked and they match (with a good approximation) with the outputs of the PyTorch model.
  2. If you resolve the part about self.export and self.training then you can convert the model successfully with opset =11 but the ONNX conversion fails with opset = 10.

i decided to not use yolov5 and went for v4 instead, but i think you will have to play with the export script to make it functional

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@hghari Hi, how to convert yolov5 to openVINO? Could you share the methods? Thanks.

Was this page helpful?
0 / 5 - 0 ratings