CV / YOLOv8
YOLOv8-seg
YOLOv8n/s/m instance segmentation on reComputer RK3588/RK3576 (RKNN) and on reComputer R Series with Hailo-8 or Hailo-10H through HailoRT.
Choose the device you're using, the set up guide and documentation will update accordingly.
Getting Started
sudo docker run --rm \
--name rk3588-yolov8n-seg \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
-e RKNN_LOG_LEVEL=0 \
--device /dev/video1:/dev/video1 \
--device /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3588-yolov8_seg:latest \
python web_detection.py --model_path model/yolov8n_seg.rknn --video video/test.mp4Model Details
reComputer R Series (CM5 + Hailo-8)YOLOv8-seg on reComputer R Series (CM5 + Hailo-8)
YOLOv8n/s/m-seg run on Hailo-8 through HailoRT 4.23. The HEF exposes raw heads (no on-chip NMS): the host decodes the DFL boxes, applies sigmoid and per-class NMS, and assembles the prototype masks (32 coefficients × 160×160×32 prototype, cropped to each box) for 80 COCO classes.
Model Info
| Variant | Input | Packaged HEF | Container image |
|---|---|---|---|
| YOLOv8n-seg | 640×640×3 RGB | 5.3 MB | yolov8n_seg |
| YOLOv8s-seg | 640×640×3 RGB | 17.3 MB | yolov8s_seg |
| YOLOv8m-seg | 640×640×3 RGB | 32.9 MB | yolov8m_seg |
Hardware and Host Setup
| Item | Value |
|---|---|
| Board | reComputer R Series with Raspberry Pi CM5 |
| Accelerator | Hailo-8 over PCIe, exposed as /dev/hailo0 |
| Runtime | HailoRT 4.23.x (host / container must share major.minor) |
| Python in container | 3.11, aarch64 |
sudo apt update
sudo apt install hailort hailort-pcie-driver python3-hailort
sudo reboot
# After reboot
hailortcli fw-control identify
ls /dev/hailo0
# Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
sudo systemctl enable docker
sudo systemctl start dockerRun With Demo Video
Select the command matching the model variant.
YOLOv8n-seg
sudo docker run --rm \
--name cm5-hailo8-yolov8n-seg \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8n_seg:latest \
python web_detection.py --model_path model/yolov8n_seg.hef --video_path video/test.mp4YOLOv8s-seg
sudo docker run --rm \
--name cm5-hailo8-yolov8s-seg \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8s_seg:latest \
python web_detection.py --model_path model/yolov8s_seg.hef --video_path video/test.mp4YOLOv8m-seg
sudo docker run --rm \
--name cm5-hailo8-yolov8m-seg \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8m_seg:latest \
python web_detection.py --model_path model/yolov8m_seg.hef --video_path video/test.mp4Open http://<Board_IP>:8000 to view the web preview (instance masks
overlaid per class + detection boxes).
USB Camera Mode
sudo docker run --rm \
--name cm5-hailo8-yolov8n-seg \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
--device /dev/video0:/dev/video0 \
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8n_seg:latest \
python web_detection.py --model_path model/yolov8n_seg.hef --camera_id 0REST API
Each variant has its own endpoint:
| Variant | Endpoint |
|---|---|
| YOLOv8n-seg | POST /api/models/yolov8n_seg/predict |
| YOLOv8s-seg | POST /api/models/yolov8s_seg/predict |
| YOLOv8m-seg | POST /api/models/yolov8m_seg/predict |
Example:
curl -X POST "http://<Board_IP>:8000/api/models/yolov8n_seg/predict" \
-F "file=@test.jpg"The response contains predictions entries with class, confidence and
box fields (box is x1/y1/x2/y2 in original-frame pixels). Instance masks
are rendered in the MJPEG preview; /api/video_feed serves the annotated
stream.
Implementation Notes
- The HEF exposes 10 raw tensors: per stride (32/16/8) a 64-channel DFL box head, an 80-channel class head and a 32-channel mask-coefficient head, plus a 160×160×32 prototype.
- Box decode uses the DFL softmax expectation (16 bins) over the cell centre; a compile that folds the DFL away (4-channel head) is decoded directly.
- The class heads may already be sigmoid-activated on device (Model Zoo alls script); the module only applies sigmoid when the values are raw logits.
- The one2many predictions go through per-class NMS driven by the confidence
and IoU sliders; masks are
sigmoid(coeffs @ proto), upsampled to the input and cropped to each box (threshold 0.5). - Letterbox padding is 114 (Model Zoo
base/yolo.yaml); the mean 0 / std 255 normalization is compiled into the HEF.
Development Notes
| Variant | Source | Dockerfile | Container |
|---|---|---|---|
| YOLOv8n-seg | src/rpi5_hailo8_yolov8n_seg/ | docker/hailo8/yolov8n_seg.dockerfile | ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8n_seg:latest |
| YOLOv8s-seg | src/rpi5_hailo8_yolov8s_seg/ | docker/hailo8/yolov8s_seg.dockerfile | ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8s_seg:latest |
| YOLOv8m-seg | src/rpi5_hailo8_yolov8m_seg/ | docker/hailo8/yolov8m_seg.dockerfile | ghcr.io/seeed-projects/recomputer-hailo8-cv/yolov8m_seg:latest |
- The executor is the HailoRT 4.23 InferVStreams wrapper (Python 3.11 + the
bundled cp311 wheel); the native
libhailort.socomes from the host. - HEFs: Hailo Model Zoo v2.19.0 Hailo-8 builds.
- Referenced mAP values (COCO instance segmentation) are the Model Zoo full-precision figures, not measurements on this board.