VeriSilicon/tflite-vx-delegate

vx-delegate and Yolov5 models

Opened this issue · 8 comments

Sorry if this is a duplicate. I had asked on the tim-vx github a few days ago.

We've been trying to get Yolov5 models working with the NXP imx8mp with the NPU. The models we have tested all work just fine with the CPU, and the same tflite models compiled for the Google TPU also work just fine.

The models are object detection. First started with our model exported per the NXP docs. When that didn't work we got the NXP Yolov5 demo model and script from NXP support. But that also fails in the same way.

Finally another NXP user who says he has it working with the same NXP BSP and TFlite versions provided his model. But that model also fails in the same way for us.

Using the recommended .71 NXP BSP and TFlite 2.9.1. With the NPU the models give all zeros for bounding box output, and I suspect the confidence score may be bogus as well.

Has anyone else seen this type of issue when processing Yolov5 models using the NPU? And if so how did you resolve it?

I see a custom op for yolo4 lite, but don't see the build configuration setting up to include that processing. Since that custom op appears to deal with yolo4 post processing I'm wondering if that might also apply for yolo5 models. Is there some Yocto build option that needs to be set to properly process yolov5 models with the vx-delegate and NPU?

Thanks,

@burtbick ,

I can forward your problem to NXP team. Would you mind share your model?

Thanks

Hi @burtbick ,
I am sorry NXP support does not provided an acceptable solution for you.

Can you please share the NXP community link in order match these issues and provide the help?

Best Regards
Robert

Just reporting back that the patch I received from NXP appears to have resolved the problem we were having.
This was a patch to the vx-delegate op_map.cc source file and was a fairly significant patch. Not sure why they didn't have that already included in their Yocto build or notes, but at least it is fixed now.

Great! Can you share the patch? We are running into a similar issue. Thanks!

Here's a link to the patch file. The file as received is diff.patch and needs to be applied to the op_map.cc vx-delegate file.

Of course be sure to verify that the patch applies properly, and this is for TFLIte version 2.9.1 which is what we have, and it applied and resolved the issue with no problems.
Here's the patch file..

diff.patch.tar.gz

Here's a link to the patch file. The file as received is diff.patch and needs to be applied to the op_map.cc vx-delegate file.

Of course be sure to verify that the patch applies properly, and this is for TFLIte version 2.9.1 which is what we have, and it applied and resolved the issue with no problems. Here's the patch file..

diff.patch.tar.gz

I'm running into what appears to be the exact same issue as you, except with YOLOv8. Did you have to rebuild the vx-delegate from source? If so, how? I'm having difficulty with that.