guides/raspberry-pi/ #8277
Replies: 32 comments 82 replies
-
Hi, I am getting stuck on step 4. I am using a Raspberry Pi 3 and I am getting: "Error: Could not find a version that satisfies the requirement torch>=1.11.0" Note, this is after I have changed the versions in "requirements.txt" to torch>=1.11.0 and torchvision>=0.12.0. I got the same type of error message with the original torch>=1.18.0 and torchvision>=0.9.0. Any ideas? PS. My intention is to try to run this on a Raspberry Pi 5 (4 GB), but my PiCam didn´t fit in the Pi 5. DS |
Beta Was this translation helpful? Give feedback.
-
Hi, The output I am getting is: ModuleNotFoundError: No module named 'torch' Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
(no module named ultralytics) shown after running the ultralytics |
Beta Was this translation helpful? Give feedback.
-
Hello! Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
hello, how do I not have to run TCP Stream in the command prompt every time I want to run code. |
Beta Was this translation helpful? Give feedback.
-
Hi , I have a trained model and I saved it on my PC what is the best way to export and it an excutable to run on Raspberry pi 4 model B 8GB |
Beta Was this translation helpful? Give feedback.
-
how can i use my owned trained model exported from google collab broc@raspberrypi:~/yolov5 $ python3 detect.py --weights /home/broc/yolov5/trained_data.pt --source=tcp://127.0.0.1:8888 but gave me this error im running this on Raspberri Pi 4 model B 4GB |
Beta Was this translation helpful? Give feedback.
-
@glenn-jocher by the way, why there is so much difference in inference time with yolov8 ? : i see
when use this code provided:
and much faster in console:
using this: |
Beta Was this translation helpful? Give feedback.
-
Hi, I really excited to get started with using YOLO and learning a lot along the way, but I'm struggling with the environment setup guidance that you have here for a Raspberry Pi. Step 2 however isn't allowed results in error Do you recommend creating a virtual environment or override the error with the following? Either way, I want to get past basic setup so I can start playing with yolov8, but seemingly something is going wrong with the most recent Pi. thanks and sorry if this is a basic question |
Beta Was this translation helpful? Give feedback.
-
Hai , I am using Raspberry pi 4B. I wanted to deploy my yolov8 detection model in Raspberry pi. When my webcam turn ON to initiate detection, the frame rate is soooooooo slowwwww:(. Is there any solution to solve this |
Beta Was this translation helpful? Give feedback.
-
How to deploy a custom model best.pt |
Beta Was this translation helpful? Give feedback.
-
How to do object detection with web cam connect with pi 4 using USB port. How can I access this camera through opencv? |
Beta Was this translation helpful? Give feedback.
-
When I follow the docker instructions I continually fail. yolo predict model=yolov8n.pt source="tcp://127.0.0.1:8888" This is my docker container & image: 4552de20307c ultralytics/ultralytics:latest-arm64 "bash" 22 hours ago Up 22 hours 127.0.0.1:8080->8888/tcp xenodochial_kepler Any idea what am I doing wrong? |
Beta Was this translation helpful? Give feedback.
-
Works great on Raspberry Pi 5. |
Beta Was this translation helpful? Give feedback.
-
Hi, I don't know if I'm stuck or it just takes hours to install. I installed Ultralytics without docker and currently its on this Building wheels for collected packages: psutil, tensorflow-decision-forests, tensorstore The last line Building wheel for tensorstore (pyproject.toml) ... / have been running for hours now and I don't know if I'm stuck or this just takes a lot of time to load. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Hey there! I can either plot or run inference from the webcam, but not at the same time. The RPi has 8GB of RAM so that should not be a limit. Does anyone have any ideas for testing? I feel like I've tried everything... import cv2
from ultralytics import YOLO
import settings as s
def capture_and_process_frames(device: cv2.VideoCapture, model: YOLO):
success, img = device.read()
if not success:
return
results = model(img, stream=True, conf=s.MINIMUM_CONFIDENCE, imgsz=(s.IMAGE_HEIGHT, s.IMAGE_WIDTH))
for r in results:
boxes = r.boxes
for box in boxes:
x1, y1, x2, y2 = [int(value) for value in box.xyxy[0]]
box_class = s.CLASS_NAMES[int(box.cls[0])]
cv2.rectangle(img, (x1, y1), (x2, y2), color=(214, 66, 71), thickness=3)
cv2.putText(img, text=f"{box_class}: {box.conf[0] * 100:.0f}%", org=[x1, y1], fontFace=cv2.FONT_HERSHEY_SIMPLEX,
fontScale=1, color=(255, 86, 180), thickness=2)
#cv2.imshow("Webcam", img)
if __name__ == "__main__":
video_capture = cv2.VideoCapture(-1)
video_capture.set(3, s.IMAGE_HEIGHT)
video_capture.set(4, s.IMAGE_WIDTH)
yolo_model = YOLO(s.MODEL, task="detect")
# Event loop
while True:
capture_and_process_frames(video_capture, yolo_model)
if cv2.waitKey(1) == ord("q"):
break
# Cleanup
video_capture.release()
cv2.destroyAllWindows() If I uncomment the cv2.imshow it just hangs... |
Beta Was this translation helpful? Give feedback.
-
Hello! from ultralytics import YOLO
# Load a YOLOv8n PyTorch model
model = YOLO("yolov8n.pt")
# Export the model to NCNN format
model.export(format="ncnn") # creates 'yolov8n_ncnn_model'
# Load the exported NCNN model
ncnn_model = YOLO("yolov8n_ncnn_model")
# Run inference
results = ncnn_model("https://ultralytics.com/images/bus.jpg") How can I solve this problem? |
Beta Was this translation helpful? Give feedback.
-
Hi! first time for me using Yolo and a Raspberry Pi. I tried the quick start guide but unfortunatly I can't execute the python code:
The error is: I have tried this on Raspberry Pi 4 and Zero 2W with the lite 64Bit OS and on the Zero 2W with the non lite version. I don't know if its worth mentioning but the lite version required me to use I have tried to downgrade torch and torchvision versions since I have read somewhere that torch 1.8.0 would resolve this but I was not successful installing the required earlier Python version (mine is 3.11.2). Any help would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
-
Iam using rasberry pi 4 model B in which i have install debian 12 and python version 3.11.2 a default python version but after too many efforts I have install ultralytics library by creating environment and when I run the code |
Beta Was this translation helpful? Give feedback.
-
hi! I'm trying to use raspberry pi zero w to load the yolov8 model for image inspection, there seems to be no conda version for this board, so I created a virtual environment directly using venv and python version 3.9. But I'm having problems configuring the yolo environment for it. I'm using pip install ultralytics[export] or pip install ultralytics doesn't work, I've already used sudo apt update, and pip install -U pip to update, what should I do? |
Beta Was this translation helpful? Give feedback.
-
Hi! I noticed an error in your guide and wanted to let you know. from ultralytics import YOLO
# Load a YOLOv8n PyTorch model
model = YOLO("yolov8n.pt")
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all all export formats
results = model.benchmarks(data="coco8.yaml", imgsz=640) The error occurs at So we need to correct this code to: results = model.benchmark(data="coco8.yaml", imgsz=640) |
Beta Was this translation helpful? Give feedback.
-
Use NCNN for Best Performance: Convert your YOLOv8 model to NCNN format for optimal performance on Raspberry Pi,but how should i adjust iou or conf as in normal model ? |
Beta Was this translation helpful? Give feedback.
-
YOLOv11 Installation and Training Issue on Raspberry Pi 5 I'm trying to train a YOLOv11 model on my PC for the Raspberry Pi 5. I've run into a couple of issues: Installing Ultralytics: When I use pip install ultralytics, it seems to install YOLOv8 instead of YOLOv11. Is there a way to specifically install YOLOv11? Training Error: I'm trying to train with the following code: But I'm getting this error: Where can I find the correct YAML file for YOLOv11? Any help would be greatly appreciated! Thanks, |
Beta Was this translation helpful? Give feedback.
-
YOLOv11 Installation and Training Issue on Raspberry Pi 5 Hi everyone, I'm trying to train a YOLOv11 model on my PC for the Raspberry Pi 5. I've run into a couple of issues: Installing Ultralytics: When I use pip install ultralytics, it seems to install YOLOv8 instead of YOLOv11. Is there a way to specifically install YOLOv11? Training Error: I'm trying to train with the following code: But I'm getting this error: Where can I find the correct YAML file for YOLOv11? Any help would be greatly appreciated! Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi, I am trying to install Ultralytics on Raspberry Pi zero 2w with Bookworm 32bit lite version. I am following below steps (without docker) sudo apt update pip install ultralytics[export] I am getting below error after running above command. (.venv) astropi2w@mypi2w:~ $ pip install ultralytics[export] × pip subprocess to install build dependencies did not run successfully.
note: This error originates from a subprocess, and is likely not a problem with pip. × pip subprocess to install build dependencies did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. Can I get some help ? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, Do you have a tutorial to run, yolo models on ncnn? using c++ |
Beta Was this translation helpful? Give feedback.
-
Hi,
thank you very much! |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Hi, I believe the lag is primarily due to the heavy best.pt model and the limited processing power of the Raspberry Pi. Despite adjusting the frame rate and resolution of the Picamera2 feed, the performance remains slow and laggy. Here are the training parameters I used for the YOLO model: Camera initialization and inference code snippet: Load YOLO Custom modelmodel = YOLO("models/best.pt") Initialize Picamera2picam2 = Picamera2() while True:
How can I improve the performance and resolve the camera lag issue effectively? What is the best approach to deploy a YOLO custom model (best.pt) on a Raspberry Pi 4 Model B with 4GB RAM? |
Beta Was this translation helpful? Give feedback.
-
Hello, currently I have a Raspberry Pi 4 and when I run Yolo I only get a few fps, now I'm confused whether it's better to buy a Pi Camera AI / buy a Raspberry Pi 5, so I can get better fps ? |
Beta Was this translation helpful? Give feedback.
-
guides/raspberry-pi/
Quick start guide to setting up YOLO on a Raspberry Pi with a Pi Camera using the libcamera stack. Detailed comparison between Raspberry Pi 3, 4 and 5 models.
https://docs.ultralytics.com/guides/raspberry-pi/
Beta Was this translation helpful? Give feedback.
All reactions