ā š Lightweight YOLO Object Detection API for Raspberry Pi 4
Real-time object detection API built with FastAPI and YOLOv5n, optimized for Raspberry Pi 4 and low-resource environments.
ā ⨠Key Features
- ā” Ultralight: YOLOv5n model (7.5MB) with 80 COCO classes detection
- šļø Multi-Architecture: Supports amd64 and arm64 (Raspberry Pi 4+)
- š§ Flexible Models: Easily switch between YOLOv5/YOLOv11 variants via MODEL_NAME environment variable
- š REST API: 4 endpoints with JSON and visual output modes
- š¾ Efficient: 800MB-1.2GB runtime memory on RPi4
- š³ Docker Native: Automated GitHub Actions multi-architecture builds
ā šÆ Quick Start
docker run -d -p 8000:8000 --memory=1.5G hn8888/yolo-light:arm64
curl http://localhost:8000/healthā
ā š Endpoints
- ā
GET /health: API and model status
- ā
POST /detect: JSON response with detections
- ā
POST /detect-visual: PNG image with bounding boxes drawn
- ā
GET /: API information
ā šØ Environment Variables
- MODEL_NAME (default: yolov5n.pt): Choose any YOLO model
- PORT (default: 8000): API port
ā šØ Available Models
yolov5n, yolov5s, yolov5m, yolov5l, yolov5x, yolov11n, yolov11s, yolov11m, yolov11l, yolov11x
ā š Requirements
- š„ļø Raspberry Pi 4 (2GB+ RAM recommended)
- š³ Docker 20.10+
- šæ 1.5-2GB disk space for image
ā š License
CC BY-NC 4.0 (Non-Commercial Use Only)
ā š Documentation
For complete guides, deployment instructions, and examples, visit:
https://github.com/hlavrencic/yolo-lightā
š Optimized for RPi4 and low-power environments!