How to deploy and run YOLOv5 trained model on imx8mplus?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to deploy and run YOLOv5 trained model on imx8mplus?

2,224 次查看
vivek338
Contributor IV

Hi,

Iam working on imx8mplus yocto project. I have trained object detection model on YOLOv5 on custom dataset. Its working fine on ubuntu pc. Now I want to run that model on my imx8mplus board. I convert the model in yo tflite and try to run the model on tensorflow script but its not working.

How can I run YOLOv5 model on imx8mplus?

Is any other way to run any other object detection model on imx8mplus that support for faster framerate and easy to interface? Also I need to train that model on my custom dataset.

 

Thanks in advance!!

0 项奖励
回复
10 回复数

2,170 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,
Please refer the doc i shared.


Best Regards,
Zhiming

0 项奖励
回复

2,161 次查看
vivek338
Contributor IV
Hi,
Thanks for replying!
Now I have successfully converted yolov5 to tflite model and tested becnchmark on npu as well following the document you have sent. But now I need example code in python to test live object detection on camera.

Thanks in advance !
0 项奖励
回复

2,137 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

The video pipeline is using gstreamer in the document. Please refer official detect code: https://github.com/ultralytics/yolov5/blob/master/detect.py

Best Regards,
Zhiming

0 项奖励
回复

1,657 次查看
vivek338
Contributor IV

vivek338_0-1743075284547.png

What are these parametrs and how to modify according to pixel size.

 


gst-launch-1.0 --no-position v4l2src device=/dev/video3 ! \
video/x-raw,width=640,height=480,framerate=30/1! \
tee name=t t. ! queue max-size-buffers=2 leaky=2 ! \
imxvideoconvert_g2d ! video/x-raw,width=256,height=256,format=RGBA ! \
videoconvert ! video/x-raw,format=RGB ! \
tensor_converter ! \
tensor_filter framework=tensorflow-lite model=yolov5s_quant_256.tflite \
custom=Delegate:External,ExtDelegateLib:libvx_delegate.so ! \
tensor_decoder mode=bounding_boxes option1=yolov5 option2=coco_label.txt \
option4=640:480 option5=256:256 ! \
mix. t. ! queue max-size-buffers=2 ! \
imxcompositor_g2d name=mix sink_0::zorder=2 sink_1::zorder=1 ! waylandsink

What to give option2=coco_label.txt. And what are the changes done to run model at 26-30fps? or what is the best parameter to run like pixel size, yolov5 model(small,medium,nano), number of images to train, epochs. 

I want to run like nxp-demo object detection example but on custom data set.

0 项奖励
回复

1,589 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Please use int8/uint8 for input/output data type, this should enhance the performance.

Best Regards,
Zhiming

0 项奖励
回复

2,104 次查看
vivek338
Contributor IV
Hi,
Thanks for replying!
Iam unable to open link in document:-
https://community.nxp.com/t5/iMX-and-Vybrid-Support/Steps-to-deploy-yolov5s-on-i-MX8MP/ta-p/1410740

Getting Access Denied.

Please help !
0 项奖励
回复

1,998 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

This is not a public group.

Best Regards,
Zhiming

0 项奖励
回复

1,992 次查看
vivek338
Contributor IV

Hi @Zhiming_Liu ,

I have somehow manage to run yolov5s model on board including gpu using tensorflow lite python api, but its too slow and its too difficult to run as compare to yolo.

My question is  that, any library or api is  available like ultarlytics(yolo) for tensorflow lite for detection in python. Like:-

python3 detect.py --weights yolov5s.pt --source 0 --device 0 --conf 0.5

Or I have to learn python and machine learning using tensorflow from scratch?

 

Please help !!

0 项奖励
回复

1,878 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

You may need add NPU delegate support in your python script, please refer here.

https://community.nxp.com/t5/i-MX-Processors/Request-Updated-NPU-Code-for-movenet-tflite-for-imx8mp/...

Best Regards,
Zhiming

0 项奖励
回复

2,165 次查看
adarshkv
Contributor I
Hi ,
Could you please share the document for deploying yolo models on imx8mp.

Thank you,
Adarsh
0 项奖励
回复