CV / RAFT-Stereo

RAFT-Stereo

RK3588 + RK1820 PCIe

RAFT-Stereo W8A8 inference on RK3588 + RK1820 PCIe.

6 downloads
Size
23.2 MiB model assets
Memory
Host RAM not profiled
Precision
INT8 W8A8

Choose the device you're using, the set up guide and documentation will update accordingly.

Getting Started

Armbian 26.8.7 Gnome or newer with OTA overlayroot: Configure Docker storage before running containers to avoid overlay mount errors.

Deploy
sudo docker run --rm --name rv182x-rk3588-raft-stereo \
  --privileged --net=host --ipc=host --stop-timeout 300 \
  -v /run/lock:/run/lock \
  -v /lib/modules:/lib/modules:ro \
  -v /usr/src:/usr/src:ro \
  -e PYTHONUNBUFFERED=1 \
  -e RKNN_LOG_LEVEL=0 \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest \
  python3 web_detection.py --variant raftstereo-eth3d-160x240

REST API

Use the REST API to run inference. Copy the commands below.

Curl
curl -X POST "http://<BOARD_IP>:8000/api/models/raft-stereo/predict" \
  -F "left=@left.jpg" -F "right=@right.jpg"
Python
import requests

with open("left.jpg", "rb") as left, open("right.jpg", "rb") as right:
    response = requests.post(
        "http://<BOARD_IP>:8000/api/models/raft-stereo/predict",
        files={"left": left, "right": right}, timeout=120,
    )
response.raise_for_status()
print(response.json())

Model Details

Armbian 26.8.7 Gnome or newer with OTA overlayroot: Configure Docker storage before running containers to avoid overlay mount errors.

RAFT-Stereo on RK3588 + RK1820 PCIe

Stereo disparity from rectified left/right images; output is not distance in metres.

Platform: RK3588 + RK1820 PCIe; Engine: RKNN3. Docker on ARM64; SDK 1.1.0. Verified kernel: 6.1.172-vendor-seeed-rk3588.

Run

Stop the previous model first. The image prepares the driver/proxy and checks inference; firmware writes are disabled by default.

1. Pull

bash
sudo docker pull ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest

2. Start

Choose Size to update the Getting Started command, or use the matching command below.

raftstereo-eth3d-160x240

bash
sudo docker run --rm --name rv182x-rk3588-raft-stereo \
  --privileged --net=host --ipc=host --stop-timeout 300 \
  -v /run/lock:/run/lock \
  -v /lib/modules:/lib/modules:ro \
  -v /usr/src:/usr/src:ro \
  -e PYTHONUNBUFFERED=1 \
  -e RKNN_LOG_LEVEL=0 \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest \
  python3 web_detection.py --variant raftstereo-eth3d-160x240

raftstereo-middlebury-160x240

bash
sudo docker run --rm --name rv182x-rk3588-raft-stereo \
  --privileged --net=host --ipc=host --stop-timeout 300 \
  -v /run/lock:/run/lock \
  -v /lib/modules:/lib/modules:ro \
  -v /usr/src:/usr/src:ro \
  -e PYTHONUNBUFFERED=1 \
  -e RKNN_LOG_LEVEL=0 \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest \
  python3 web_detection.py --variant raftstereo-middlebury-160x240

raftstereo-sceneflow-160x240

bash
sudo docker run --rm --name rv182x-rk3588-raft-stereo \
  --privileged --net=host --ipc=host --stop-timeout 300 \
  -v /run/lock:/run/lock \
  -v /lib/modules:/lib/modules:ro \
  -v /usr/src:/usr/src:ro \
  -e PYTHONUNBUFFERED=1 \
  -e RKNN_LOG_LEVEL=0 \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest \
  python3 web_detection.py --variant raftstereo-sceneflow-160x240

raftstereo-realtime-160x240

bash
sudo docker run --rm --name rv182x-rk3588-raft-stereo \
  --privileged --net=host --ipc=host --stop-timeout 300 \
  -v /run/lock:/run/lock \
  -v /lib/modules:/lib/modules:ro \
  -v /usr/src:/usr/src:ro \
  -e PYTHONUNBUFFERED=1 \
  -e RKNN_LOG_LEVEL=0 \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest \
  python3 web_detection.py --variant raftstereo-realtime-160x240

Open http://<BOARD_IP>:8000; API parameters: /docs.

Command options

Docker options go before the image name; model/input options go after web_detection.py.

OptionPurpose
--privilegedLoad the host PCIe driver and open the card.
--net=host --ipc=hostShare the network/IPC used by the RKNN3 proxy. No -p mapping needed.
-v /run/lock:/run/lockPrevent concurrent managed models from using the card.
-v /lib/modules:/lib/modules:ro and -v /usr/src:/usr/src:roRead matching vendor headers for driver builds on other kernels; do not install headers.
--stop-timeout 300Allow shutdown time, including explicit firmware maintenance.
PYTHONUNBUFFERED=1 / RKNN_LOG_LEVEL=0Immediate Python logs / documented RKNN log level.
-v "$PWD/workspace:/app/workspace"Optional: retain uploads/results after container removal. No project directory required.
--variant / --core_mask 0x1Model checkpoint / RK1820 core mask used for benchmarking.
Model filesPartitions are selected automatically by --variant; keep the image assets together.

Use the bundled sample or upload both rectified, same-size left/right images. This project has no single-video or camera input. The export runs one iteration.

Predict

bash
curl -X POST "http://<BOARD_IP>:8000/api/models/raft-stereo/predict" \
  -F "left=@left.jpg" -F "right=@right.jpg"

Troubleshooting

Use the following variables for the commands in this section:

bash
CONTAINER=rv182x-rk3588-raft-stereo
IMAGE=ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest

1. Read logs and check the card

For debugging, remove --rm from the start command so the exited container/logs remain. Otherwise save its foreground terminal output.

bash
sudo docker logs --tail 100 "$CONTAINER"
uname -r
lspci -nn -d 1d87:182a
sudo docker run --rm --privileged --net=host --ipc=host \
  ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-runtime:1.1.0 doctor

doctor only checks status; it does not load drivers, start proxy or flash. Normal model startup prepares missing components. Success: SELF_TEST_PASSED, MODEL_START_READY, then:

bash
curl -f http://127.0.0.1:8000/api/health

2. Match the error and fix it

ErrorCommand / fix
DEVICE_BUSY, container name conflict, port 8000 in usesudo docker stop "$CONTAINER" for this demo, or stop the identified competing demo. Save results, then sudo docker rm "$CONTAINER" if an exited container was retained. Run again.
PCI_DEVICE_NOT_FOUNDlspci -nn -d 1d87:182a; if absent, check card power, seating and host PCIe configuration.
KERNEL_HEADERS_MISSING, DRIVER_BUILD_FAILED, DRIVER_LOAD_FAILEDls -l /lib/modules/"$(uname -r)"/build; install headers/toolchain matching that exact vendor kernel and keep both read-only mounts. Never force-load another kernel's module.
ROOT_REQUIRED, DEVICE_PERMISSION_DENIED, LOCAL_LOCK_ONLYRestore sudo, --privileged and the /run/lock mount from the start command.
No RKNN devices found, RKNN3_ERR_DEVICE_UNAVAILABLE, PROXY_START_FAILEDRun doctor above. Pull the current image and recreate with the full start command, including host network/IPC. Keep the image's default entrypoint.
CARD_OFFLINECheck doctor, PCIe/power and SDK 1.1.0 compatibility; use the explicit M.2 maintenance step below only after confirming the hardware.
SELF_TEST_FAILED, CARD_HEALTH_ERROR, CARD_STATUS_UNKNOWN, CARD_STATUS_QUERY_FAILEDRead the detailed log. Restore matching SDK/firmware and stop competing card users; these errors do not trigger firmware recovery.
ASSET_CHECKSUM_FAILED, DRIVER_CHECKSUM_FAILED, No RKNN3 library foundsudo docker pull "$IMAGE"; remove custom runtime/library mounts and recreate from the complete image.
Missing model/weight or model load failureUse the command for the selected size; keep .rknn and .weight paired. Multi-partition projects select their files automatically.
Missing right image / input size errorSupply both left and right, with matching dimensions. Remove camera/video options.
no space left on device, overlay mount errordf -h /var/lib/docker; configure writable ext4 Docker/containerd storage using the link below.

After pulling, recreate the container; docker restart keeps its old image. Optional API warnings and SMI exit code 251 need no repair when the self-test and health checks pass.

3. Offline M.2 firmware recovery — explicit maintenance

Confirm RK1820 M.2, stop all inference and external proxies. Keep /run/lock and the 300-second timeout. Insert before the image name:

text
-e RK182X_ALLOW_FIRMWARE_RECOVERY=1 \
-e RK182X_BOARD=ext-m2 \

One recovery attempt only; remove these options afterward. Do not interrupt power or forcibly kill the write.

Recovery errorFix
BOARD_CONFIRMATION_REQUIREDConfirm the physical M.2 board before setting RK182X_BOARD=ext-m2.
RECOVERY_LOCK_REQUIREDRestore -v /run/lock:/run/lock.
EXTERNAL_PROXY_ACTIVEStop the known external proxy/service and legacy inference users before recovery. Ordinary inference can reuse the proxy.
FIRMWARE_RECOVERY_FAILED, CARD_OFFLINE_AFTER_RECOVERYSave the upgrade log; resolve power/PCIe/firmware errors before another manual attempt.

Measured benchmark

RK3588 + RK1820 M.2, SDK/Lite 1.1.0, core 0x1; 5 warmups + 30 measured frames/pairs.

  • Runtime FPS: synchronous RKNN3 calls, including PCIe transfer.
  • Pipeline FPS: decoding through rendering/JPEG, excluding HTTP and source pacing.
ModelInput H×WRuntime FPSPipeline FPSRuntime p95 msEvidence
raftstereo-eth3d-160x240160×240 × 24.751.84211.66JSON
raftstereo-middlebury-160x240160×240 × 24.761.87210.81JSON
raftstereo-sceneflow-160x240160×240 × 24.771.86210.28JSON
raftstereo-realtime-160x240160×240 × 216.482.5661.58JSON

RAFT FPS counts stereo pairs at one iteration.

These are the previous measurements; this shared-runtime release revalidated only YOLOv5n. Startup/self-test time is excluded.

Project README · Full runtime troubleshooting · Armbian Docker storage

Inputs and Outputs

Estimates dense disparity from synchronized, rectified left/right images of the same scene. It requires a genuine stereo pair; two arbitrary frames from a monocular traffic video are not a stereo pair. Current output is disparity, without metric-distance conversion.