Use NPU with yolov5 on iMX8MP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use NPU with yolov5 on iMX8MP

793 Views
kanakshilledar
Contributor II

I am trying to run yolov5 on Verdin iMX8M Plus SOM. I have connected a USB webcam to the Yavia Development Board.

It is running only on the CPU I have the NPU enabled and I am running on 5.15

The yolov5 logs output is

# python3 detect.py --source 2

detect: weights=yolov5s.pt, source=2, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_csv=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1

YOLOv5  v7.0-295-gac6c4383 Python-3.10.13 torch-2.2.2 CPU



Fusing layers... 

YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients, 16.4 GFLOPs

[ WARN:0@21.272] global /usr/src/debug/opencv/4.6.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (1405) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

1/1: 2...  Success (inf frames 640x480 at 30.00 FPS)



[ WARN:0@23.925] global /usr/src/debug/opencv/4.6.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (2180) open OpenCV | GStreamer warning: cannot link elements

0: 480x640 1 person, 2571.6ms

0: 480x640 2 persons, 1 cell phone, 2471.2ms

0: 480x640 1 person, 2592.1ms

0: 480x640 1 person, 2523.1ms

0: 480x640 1 person, 2413.3ms

0: 480x640 1 person, 2483.8ms

0: 480x640 1 person, 2499.5ms

 

Any pointers on how can I get the NPU detected.

Thanks and Regards

 

0 Kudos
Reply
2 Replies

768 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @kanakshilledar 

 

You can check the IMX-MACHINE-LEARNING-UG in section 7.1 Hardware acceleration on i.MX 8 Series.

 

Best regards.

 

Salas.

0 Kudos
Reply

731 Views
kanakshilledar
Contributor II

Hi!
Sorry for the delay in response. I checked the hardware acceleration section of iMX machine learning users guide.

I looked at the examples in /usr/bin/tensorflow-lite-2.10.0/examples/ and is working on the NPU.

How can I get yolov5 to detect the NPU?

Also are there any examples which use realtime camera feed or how can I edit the existing ones to use a camera?

0 Kudos
Reply