YOLOv11 environment setup

YOLOv11 environment setup1. Preliminary preparation2. Install PyTorch3. Install Ultralytics4. Verify the installationReferences

This chapter is for self-build using the official image of Raspberry Pi 5B. If you are using the YAHBOOM version of the image, this tutorial can be ignored.

1. Preliminary preparation

2. Install PyTorch

The official download address is: https://download.pytorch.org/whl/torch_stable.html

image-20250314154551042

If you download it yourself, you need to find the corresponding torch and torchvision versions.

This experiment downloads torch-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl and torchvision-0.16.2-cp311-cp311-linux_aarch64.whl

The above two files can be obtained from the attachment and transferred to the Raspberry Pi via winSCP

Installation command:

3. Install Ultralytics

image-20250314164309258

You also need to update Ultralytics to the latest version, otherwise you will get an error AttributeError: Can't get attribute 'C3k2' on <module 'ultralytics.nn.modules.block' from '/home/pi/.local/lib/python3.11/site-packages/ultralytics/nn/modules/block.py'>

image-20250317160947391

Install onnxruntime

Note: Using onnxruntime requires installing a specific version of numpy. If it is not 1.23.5, you can run the following command to install the specified version

Restart afterwards

4. Verify the installation

Verify Ultralytics

Verify Torch

Verify Torchvision

Verify Numpy

Note: The ultralytics version will be updated later, please refer to the version information queried in the system

image-20250314171551227

References

https://docs.ultralytics.com/guides/raspberry-pi/