Ultralytics YOLO27: Join the waitlist.
Get Started

Quick Start Guide: Raspberry Pi with Ultralytics YOLO26#

Raspberry Pi is a small, affordable computer that runs Ultralytics YOLO26 for real-time object detection at the edge — no GPU required. This guide walks you through deploying YOLO26 on Raspberry Pi 4 and 5: flashing the OS, installing Ultralytics, exporting to NCNN for the fastest inference on ARM, and running predictions on a live camera feed. It also includes performance benchmarks across eight export formats so you can pick the best speed and accuracy trade-off for your hardware.

Jump to setting up Ultralytics, exporting to NCNN and running inference, benchmarks, or camera inference.



Watch: Raspberry Pi 5 updates and improvements.
Note

This guide has been tested with Raspberry Pi 4 and Raspberry Pi 5 running the latest Raspberry Pi OS Bookworm (Debian 12). Using this guide for older Raspberry Pi devices such as the Raspberry Pi 3 is expected to work as long as the same Raspberry Pi OS Bookworm is installed.

What is Raspberry Pi?#

Raspberry Pi is a small, affordable, single-board computer. It has become popular for a wide range of projects and applications, from hobbyist home automation to industrial uses. Raspberry Pi boards are capable of running a variety of operating systems, and they offer GPIO (General Purpose Input/Output) pins that allow for easy integration with sensors, actuators, and other hardware components. They come in different models with varying specifications, but they all share the same basic design philosophy of being low-cost, compact, and versatile.

Raspberry Pi Series Comparison#

Raspberry Pi 3Raspberry Pi 4Raspberry Pi 5
CPUBroadcom BCM2837, Cortex-A53 64Bit SoCBroadcom BCM2711, Cortex-A72 64Bit SoCBroadcom BCM2712, Cortex-A76 64Bit SoC
CPU Max Frequency1.4GHz1.8GHz2.4GHz
GPUVideoCore IVVideoCore VIVideoCore VII
GPU Max Frequency400MHz500MHz800MHz
Memory1GB LPDDR2 SDRAM1GB, 2GB, 4GB, 8GB LPDDR4-3200 SDRAM2GB, 4GB, 8GB, 16GB LPDDR4X-4267 SDRAM
PCIeN/AN/A1xPCIe 2.0 Interface
Max Power Draw2.5A@5V3A@5V5A@5V (PD enabled)

What is Raspberry Pi OS?#

Raspberry Pi OS (formerly known as Raspbian) is a Unix-like operating system based on the Debian GNU/Linux distribution for the Raspberry Pi family of compact single-board computers distributed by the Raspberry Pi Foundation. Raspberry Pi OS is highly optimized for the Raspberry Pi with ARM CPUs and uses a lightweight desktop environment that runs on Wayland by default on Raspberry Pi 4 and 5. Raspberry Pi OS is under active development, with an emphasis on improving the stability and performance of as many Debian packages as possible on Raspberry Pi.

Flash Raspberry Pi OS to Raspberry Pi#

The first thing to do after getting your hands on a Raspberry Pi is to flash a micro-SD card with Raspberry Pi OS, insert it into the device, and boot into the OS. Follow the detailed Getting Started Documentation by Raspberry Pi to prepare your device for first use.

Set Up Ultralytics#

You can set up the Ultralytics package on Raspberry Pi in two ways for your next Computer Vision project:

Start with Docker#

The fastest way to get started with Ultralytics YOLO26 on Raspberry Pi is to run with a pre-built Docker image for Raspberry Pi.

Run the command below to pull the Docker container and run it on Raspberry Pi. This is based on the official Python 3.13-slim-trixie image, which runs Debian 13 with Python 3.13.

t=ultralytics/ultralytics:latest-arm64
sudo docker pull $t && sudo docker run -it --ipc=host $t

The Docker image already includes Ultralytics, so you can go straight to exporting your model to NCNN.

Start without Docker#

Install Ultralytics Package#

Here we will install the Ultralytics package on the Raspberry Pi. Export dependencies for formats such as NCNN are installed automatically the first time you export a PyTorch model, so only the base package is needed here.

  1. Update packages list, install pip and upgrade to latest

    sudo apt update
    sudo apt install python3-pip -y
    pip install -U pip
  2. Install ultralytics pip package

    pip install ultralytics
  3. Reboot the device

    sudo reboot

Use NCNN on Raspberry Pi#

Out of all the model export formats supported by Ultralytics, NCNN delivers the best inference performance on Raspberry Pi devices because it is highly optimized for mobile and embedded platforms such as ARM. Convert your YOLO26n PyTorch model to NCNN, then run inference with the exported model:

Example
from ultralytics import YOLO

# Load a YOLO26n PyTorch model
model = YOLO("yolo26n.pt")

# Export the model to NCNN format
model.export(format="ncnn")  # creates 'yolo26n_ncnn_model'

# Load the exported NCNN model
ncnn_model = YOLO("yolo26n_ncnn_model")

# Run inference
results = ncnn_model("https://ultralytics.com/images/bus.jpg")
Tip

For more details about supported export options, see the model deployment options guide.

YOLO26 Performance Improvements over YOLO11#

YOLO26 is specifically designed to run on hardware-constrained devices such as the Raspberry Pi 5. Compared to YOLO11n, YOLO26n achieves a ~15% increase in FPS (6.79 → 7.79) while also delivering higher mAP (40.1 vs 39.5) at 640 input size with ONNX-exported models on the Raspberry Pi 5. The table and chart below showcase this comparison.

YOLO26 benchmarks on RPi 5
Benchmarked with Ultralytics 8.4.14
Performance
ModelmAP50-95(B)Inference time (ms/im)
YOLO26n40.1128.42
YOLO26s47.8352.84
YOLO26m52.5993.78
YOLO26l54.41259.46
YOLO26x56.92636.26

Benchmarked with Ultralytics 8.4.14.

Raspberry Pi 5 YOLO26 Benchmarks#

YOLO26 benchmarks were run by the Ultralytics team on eight different model formats measuring speed and accuracy: PyTorch, TorchScript, ONNX, OpenVINO, LiteRT, MNN, NCNN, ExecuTorch. Benchmarks were run on a Raspberry Pi 5 at FP32 precision with the default input image size of 640.

Comparison Chart#

Only YOLO26n and YOLO26s are included because larger model sizes run too slowly on Raspberry Pi to be practical.

YOLO26 benchmarks on RPi 5
Benchmarked with Ultralytics 8.4.108

Detailed Comparison Table#

The table below shows the benchmark results for two different models (YOLO26n, YOLO26s) across eight different formats (PyTorch, TorchScript, ONNX, OpenVINO, LiteRT, MNN, NCNN, ExecuTorch), running on a Raspberry Pi 5, giving the status, size, mAP50-95(B) metric, and inference time for each combination.

Performance
FormatStatusSize on disk (MB)mAP50-95(B)Inference time (ms/im)
PyTorch✅5.30.4760299.09
TorchScript✅9.80.4734353.20
ONNX✅9.50.4734125.99
OpenVINO✅9.60.4734104.55
LiteRT✅9.80.4730123.30
MNN✅9.40.474991.87
NCNN✅9.40.478467.03
ExecuTorch✅9.40.4772144.83

Benchmarked with Ultralytics 8.4.108

Note

Inference time does not include pre/post-processing.

Reproduce Our Results#

To reproduce the above Ultralytics benchmarks on all export formats, run this code:

Example
from ultralytics import YOLO

# Load a YOLO26n PyTorch model
model = YOLO("yolo26n.pt")

# Benchmark YOLO26n speed and accuracy on the COCO128 dataset for all export formats
results = model.benchmark(data="coco128.yaml", imgsz=640)

Note that benchmarking results might vary based on the exact hardware and software configuration of a system, as well as the current workload of the system at the time the benchmarks are run. For the most reliable results, use a dataset with a large number of images, e.g., data='coco.yaml' (5000 val images).

LiteRT export runs off-device

format=litert export (via litert-torch) is only supported on Linux x86_64 and macOS, not on the Raspberry Pi itself. Export the .tflite model on a Linux x86_64 machine or a Mac, copy it to the Raspberry Pi, and use the Pi for inference.

Use Raspberry Pi Camera#

Computer vision projects on Raspberry Pi often need real-time video feeds for inference. The onboard MIPI CSI connector on the Raspberry Pi allows you to connect official Raspberry Pi camera modules. In this guide, we have used a Raspberry Pi Camera Module 3 to grab the video feeds and perform inference using YOLO26 models.

Tip
Note

Raspberry Pi 5 uses smaller CSI connectors than the Raspberry Pi 4 (22-pin vs 15-pin), so you will need a 15-pin to 22-pin adapter cable to connect to a Raspberry Pi Camera.

Test the Camera#

Execute the following rpicam-hello command after connecting the camera to the Raspberry Pi. You should see a live video feed from the camera for about 5 seconds.

rpicam-hello

Inference with Camera#

There are two methods of using the Raspberry Pi Camera to run inference on YOLO26 models.

Run inference with the Raspberry Pi camera

Use picamera2, which comes pre-installed with Raspberry Pi OS, to access the camera and run inference on YOLO26 models.

Example
import cv2
from picamera2 import Picamera2

from ultralytics import YOLO

# Initialize the Picamera2
picam2 = Picamera2()
picam2.preview_configuration.main.size = (1280, 720)
picam2.preview_configuration.main.format = "RGB888"
picam2.preview_configuration.align()
picam2.configure("preview")
picam2.start()

# Load the YOLO26 model
model = YOLO("yolo26n.pt")

while True:
    # Capture frame-by-frame
    frame = picam2.capture_array()

    # Run YOLO26 inference on the frame
    results = model(frame)

    # Visualize the results on the frame
    annotated_frame = results[0].plot()

    # Display the resulting frame
    cv2.imshow("Camera", annotated_frame)

    # Break the loop if 'q' is pressed
    if cv2.waitKey(1) == ord("q"):
        break

# Release resources and close windows
cv2.destroyAllWindows()

Best Practices when using Raspberry Pi#

Follow these best practices to get maximum performance from YOLO26 on Raspberry Pi.

  1. Use an SSD

    For continuous 24/7 operation, use an SSD for the system because an SD card may wear out or fail under continuous writes. With the onboard PCIe connector on the Raspberry Pi 5, you can connect SSDs using an adapter such as the NVMe Base for Raspberry Pi 5.

  2. Flash without GUI

    When flashing Raspberry Pi OS, you can choose to not install the Desktop environment (Raspberry Pi OS Lite) and this can save a bit of RAM on the device, leaving more space for computer vision processing.

  3. Overclock Raspberry Pi

    If you want a little boost in performance while running Ultralytics YOLO26 models on Raspberry Pi 5, you can overclock the CPU from its base 2.4GHz to 3.0GHz and the GPU from 800MHz to 1GHz. If the system becomes unstable or crashes, reduce the overclock values by 100MHz increments. Ensure proper cooling is in place, as overclocking increases heat generation and may lead to thermal throttling.

    a. Upgrade the software

    sudo apt update && sudo apt dist-upgrade

    b. Open to edit the configuration file

    sudo nano /boot/firmware/config.txt

    c. Add the following lines at the bottom

    arm_freq=3000
    gpu_freq=1000
    force_turbo=1

    d. Save and exit by pressing CTRL + X, then Y, and hit ENTER

    e. Reboot the Raspberry Pi

Next Steps#

You have successfully set up YOLO26 on your Raspberry Pi. To go further, explore Predict mode for more inference options, Export mode for additional deployment formats, or the NVIDIA Jetson guide if you need more compute at the edge. For the complete documentation, visit the Ultralytics YOLO26 Docs.

Acknowledgments and Citations#

This guide was initially created by Daan Eeltink for Kashmir World Foundation, an organization dedicated to the use of YOLO for the conservation of endangered species. We acknowledge their pioneering work and educational focus in the realm of object detection technologies.

For more information about Kashmir World Foundation's activities, you can visit their website.

FAQ#

  • To set up Ultralytics YOLO26 on a Raspberry Pi without Docker, follow these steps:

    1. Update the package list and install pip:
      sudo apt update
      sudo apt install python3-pip -y
      pip install -U pip
    2. Install the Ultralytics package:
      pip install ultralytics
    3. Reboot the device to apply changes:
      sudo reboot

    For detailed instructions, refer to the Start without Docker section.

  • NCNN is highly optimized for mobile and embedded platforms, making it a strong choice for running YOLO26 on Raspberry Pi devices. Its ARM-optimized kernels deliver faster inference on the Pi than the other export formats in the benchmarks above.

  • You can convert a PyTorch YOLO26 model to NCNN format using either Python or CLI commands:

    Example
    from ultralytics import YOLO
    
    # Load a YOLO26n PyTorch model
    model = YOLO("yolo26n.pt")
    
    # Export the model to NCNN format
    model.export(format="ncnn")  # creates 'yolo26n_ncnn_model'
    
    # Load the exported NCNN model
    ncnn_model = YOLO("yolo26n_ncnn_model")
    
    # Run inference
    results = ncnn_model("https://ultralytics.com/images/bus.jpg")

    For more details, see the Use NCNN on Raspberry Pi section.

  • Key differences include:

    • CPU: Raspberry Pi 4 uses Broadcom BCM2711, Cortex-A72 64-bit SoC, while Raspberry Pi 5 uses Broadcom BCM2712, Cortex-A76 64-bit SoC.
    • Max CPU Frequency: Raspberry Pi 4 has a max frequency of 1.8GHz, whereas Raspberry Pi 5 reaches 2.4GHz.
    • Memory: Raspberry Pi 4 offers up to 8GB of LPDDR4-3200 SDRAM, while Raspberry Pi 5 features LPDDR4X-4267 SDRAM, available in 2GB, 4GB, 8GB, and 16GB variants.

    These enhancements contribute to better performance benchmarks for YOLO26 models on Raspberry Pi 5 compared to Raspberry Pi 4. Refer to the Raspberry Pi Series Comparison table for more details.

  • There are two methods to set up a Raspberry Pi Camera for YOLO26 inference:

    1. Using picamera2:

      import cv2
      from picamera2 import Picamera2
      
      from ultralytics import YOLO
      
      picam2 = Picamera2()
      picam2.preview_configuration.main.size = (1280, 720)
      picam2.preview_configuration.main.format = "RGB888"
      picam2.preview_configuration.align()
      picam2.configure("preview")
      picam2.start()
      
      model = YOLO("yolo26n.pt")
      
      while True:
          frame = picam2.capture_array()
          results = model(frame)
          annotated_frame = results[0].plot()
          cv2.imshow("Camera", annotated_frame)
      
          if cv2.waitKey(1) == ord("q"):
              break
      
      cv2.destroyAllWindows()
    2. Using a TCP Stream:

      rpicam-vid -n -t 0 --inline --listen -o tcp://127.0.0.1:8888
      from ultralytics import YOLO
      
      model = YOLO("yolo26n.pt")
      results = model("tcp://127.0.0.1:8888")

    For detailed setup instructions, visit the Inference with Camera section.

Comments134

Ask a question, share your results, or help someone else.

    1. Glenn JocherGlenn JocherUltralytics(edited)

      Hi there!

      Thank you for your feedback and for sharing your positive experience on the Raspberry Pi 5! 😊

      Creating a tutorial for the AI kit that comes with the Raspberry Pi 5 is a fantastic idea. In the meantime, you can refer to our comprehensive Quick Start Guide for Raspberry Pi with Ultralytics YOLO26, which provides detailed instructions on setting up and running YOLO on Raspberry Pi devices, including performance benchmarks.

      For those interested in using the AI kit, the setup process should be quite similar. Here’s a quick overview to get you started:

      1. Flash Raspberry Pi OS: Ensure you have the latest Raspberry Pi OS Bookworm (Debian 12) installed. Follow the Getting Started Documentation by Raspberry Pi to prepare your device.

      2. Set Up Ultralytics:

        • With Docker:
          t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host $t
        • Without Docker:
          sudo apt update
          sudo apt install python3-pip -y
          pip install -U pip
          pip install ultralytics[export]
          sudo reboot
      3. Use NCNN for Best Performance: Convert your YOLO26 model to NCNN format for optimal performance on Raspberry Pi:

        from ultralytics import YOLO
        
        # Load a YOLO26n PyTorch model
        model = YOLO("yolo26n.pt")
        
        # Export the model to NCNN format
        model.export(format="ncnn")  # creates 'yolo26n_ncnn_model'
        
        # Load the exported NCNN model
        ncnn_model = YOLO("yolo26n_ncnn_model")
        
        # Run inference
        results = ncnn_model("https://ultralytics.com/images/bus.jpg")
      4. Using the Raspberry Pi Camera: For real-time video feeds, you can use the picamera2 library or set up a TCP stream:

        • Using picamera2:

          import cv2
          from picamera2 import Picamera2
          from ultralytics import YOLO
          
          picam2 = Picamera2()
          picam2.preview_configuration.main.size = (1280, 720)
          picam2.preview_configuration.main.format = "RGB888"
          picam2.preview_configuration.align()
          picam2.configure("preview")
          picam2.start()
          
          model = YOLO("yolo26n.pt")
          
          while True:
              frame = picam2.capture_array()
              results = model(frame)
              annotated_frame = results[0].plot()
              cv2.imshow("Camera", annotated_frame)
              if cv2.waitKey(1) == ord("q"):
                  break
          
          cv2.destroyAllWindows()
        • Using TCP Stream:

          rpicam-vid -n -t 0 --inline --listen -o tcp://127.0.0.1:8888
          from ultralytics import YOLO
          
          model = YOLO("yolo26n.pt")
          results = model("tcp://127.0.0.1:8888")

      We hope this helps you get started with the AI kit on your Raspberry Pi 5. For more detailed instructions and additional resources, please visit our Raspberry Pi Guide.

      Happy coding! 🚀

  1. wneliswnelisGitHub

    Today I've installed module ultralytics on a Raspberry Pi 4 with 4 [GiB] memory running Trixie. Some remarks about what I've learned: . Use the 64-bit variant of Raspberry OS; . Use an microSD card of at least 32 [GiB]; . Disable /tmp becoming a file system in memory (tmpfs): sudo systemctl mask tmp.mount; . OpenCV is installed using apt, module ultralytics is installed in a virtual Python environment: 'python -m venv --system-site-packages `.

    It is found that YOLO runs into a hardware error: "Illegal instruction". This can be reproduced by using the Python script shown above to export the model in NCNN format. The output is:

    Downloading https://github.com/ultralyti…: 100% ━━━━━━━━━━━━ 5.3MB 1.4MB/s 3.8s Ultralytics 8.4.191 🚀 Python-3.13.5 torch-2.14.1+cu130 CPU (aarch64) Illegal instruction

    How can this issue be solved?

    1. Paula DerrengerPaula DerrengerUltralytics

      @wnelis the most likely cause is a native PyTorch binary using instructions unsupported by the Pi 4’s CPU, rather than faulty hardware; similar crashes are documented in Ultralytics #19091 and upstream PyTorch, although your exact version is not confirmed affected. (github.com) Your log shows a CUDA build (+cu130); first replace it with the matching official CPU-only packages inside your activated virtual environment, then retry the export: (pytorch.org)

      python -m pip install --force-reinstall torch==2.14.1 torchvision==0.29.1 --index-url https://download.pytorch.org/whl/cpu

      If it still crashes, please share the text output of yolo checks and python -m pip show torch torchvision from that same environment so we can identify package/path conflicts.

  2. hm-zeroonehm-zerooneGitHub(edited)

    "We haven’t validated Orbit OS yet, but if it supports tflite or onnx runtimes you should be able to deploy an exported Ultralytics YOLO26 model there using Export mode and the deployment options guide; if you try it, please share the exact device, export format, and any text error logs here in Discussions so the Ultralytics team can take a look."

    Hi @glenn-jocher,

    I added a new feature to my Orbit OS app to test YOLO models directly on edge devices, in this case a Raspberry Pi. The app now allows adding new models, and by default includes YOLO v8, v11 and v26.

    We also introduced a benchmark mode, where you can select an image and run all models to compare performance and results.

    localhost_9005_ (1)

    In the example shown in the image, YOLOv8 achieved the highest number of correct object detections by time.

    This demo video shows the remote deployment, no SSH, no Docker, of the app in action on Raspberry Pi 5 vs Arduino UNO Q and a comparison (“VS”) between the RPi 5 and UNO Q running YOLO v8. https://youtu.be/aiFJmosYVAI?si=v3Jo_TbswU3n-sZU

    1. Glenn JocherGlenn JocherUltralytics

      Thanks for sharing the Orbit OS benchmark; for a fair cross-model comparison please include the exact export/runtime backend, imgsz, confidence/IoU thresholds, and per-image latency/FPS, since on Raspberry Pi CPU deployments NCNN is usually the best baseline for YOLO26.

    2. hm-zeroonehm-zerooneGitHub(edited)

      Hey! Thanks for the feedback. All models were tested under the same conditions — TFlite runtime, same image, same thresholds (conf=0.50, IoU=0.45), same imgsz 640×640 with letterbox preprocessing.

      Everything runs through the OrbitOS SDK which currently has TFLite and ONNX embedded. NCNN is something we'll look into adding in a future release.

      Quick question — for RPi deployments, would you recommend INT8 or float16 as the default export format?

      Orbit OS SDK 26.0.1 Inference example.

      Orbit OS is multi-language — For now only Go SDK is available, Python, Java and C++ SDKs are coming soon.

      image

      
      model, _ := device.AIManager.UploadAndLoadModel(
          "yolo8n",
          "models/yolo26n_float16.tflite",
          aiv26.ModelBackend_TFLITE,
          aiv26.ExecutionMode_EXEC_HIGH_THREADS,
      )
      
      resp, _ := model.Infer(ctx, tensor.Data, tensor.Shape, tensor.Dtype)
      
      fmt.Println(resp.GetOutputShape())  // [1 84 8400]
      fmt.Println(resp.GetLatencyUs())    // e.g. 528000
    3. Glenn JocherGlenn JocherUltralytics(edited)

      For plain Raspberry Pi CPU deployment with LiteRT (.tflite), I’d usually default to INT8 for the best speed and memory savings, and use float16 only if quantization hurts accuracy too much or your runtime performs better with FP kernels; if you benchmark both, the LiteRT export guide is the right reference, while our Raspberry Pi guide shows NCNN as the strongest baseline once you add that backend.

      1
  3. safdarhamid64-cpusafdarhamid64-cpuGitHub

    when i write in raspberry pi terminal : from ultralytics import yolo error msg illegal instruction pops up , i have trained model and even i have first created environment and installed pip install ultralytics but still i am not able to run model yolo11n on my Raspberry Pi 4 , Guide me plzz

    1. Glenn JocherGlenn JocherUltralytics

      That Illegal instruction on Raspberry Pi usually means an incompatible binary wheel (most often torch/numpy pulled for the wrong arch/OS), and also note the correct import is from ultralytics import YOLO (capitalized), not yolo; please paste the text output of yolo checks plus the full traceback here in this discussion, and confirm uname -m + whether you’re on Raspberry Pi OS Bookworm 64-bit as in the Raspberry Pi YOLO26 guide; as a quick way to rule out env issues you can also try our ARM64 Docker flow from that guide:```bash t=ultralytics/ultralytics:latest-arm64 sudo docker pull $t && sudo docker run -it --ipc=host $t python -c "from ultralytics import YOLO; YOLO('yolo11n.pt')"

  4. inuropixinuropixGitHub

    Hi.. I get an error when implement botsort with reid is True and the model is ncnn(exported from yolo26n-cls.pt)

    Here’s the full traceback from the error:

        self.tracks = self.model.track(
                      ^^^^^^^^^^^^^^^^^
     File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/engine/model.py", line 579, in track
        return self.predict(source=source, stream=stream, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/engine/model.py", line 536, in predict
        return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream)
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/engine/predictor.py", line 225, in __call__
        return list(self.stream_inference(source, model, *args, **kwargs))  # merge list of Results into one
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 40, in generator_context
        response = gen.send(None)
                   ^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/engine/predictor.py", line 338, in stream_inference
        self.run_callbacks("on_predict_postprocess_end")
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/engine/predictor.py", line 509, in run_callbacks
        callback(self)
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/trackers/track.py", line 93, in on_predict_postprocess_end
        tracks = tracker.update(det, result.orig_img, getattr(result, "feats", None))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/trackers/byte_tracker.py", line 361, in update
        dists = self.get_dists(unconfirmed, detections)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/trackers/bot_sort.py", line 220, in get_dists
        emb_dists = matching.embedding_distance(tracks, detections) / 2.0
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/ultralytics/trackers/utils/matching.py", line 128, in embedding_distance
        cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric))  # Normalized features
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/sbr/people_counting/lib/python3.11/site-packages/scipy/spatial/distance.py", line 2903, in cdist
        raise ValueError('XA must be a 2-dimensional array.')
    ValueError: XA must be a 2-dimensional array.

    Any idea?

    1. Glenn JocherGlenn JocherUltralytics

      That traceback usually means BoT-SORT didn’t get valid (2D) ReID embeddings; also note that .track() should run with a Detect/Seg/Pose model, while yolo26n-cls is only meant to be the ReID feature extractor configured inside botsort.yaml (via with_reid/model). (docs.ultralytics.com)

      yolo track model=yolo26n.pt source=path/to/video.mp4 tracker="botsort.yaml"
      # in a copy of botsort.yaml
      with_reid: True
      model: yolo26n-cls.pt  # first confirm this works before swapping to an exported backend

      If you just need stable tracking on Raspberry Pi, try tracker="bytetrack.yaml" (no ReID); if you still hit this, please paste your botsort.yaml and the output of yolo checks so we can reproduce from the same environment. (docs.ultralytics.com)

  5. hananabuzainabhananabuzainabGitHub

    I can't install ultralytics on rasspbery pi 5...with python 3.11 version,why??

    I used: pip install ultralytics

    How can i fix this problem ??

    1. Glenn JocherGlenn JocherUltralytics

      Can you paste the full pip install ultralytics error text (as text, not a screenshot) and the output of python3 -V here so we can pinpoint what’s failing? On Raspberry Pi 5 this is most often a Python/pip mismatch or non-Bookworm/32-bit setup—please also confirm you’re on Raspberry Pi OS Bookworm 64-bit as in the Raspberry Pi with Ultralytics YOLO26 guide.

      python3 -V
      python3 -m pip install -U pip setuptools wheel
      python3 -m venv .venv
      source .venv/bin/activate
      python -m pip install -U pip
      python -m pip install ultralytics
  6. avasanjeshavasanjeshGitHub

    Hi,

    I want to use python version of raspberry pi 32 bit OS. can you please tell me if i can export yolo detection model in 32 bit raspberry pi?

  7. Edward-YSEdward-YSGitHub

    Hello,I'm wondering if there is Benchmarking Results of Two Different Models (YOLO8n, YOLO8s) Across Ten Formats: PyTorch, TF, ONNX, OpenVINO, TF SavedModel, TF GraphDef, TF Lite, PaddlePaddle, MNN, NCNN.

  8. zyt2011zyt2011GitHub

    Installing a single Hailo-5 is sufficient.


    发件人: Beautifulboy111 @.> 发送时间: 2025年4月22日 14:24 收件人: ultralytics/ultralytics @.> 抄送: zyt2011 @.>; Mention @.> 主题: Re: [ultralytics/ultralytics] zh/guides/raspberry-pi/ (Discussion #19489)

    Why does my Raspberry Pi 5 have a high inference latency of 150ms when using NCNN for video recognition, even after overclocking? How can I reduce the inference time?

    ― Reply to this email directly, view it on GitHubhttps://github.com/orgs/ultralytics/discussions/19489#discussioncomment-12906311, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJ7DFR53TAD7QVJNO3TTXJL22XOAJAVCNFSM6AAAAABYEEJCHCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOJQGYZTCMI. You are receiving this because you were mentioned.Message ID: @.***>

    1. Glenn JocherGlenn JocherUltralytics(edited)

      @Beautifulboy111 150ms inference latency with NCNN on Raspberry Pi 5 is higher than expected. Here are some steps to reduce it:

      1. Use a smaller YOLO26 model - our benchmarks show YOLO26n is significantly faster than YOLO26s with NCNN on Pi 5 (67ms vs 173ms)

      2. Reduce input resolution - try 320x320 instead of 640x640, which can cut inference time by up to 70%

      3. Optimize memory allocation by running without GUI (Raspberry Pi OS Lite)

      4. Ensure you're using proper cooling for sustained performance when overclocked

      5. Consider processing at lower FPS if your application allows it

      Regarding @zyt2011's suggestion, while accelerators like Hailo can boost performance, they're a separate investment. I'd recommend optimizing your current setup first using the techniques in our Raspberry Pi guide.

      What's your specific use case? This would help us provide more targeted optimization advice.

  9. Beautifulboy111Beautifulboy111GitHub

    Why does my Raspberry Pi 5 have a high inference latency of 150ms when using NCNN for video recognition, even after overclocking? How can I reduce the inference time?