-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YOLOv7/v8 performance drop with new OpenVINO version #43
Comments
Thanks for reporting that @maxsitt , we can certainly investigate this further. When using blobconverter for YoloV7 conversion, did you use the correct model optimizer parameters? Regarding performance change - there are several reasons that could cause that. Certain operations in 22.1 release were updated to Opset8 (for example, OV defines Softmax for Opset1 and Opset8, and it's similar for a variety of other operations, such as ReduceMax, MaxPool, ...). Opset is related to the implementation of this operation in the underlying MX plugin, and when executing the model on the device it tells it which implementation to use. It could certainly happen that some operations in the new Opset are slightly slower. Unfortunately, we don't have much control over that, so if performance drop is of an issue, I'd suggest to rely on 2021.4.2 or use YoloV6n. We could in theory enable OV version selection in the tools itself. I have two follow up questions: We'll do some investigation on our end as well, but preparing a MRE (code, blobs) would help us if our findings don't match yours. |
3/ Are you using the same DepthAI version and which one when benchmarking? |
Thanks for your quick reply @tersekmatija! For YOLOv7 conversion with the BlobConverter website I used the following model optimizer parameters:
I also tried adding It is not clear to me why the outputs are named this way. I thought it would be the same as for the other YOLO versions. Looking at the Regarding your questions: 2/ I attached the YOLOv7-tiny .blobs and measuring script together with the simplified ONNX model. Both converted with Luxonis tools before and after implementing OpenVINO 2022.1.0 as default version. 3/ I'm using depthai version 2.20.2.0 on Raspberry Pi Zero 2 W, connected via SSH. This is also the reason why I'm printing fps to console for measuring, as showing the frames via X11 forwarding caps the inference speed at ~10 fps. Regarding YOLOv8n: I measured fps again with the different models and now the speed seems to be the same for both OpenVINO versions. I don't know why it was different before, even when testing multiple times. Maybe the way I'm measuring fps is not precise enough, it would be great if you could propose a more accurate way by comparing the raw latency! |
Hey, yes, this could indeed affect the performance. So the output names should be named Do you mind exporting the model with |
Ok sorry, now I can see the actual output. With this the conversion works properly with the BlobConverter. The speed difference between the converted YOLOv7-tiny models is the same for both OpenVINO versions: 2021.4.2 = 38 fps; 2022.1.0 = 33 fps. |
Ok, so to confirm - there is no more error |
Yes, only for YOLOv7-tiny. |
Ok, thanks. We will investigate V7. CC @HonzaCuhel |
Not sure what's going on, but now the YOLOv8n models differ in speed again (2021.4.2 = 34 fps; 2022.1.0 = 32 fps). I attached MRE + models just to be sure, maybe you could also take a look at this. |
Hi @maxsitt, first of all, let me apologize for delayed reply and thank you for reporting! We have investigated this issue thoroughly and you are right, there is a performance drop with new OpenVINO version for not only YoloV7 and V8, but also for V6 R3. We have found out that there are differences in the ops used by these two version of OpenVINO, we have created an GitHub issue in the OpenVINO repo (link) to clarify the problem. But for now, we have been able to solve the issue for YoloV6 R3 & V8 by using the Best |
Just deployed the newer version of tools. |
Hi Jan, thanks a lot for looking into this! To be able to select using the Legacy Front-End flag is a great fix. I'm very interested in the possible explanations for this performance drop, let's see what the OpenVINO developers will respond. |
After the migration to OpenVINO 2022.1.0, I can find performance drops (reduced inference speed) for YOLOv7-tiny and YOLOv8n models:
All models were converted with the same .pt weights and use 4 shaves. The only differences in output I can find are different OpenVINO .xml size and structure and for YOLOv7-tiny slightly different size of the .blob file.
I tried using the Blobconverter with the simplified .onnx model (from Luxonis tools output) and same settings, which leads to the same performance drop for YOLOv8n. YOLOv7-tiny was not properly converted by the Blobconverter (throws
[error] Mask is not defined for output layer with width '6'.
).For YOLOv5n and YOLOv6n model performace is exactly the same with both OpenVINO versions.
I've read the OpenVINO API 2.0 Transition Guide but can't find any hints what could be the cause for the reduced inference speed.
I can only assume that it has something to do with the YOLOv7 (YOLOv8) specific model structure and different behaviour of the OpenVINO 2022.1.0 version during conversion.
The text was updated successfully, but these errors were encountered: