CV / PPSeg
PP-LiteSeg
Produces 19-class Cityscapes masks with image, camera, and video service modes.
Choose the device you're using, the set up guide and documentation will update accordingly.
Getting Started
sudo docker run --rm --privileged --net=host \
-e PYTHONUNBUFFERED=1 -e RKNN_LOG_LEVEL=0 \
--device /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3576-ppseg:latest \
python web_service.py --platform rk3576 --model_dir /app/model --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": "pp-liteseg-rknn",
"messages": [{"role": "user", "content": "Hello"}]
}'import requests
resp = requests.post(
"http://localhost:8080/v1/chat/completions",
json={"model": "pp-liteseg-rknn", "messages": [{"role": "user", "content": "Hello"}]},
)
print(resp.json())Model Details
PP-LiteSeg on reComputer RK3576 and RK3588
This service packages the PP-LiteSeg Cityscapes example from
reComputer-RK-CV with
RKNN inference, Web preview, REST APIs, and asynchronous MP4 processing.
Model information
| Property | Value |
|---|---|
| Model | model/ppseg.rknn |
| Input | 512 x 512 RGB |
| Output | 19-class Cityscapes segmentation mask |
| Warm-up image | model/test.png |
Run the service
RK3576
sudo docker run --rm --privileged --net=host \
-e PYTHONUNBUFFERED=1 -e RKNN_LOG_LEVEL=0 \
--device /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3576-ppseg:latest \
python web_service.py --platform rk3576 --model_dir /app/model \
--camera_id -1 --host 0.0.0.0 --port 8000RK3588
sudo docker run --rm --privileged --net=host \
-e PYTHONUNBUFFERED=1 -e RKNN_LOG_LEVEL=0 \
--device /dev/dri/renderD129:/dev/dri/renderD129 \
-v /proc/device-tree/compatible:/proc/device-tree/compatible:ro \
ghcr.io/seeed-projects/recomputer-rk-cv/rk3588-ppseg:latest \
python web_service.py --platform rk3588 --model_dir /app/model \
--camera_id -1 --host 0.0.0.0 --port 8000Open http://<BOARD_IP>:8000 or /docs. Use --camera_id N with a mapped
/dev/videoN node for a camera. Use --video video/test.mp4 for the bundled
video; --video and --video_path are aliases and override the camera.
Startup arguments
| Argument | Default | Description |
|---|---|---|
--platform | Required | rk3576 or rk3588. |
--model_dir | model | Directory containing ppseg.rknn and test.png. |
--camera_id | -1 | Camera index; -1 disables capture. |
--video, --video_path | None | Looping local video; overrides the camera. |
--host / --port | 0.0.0.0 / 8000 | FastAPI listen address and port. |
PYTHONUNBUFFERED=1 flushes logs immediately. RKNN_LOG_LEVEL=0 suppresses
known harmless static-model initialization messages; remove it while debugging
RKNN startup.
REST API
Endpoint: POST /api/models/ppseg/predict
curl -X POST "http://<BOARD_IP>:8000/api/models/ppseg/predict" \
-F "file=@test.png"The response contains inference time, source dimensions, and per-class pixel
counts. The latest mask overlay is served by GET /api/video_feed.
| Endpoint | Purpose |
|---|---|
GET /api/health | Platform, model names, and readiness. |
GET /api/video_feed | Latest color-mask overlay as MJPEG. |
POST /api/video/upload | Upload one MP4 in field file. |
POST /api/video/analyze | Analyze an uploaded filename. |
GET /api/video/status | Background progress and errors. |
GET /api/video/list | Uploaded and generated videos. |
GET /api/video/download/{filename} | Download a result. |
The generic threshold and topk configuration fields are retained for
service compatibility but do not change the fixed argmax segmentation. A
replacement model must retain the expected 19-class output or update the
palette and post-processing code.
The runtime resizes input to 512 x 512, converts BGR to RGB, accepts NCHW or
NHWC 19-class output, restores the mask with nearest-neighbor interpolation,
and overlays the Cityscapes palette. Conversion sources are under
rknn_model_zoo/examples/ppseg in the upstream project.
Build locally
docker build -f docker/rk3576/ppseg.dockerfile \
-t rk3576-ppseg:local src/rk3576_ppseg
docker build -f docker/rk3588/ppseg.dockerfile \
-t rk3588-ppseg:local src/rk3588_ppsegInputs and Outputs
Input: image, video frame, or camera frame. Output: Cityscapes mask, class pixel counts, and overlay.