Illustration: a Raspberry Pi with a camera; on the monitor a mug, an apple and a toy car are marked with frames.Artificial intelligence
Illustration (made with AI): roughly what the finished project looks like.

An Object-Recognising Camera with Raspberry Pi 5

A camera watches the room and a neural network recognises 80 kinds of object in real time, among them people, cats and cups.

Difficulty
Advanced
Time
3 h
Age
14+
Parts
4, 4 on the site

Written by the RoboHub team. A question? Write to us.

Variations

Choose a variation and the parts list updates.

Instructions

  1. The system

    Write Raspberry Pi OS (64-bit) to the microSD card with Raspberry Pi Imager.

  2. The camera

    The Pi 5 has a smaller 22-pin camera connector, while the Camera Module 3 comes with a 15-pin ribbon, so you need a separate 22-to-15-pin camera cable (sold as a Pi 5 camera cable). A USB webcam works too and needs no ribbon.

  3. The model

    Install the ultralytics Python library and run a YOLO model on the camera stream.

    Python
    from ultralytics import YOLO
    
    model = YOLO("yolov8n.pt")            # the small model, fast enough on a Pi
    for result in model.predict(source=0, stream=True, show=True):
        pass
  4. The result

    Every recognised object appears on screen in a box with its name.