What’s the news?
August 19, 2024 the Raspberry Pi Foundation released a new version of their RPi5 starting at $50
Why did the price go down?
The processor in this new version removes “unused” functionality, which contributes to cost savings for production. That plus the smaller system memory brings the pricing down to $50
How does it impact Ultralytics YOLO?
Of course this would mean that with Ultralytics YOLO, we expect there to be some decrease in performance compared to the RPi5 4/8 GB variants. According to the RPi Foundation, the CPU is expected to have the same performance, they just removed some silicon cruft, but variations in production runs could result in a noticeable change in performance. Additionally, with a lower quantity of system RAM, it’s possible that processes running for long durations might experience issues, so you’ll need to test for your usage.
What next?
We’d love to hear from you about this news!
- Let us know, are you going to buy a RPi5 2 GB model?
- Show us your RPi5 2 GB Ultralytics YOLO performance results
- Try running validation using
data="coco128.yaml"
and post your inference speeds
- You want to help update our Raspberry Pi documentation page
We’re going to try running a “simulated” performance test using a RPi5 and our Docker container. In case you didn’t know, you can run containers with constraints on the resources, so we’ll try testing with full system memory and with constrained system memory to see what (if any) changes there are in performance. If you’re interested to see the results, make sure to follow this post
Hello community!
I was able to simulate a 2GB RPi 5 on a 4GB RPi 5 by limiting the total amount of RAM and then perform benchmarks to compare the performance difference between the two. Benchmarks were carried out using PyTorch, ONNX, NCNN model formats and running validation using data=coco128.yaml
.
Device Environment
- Raspberry Pi OS Bookworm
- Python 3.11.2
- Ultralytics v8.2.80
SImulate 2GB Raspberry Pi 5 on a 4GB Raspberry Pi 5
The workaround is according to this discussion.
- Open
/boot/firmware/config.txt
with your favorite text editor
sudo nano /boot/firmware/config.txt
- Add the following line at the end of the file, save it and reboot Raspberry Pi
total_mem=2048
Benchmark PyTorch, ONNX, NCNN
The following commands were executed to benchmark on PyTorch, ONNX, and NCNN models
PyTorch
yolo val task=detect model=yolov8n.pt imgsz=640 data=coco128.yaml
ONNX
yolo export model=yolov8n.pt format=onnx
yolo val task=detect model=yolov8n.onnx imgsz=640 data=coco128.yaml
NCNN
yolo export model=yolov8n.pt format=ncnn
yolo val task=detect model=yolov8n_ncnn_model imgsz=640 data=coco128.yaml
Benchmark Results
The validation commands for each model were carried out for 10 iterations and the following table illustrates the average inference times.
|
2GB |
4GB |
PyTorch |
710.33ms |
670.90ms |
ONNX |
198.23ms |
173.32ms |
NCNN |
105.88ms |
85.06ms |
Further Findings
Following are the memory usage running each model
- Memory at idle ~ 445MB
- Max memory used when running validation on ONNX, NCNN ~ 475MB
- Max memory used when running validation on PyTorch ~ 1.2GB
- It seems that after running the benchmarks on Raspberry Pi 5 8GB, the results are much closer to the 2GB ones. This article also talks about how the 4GB version is slightly faster than 8GB.
3 Likes
Nice details @lakshanthad!
1 Like