CV / DeepLab v3
DeepLabV3 RKNN
Produces a 21-class PASCAL VOC segmentation overlay for images and video frames.
Choose the device you're using, the set up guide and documentation will update accordingly.
Getting Started
sudo docker run --rm --privileged -p 8000:8000 \
-v /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3576-deeplabv3:latest \
python3 web_service.py --platform rk3576 --model_path /app/model/deeplabv3.rknn \
--sample_path /app/model/test.jpg --overlay_alpha 0.5 --camera_id -1 --host 0.0.0.0 --port 8000REST API
Use the REST API to run inference. Copy the commands below.
curl http://localhost:8080/v1/chat/completions -d '{
"model": "deeplab-v3-rknn",
"messages": [{"role": "user", "content": "Hello"}]
}'import requests
resp = requests.post(
"http://localhost:8080/v1/chat/completions",
json={"model": "deeplab-v3-rknn", "messages": [{"role": "user", "content": "Hello"}]},
)
print(resp.json())Model Details
DeepLabV3 on reComputer RK3576 and RK3588
This page documents the DeepLabV3 semantic-segmentation service in
reComputer-RK-CV. It
supports still images, cameras, looping local video, uploaded MP4 analysis, and
an MJPEG overlay preview.
Model information
| Property | Value |
|---|---|
| Model | /app/model/deeplabv3.rknn |
| Input | 513 x 513 RGB |
| Output | 21-class PASCAL VOC logits |
| Rendering | Argmax mask with configurable color-overlay opacity |
The service validates both NCHW and NHWC output layouts and restores the mask to the source resolution.
Run the service
RK3576
sudo docker run --rm --privileged -p 8000:8000 \
-v /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3576-deeplabv3:latest \
python3 web_service.py --platform rk3576 \
--model_path /app/model/deeplabv3.rknn \
--sample_path /app/model/test.jpg --overlay_alpha 0.5 \
--camera_id -1 --host 0.0.0.0 --port 8000RK3588
sudo docker run --rm --privileged -p 8000:8000 \
-v /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3588-deeplabv3:latest \
python3 web_service.py --platform rk3588 \
--model_path /app/model/deeplabv3.rknn \
--sample_path /app/model/test.jpg --overlay_alpha 0.5 \
--camera_id -1 --host 0.0.0.0 --port 8000Open http://<BOARD_IP>:8000 or /docs. For a USB camera, map its
/dev/videoN node and set --camera_id N. For a mounted local video, use
--video /data/input.mp4; local video takes precedence over the camera.
Startup arguments
| Argument | Default | Description |
|---|---|---|
--platform | Required | rk3576 or rk3588. |
--model_path | model/deeplabv3.rknn | DeepLabV3 RKNN file. |
--sample_path | model/test.jpg | Warm-up and initial-preview image. |
--overlay_alpha | 0.5 | Initial mask opacity from 0 to 1. |
--camera_id | -1 | Camera N, or -1 for uploads only. |
--video, --video_path | None | Looping local video; overrides the camera. |
--host / --port | 0.0.0.0 / 8000 | Service address and container port. |
When using -p, change only the host side if port 8000 is occupied. The
container service must remain on port 8000 for its health check.
REST API
Endpoint: POST /api/models/deeplabv3/predict
curl -X POST "http://<BOARD_IP>:8000/api/models/deeplabv3/predict" \
-F "file=@test.jpg" -F "overlay_alpha=0.65"The response reports image size, inference time, opacity, and all PASCAL VOC
classes present with their pixel counts. The latest rendered overlay is
available from GET /api/video_feed.
Example result fields:
{
"success": true,
"model": "deeplabv3",
"inference_time": 0.052,
"result": {
"classes": [{"id": 15, "class": "person", "pixels": 18234}],
"width": 1280,
"height": 720,
"overlay_alpha": 0.65
}
}GET/POST /api/config manages the global overlay opacity. Health, MP4 upload,
analysis status, list, and download endpoints are also provided. Models with a
different class count require corresponding label and output-processing code
changes.
Processing details
Input is resized to 513 x 513 and converted from BGR to RGB. The runtime
accepts NCHW or NHWC logits, verifies that the output has 21 channels, restores
the logits to the source resolution, applies argmax, and overlays the PASCAL
VOC color map. POST /api/video/analyze accepts an uploaded filename; status
and result files are exposed through the /api/video/* endpoints.
Build locally
docker build -f docker/rk3576/deeplabv3.dockerfile \
-t rk3576-deeplabv3:local src/rk3576_deeplabv3
docker build -f docker/rk3588/deeplabv3.dockerfile \
-t rk3588-deeplabv3:local src/rk3588_deeplabv3Inputs and Outputs
Input: image, video frame, or camera frame. Output: PASCAL VOC semantic mask, class pixel counts, and overlay.