CV / DDRNet

DDRNet-23-Slim

DDRNet-23-Slim segments each pixel into 19 Cityscapes classes and paints the result with the Cityscapes palette. Start a prebuilt Docker image with one command and run inference through the REST API on Hailo-8. The guide covers device setup and troubleshooting.

1 downloads
Size
9.3 MB
Memory
4GB+
Inference Engine
HailoRT
Image input size
1024x2048

Start right away with Seeed Products

Platform
  1. Install the Hailo driver and runtime

    On Raspberry Pi OS, install the package for your accelerator from the Raspberry Pi OS repository. Check that the installed HailoRT version matches the library path in the Docker command.

    bash
    sudo apt update
    sudo apt install hailo-all
    sudo reboot

    On other systems, install the vendor’s Hailo driver and matching HailoRT runtime for your accelerator, OS, and kernel. Manual Hailo installation guide

    After reboot, confirm that the accelerator is detected and the device node is available. Raspberry Pi AI setup guide

    bash
    hailortcli fw-control identify
    ls /dev/hailo0
  2. Install Docker

    bash
    bash <(curl -fsSL https://get.docker.com)
  3. Run the Docker command

    bash
    sudo docker run --rm \
      --name cm5-hailo8-ddrnet_23_slim \
      --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/ddrnet_23_slim:latest \
      python web_detection.py --model_path model/ddrnet_23_slim.hef --video_path video/test.mp4

Deploy on hardware you already have

Platform

Hailo-8

  1. Install the Hailo driver and runtime

    On Raspberry Pi OS, install the package for your accelerator from the Raspberry Pi OS repository. Check that the installed HailoRT version matches the library path in the Docker command.

    bash
    sudo apt update
    sudo apt install hailo-all
    sudo reboot

    On other systems, install the vendor’s Hailo driver and matching HailoRT runtime for your accelerator, OS, and kernel. Manual Hailo installation guide

    After reboot, confirm that the accelerator is detected and the device node is available. Raspberry Pi AI setup guide

    bash
    hailortcli fw-control identify
    ls /dev/hailo0
  2. Install Docker

    bash
    bash <(curl -fsSL https://get.docker.com)
  3. Run the Docker command

    bash
    sudo docker run --rm \
      --name cm5-hailo8-ddrnet_23_slim \
      --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/ddrnet_23_slim:latest \
      python web_detection.py --model_path model/ddrnet_23_slim.hef --video_path video/test.mp4

Check that it’s running

Open the address below in a browser. Replace <board-ip> with your board’s IP address.

http://<board-ip>:8000

If you see the detection stream with boxes around objects, you’re all set.

Benchmark Performance

DDRNet-23-Slim reported inference throughput (FPS) on CM5 + Hailo-8.
  • DDRNet-23-Slim · reComputer R Series (CM5 + Hailo-8)
    Batch 1 FPS
    33.98

RESTful API

DDRNet-23-Slim exposes a FastAPI service on port 8000. The service segments 19 Cityscapes classes from an uploaded image or from the MJPEG preview stream, and returns either a JSON summary or a colored overlay.

Base URL: http://<board-ip>:8000

API endpoints

MethodPathPurpose
GET/healthCheck service and HailoRT status.
POST/api/models/ddrnet_23_slim/predictSegment an uploaded image and return a JSON summary of the class areas.
POST/api/models/ddrnet_23_slim/visualizeSegment an uploaded image and return the colored overlay as JPEG.
GET/api/models/ddrnet_23_slim/classesList the 19 Cityscapes class names and their IDs.
GET/api/video_feedMJPEG preview stream with the segmentation overlay.

predict accepts multipart/form-data with a file field. The JSON response reports the input image size and the pixel count per detected class:

json
{
  "success": true,
  "predictions": [
    {"class": "road", "confidence": 0.352, "pixels": 691404}
  ],
  "image": {"width": 1920, "height": 1080}
}

visualize returns image/jpeg with the class-ID mask mapped to the Cityscapes palette and blended over the original frame.

Test the API

bash
curl -s http://<board-ip>:8000/health

curl -X POST "http://<board-ip>:8000/api/models/ddrnet_23_slim/predict" \
  -F "file=@test.jpg"

curl -X POST "http://<board-ip>:8000/api/models/ddrnet_23_slim/visualize" \
  -F "file=@test.jpg" \
  -o ddrnet_overlay.jpg

curl -s http://<board-ip>:8000/api/models/ddrnet_23_slim/classes

Develop with the API

python
import requests

BASE_URL = "http://<board-ip>:8000"

health = requests.get(f"{BASE_URL}/health", timeout=10)
print(health.json())

with open("test.jpg", "rb") as handle:
    response = requests.post(
        f"{BASE_URL}/api/models/ddrnet_23_slim/predict",
        files={"file": handle},
        timeout=60,
    )
response.raise_for_status()
result = response.json()

for prediction in result["predictions"]:
    print(prediction["class"], prediction["pixels"])

classes = requests.get(f"{BASE_URL}/api/models/ddrnet_23_slim/classes", timeout=10)
print(classes.json())

The input is letterboxed to 1024x2048 with black padding before inference, and the returned mask is un-letterboxed to the original frame size, so predictions pixel counts refer to the uploaded image dimensions.

Frequently Asked Questions (FAQ)

Why do some sizes disappear when I switch platforms?

The size picker shows the variants with a deployment command for your selected platform. Switch platforms in the quick start to see the sizes available for each one.

What should I check if the accelerator is unavailable?

Check that the host OS, drivers, and runtime match the selected platform’s guide. For Hailo, verify that the host detects the accelerator and that the installed HailoRT version matches the deployment instructions.

Where do I find the inference endpoint?

Select your platform and open the RESTful API section for the endpoint and input format.

More FAQs