top of page

Getting Started with the Raspberry Pi AI Camera - Sony IMX500

  • Writer: Daniela Brenes
    Daniela Brenes
  • Sep 17
  • 4 min read

Updated: Sep 23


A close-up of the Raspberry Pi AI Camera module connected to a Raspberry Pi 5 board using a flat orange ribbon cable. The small black camera lens is mounted on a green circuit board in the foreground, while the Raspberry Pi 5 board with ports, HDMI connector, and GPIO pins is visible in the background.
Raspberry Pi AI Camera next to a Raspberry Pi 5 board — a compact setup for real-time AI and computer vision projects.

What is the Raspberry Pi AI Camera?

The Raspberry Pi AI Camera is a cutting-edge device powered by Sony’s IMX500 Intelligent Vision Sensor. Its built-in AI processor makes it easy to run and deploy neural network models, providing inference results directly from the camera. This leaves the Raspberry Pi compute-free for other general tasks like multimedia handling, UI and real time interaction with the user.

A Raspberry Pi AI Camera module with a black lens mounted on a green circuit board. The module is connected to a long orange ribbon cable labeled “Raspberry Pi Camera Cable.” Around the camera, colorful holographic overlays show AI detection of objects including an apple, a car, and a cat.
The Raspberry Pi AI Camera, taken from raspberrypi.com

The Raspberry Pi AI Camera can run AI models for a variety of tasks, including:

  • Image classification

  • Object detection

  • Semantic segmentation

  • Pose estimation


In this tutorial, we will guide you through the process of setting up the Raspberry Pi AI Camera and running real-time inference with an object detection model.


Setting Up the Raspberry Pi AI Camera


1. Gather your components

To follow this tutorial you will need the following components:

Close-up of a Raspberry Pi AI Camera module connected to a flexible orange ribbon cable. The small square black lens sits on a green circuit board, with Raspberry Pi branding visible. In the background, part of a Raspberry Pi computer board with chips and connectors is slightly out of focus.
The Raspberry Pi AI Camera next to a Raspberry Pi device, taken from raspberrypi.com

2. Set up the Raspberry Pi

Follow the instructions in the official Raspberry Pi getting started guide to get the Raspberry Pi board up and running.


3. Install the Raspberry Pi AI Camera

Carefully connect the Raspberry Pi AI Camera to your Raspberry Pi board by following the official installation guide.


4. Install the IMX500 Firmware

The following instructions apply to the Raspberry Pi 4 Model B and Raspberry Pi 5. If you are using a different model, you may need to adjust the steps slightly.


Update the Raspberry Pi to the latest software:

Install the IMX500 firmware files:

After running the previous command, the necessary files and tools to run the IMX500 will be installed:

  • Neural network model firmware files from the Raspberry Pi AI Camera Model Zoo are saved in /usr/share/imx500-models/

  • Firmware files for the IMX 500 sensor operation are located at /lib/firmware/imx500_loader.fpk and /lib/firmware/imx500_firmware.fpk

  • Sony network model packaging tools are also installed in the system.


4. Reboot the Raspberry Pi

Before running a model with the Raspberry Pi AI Camera, reboot the Raspberry Pi device.


5. Verify that the Raspberry Pi AI Camera is recognized

Run the following command to list the available cameras on the Raspberry Pi. If the Raspberry Pi AI Camera is correctly recognized, your output should be similar to ours.


Running Real-Time Object Detection with the Raspberry Pi AI Camera

You can interact with the Raspberry Pi AI Camera and run real-time inference using Python libraries. Two popular options are Picamera2 and the Application Module Library, which make it easy to build and run AI applications directly on the Raspberry Pi AI Camera.


We will show you how to use both to run real-time object detection with the SSD MobileNetV2 FPN Lite model.


Using Picamera2 with Raspberry Pi AI Camera

Picamera2 is a Python interface to Raspberry Pi’s camera software stack. Read the official Picamera2 manual to learn more about it.


1. Installation

As of September 2022, Picamera2 comes pre-installed with Raspberry Pi OS, but not with Raspberry Pi OS Lite. Note that it is only supported on Raspberry Pi OS Bullseye or newer.


In the case where Picamera2 is supported but not previously installed:


Picamera2 can also be installed via pip, although the apt alternative is recommended since it guarantees that compatible versions of Picamera2 and libcamera will be installed together.


The Picamera2 examples rely on OpenCV for drawing on the frame buffer:


2. Download the examples

Clone the Picamera2 repository:

Travel to the AI camera examples directory:


3. Run real-time object detection

Run the object detection example with the SSD MobileNetV2 FPN Lite model:

Afterwards, you should see a window similar to the following, and observe real-time object detection on your camera!

A blurred black computer mouse detected by the Raspberry Pi AI Camera using the Picamera2 interface. The mouse is surrounded by a green bounding box with a blue label reading “mouse (0.82),” showing an 82% confidence level. The detection window is titled “QtPreview (on raspberrypi).”
Real-time object detection identifying a mouse using the Raspberry Pi AI Camera with Picamera2.

If you face permission errors when attempting to run the example, check out the troubleshooting section at the end of this guide.


Using Application Module Library with Raspberry Pi AI Camera

Application Module Library, or modlib,  is an SDK by Sony with the goal to simplify the usage of the Raspberry Pi AI Camera and facilitate the development of applications for it.


1. Download the examples

Clone the modlib repository:


2. Run real-time object detection

modlib is provided as a Python project managed with uv. You can install uv by following our UV Tutorial.


Run the object detection example with the SSD MobileNetV2 FPN Lite model:

Just like the previous examples, a window should appear and you should be able to see the Raspberry Pi AI Camera detecting objects within its view.

A blurred computer mouse on a white surface detected by the Raspberry Pi AI Camera using Sony’s Application Module Library. The mouse is highlighted with an orange bounding box labeled “mouse: 0.82,” indicating an 82% detection confidence. A green frame outlines the full camera view, with FPS and DPS values displayed on the left side of the interface.
Real-time object detection identifying a mouse using the Raspberry Pi AI Camera with modlib.

If you face permission errors when attempting to run the example, check out the troubleshooting section at the end of this guide.


Hooray! We just ran real-time object detection on the AI Camera using two different Python libraries: Picamera2 and modlib. We encourage you to explore both of these options, and choose the most appropriate for your use case.


If you need to install modlib for your projects, you can do so with:

Troubleshooting Common Issues with the Raspberry Pi AI Camera


If you run into permission errors while running the Raspberry Pi AI Camera models, such as:


You may need to adjust the permissions for the debug filesystem. The following command allows all users to access /sys/kernel/debug. Note that this change is temporary and will reset after a reboot.


Contact Us

At RidgeRun.ai, we specialize in edge AI solutions, including projects with the Raspberry Pi AI Camera on resource-constrained systems. If you need help bringing your AI or computer vision project to life, contact us at contactus@ridgerun.ai — let’s collaborate!

bottom of page