Hi everyone! I’m working on a project to detect drowning with a Raspberry Pi using a trained Roboflow model. I would love to use my Raspberry Pi AI Camera, which utilizes the Sony IMX500 Video sensor to lessen the workload of the RPI GPU. However, the camera requires models to be “packaged” in a way that the sensor can initiate the model by itself. I’m having trouble figuring out how to convert Roboflow models into this state (.rpk files?). The IMX500 website has conversion features but only for Tensorflow and Pytorch, (https://developer.aitrios.sony-semicon.com/en/docs/raspberry-pi-ai-camera/imx500-packager?version=2025-09-30&progLang=) is there a way to convert a Roboflow model into those states and then to the AI Camera?
My goal is to initiate the camera through CLI with something like this:
$ rpicam-vid -t 10s -o output.264 --post-process-file /usr/share/rpi-camera-assets/imx500_mobilenet_ssd.json --width 1920 --height 1080 --framerate 30
- Project Type: Object Detection
- Operating System & Browser: Raspberry Pi OS, Mac OS
- Project Universe Link or Workspace/Project ID: N/A
- Do you grant Roboflow Support permission to access your Workspace for troubleshooting? (Yes/No): Yes
Hi Julianna,
This sounds like an awesome idea, it will requires a multi-step conversion pipeline. Here’s the full path from a Roboflow model to a .rpk file on your IMX500 camera.
The Full Pipeline
Roboflow (.pt) → ONNX → Quantize (MCT) → IMX500 format → .rpk (on Pi)
To get your model weights out of Roboflow, you can use the “Download Weights” button in your model version page if you’re on a paid/Core plan. If you’re on a free plan, you won’t be able to export the weights from a Roboflow-trained model directly
From there, you can export directly to IMX500 format using Ultralytics’ built-in exporter (model.export(format="imx500", imgsz=320)), which handles IMX500 compatibility under the hood, or manually export to ONNX first with yolo export model=best.pt format=onnx imgsz=320.
Next, you’ll need to quantize the model using Sony’s Model Compression Toolkit (pip install model-compression-toolkit) — Sony provides Jupyter notebooks for object detection on their sony/model_optimization GitHub repo that walk you through this step. Once quantized, you convert to IMX500 format using Sony’s Edge-MDT toolkit (pip install edge-mdt[pt]) by running imxconv-pt -i quantized_model.onnx -o ./converted_output; both the quantization and conversion steps are best done on a more powerful machine like your Mac. The resulting packerOut.zip then gets transferred to your Raspberry Pi, where you run sudo apt install imx500-tools followed by imx500-package -i packerOut.zip -o ./output_folder to produce your final network.rpk file — this packaging step must happen on the Pi itself.
Finally, you run the camera using rpicam-vid pointed at a .json post-processing config file that references your .rpk and your custom class labels; the easiest starting point is copying /usr/share/rpi-camera-assets/imx500_mobilenet_ssd.json and swapping in your model path and drowning-detection class list.
For best IMX500 compatibility, stick to YOLOv8n or YOLO11n (nano variants). The IMX500 model zoo already includes yolov8n and yolo11n as pre-packaged .rpk files GitHub, so these architectures are proven to work through the full pipeline.
Happy building!