Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

AI Camera - IMX500 • Yolov8n and Yolo11 Object detection doesn't work

$
0
0
Hello Pi Community,

I have been using the Raspberry Pi Ai Camera based on the IMX500 chip for a week now. I have managed to run different examples from picamera2 (object detection, image classification). Now I'm struggling getting my own yolo model to work(I have tested both Yolov8 and Yolo11).
Even tough I can convert the model from .pt to .onnx to packager.zip to .rpk and upload it using the picamera2 object detection example, it just detects nothing(even with a threshold as low as 0.1). The model is trained on 300x640 images.

I used this tutorial https://docs.ultralytics.com/de/integra ... requisites

This is how I'm converting the model currently:
.pt: This is my trained model (again, tested both Yolov8 and yolo11). It performs very well on my laptop. It consists of 4 different classes and as it's only a proof-of-concept, it was trained on only 105 pictures. I used this Ultralytics example code to perform PTQ and convert it into a .zip file(this was performed in google colab, as Ultralytics Export only works on Linux and I use windows. Im also training the model using Google Colab, so this made it easier):

Code:

from ultralytics import YOLO# Load a YOLO11n PyTorch modelmodel = YOLO("yolo11n.pt")# Export the modelmodel.export(format="imx", data="coco8.yaml")  # exports with PTQ quantization by default# Load the exported modelimx_model = YOLO("yolo11n_imx_model")# Run inferenceresults = imx_model("https://ultralytics.com/images/bus.jpg")
I replaced coco8.yaml with my own .yaml file.
What is really weird, is that in the log it prints after finishing exporting, it says this:

Code:

Export complete (806.9s)Results saved to /contentPredict:         yolo predict task=detect model=yolo11n_imx_model imgsz=640 int8 Validate:        yolo val task=detect model=yolo11n_imx_model imgsz=640 data=/usr/src/ultralytics/ultralytics/cfg/datasets/coco.yaml int8 Visualize:       https://netron.appWARNING ⚠️ Unable to automatically guess model task, assuming 'task=detect'. Explicitly define task for your model, i.e. 'task=detect', 'segment', 'classify','pose' or 'obb'.
Why would it use coco.yaml to validate? Also, it generates a labels.txt file, containing all the coco labels, but not mine.

I then use this command on my pi 5 to generate the .rpk file: imx500-package -i path/to/packerOut.zip -o path/to/output/folder

After uploading it using the picamera2/examples/imx500/imx500_object_detection_demo.py file found here: https://github.com/raspberrypi/picamera ... les/imx500

It uploads fine and displays the picture, but there is no object detection. When I use --print-intrinsics, it shows the coco labels under classes.
This is all very confusing to me. Any help is appreciated

Statistics: Posted by Fazeli24 — Mon May 05, 2025 9:12 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles