CV / RAFT-Stereo
RAFT-Stereo
RK3588 + RK1820 PCIe
RAFT-Stereo W8A8 inference on RK3588 + RK1820 PCIe.
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.
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-160x240REST API
Use the REST API to run inference. Copy the commands below.
curl -X POST "http://<BOARD_IP>:8000/api/models/raft-stereo/predict" \
-F "left=@left.jpg" -F "right=@right.jpg"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
sudo docker pull ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest2. Start
Choose Size to update the Getting Started command, or use the matching command below.
raftstereo-eth3d-160x240
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-160x240raftstereo-middlebury-160x240
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-160x240raftstereo-sceneflow-160x240
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-160x240raftstereo-realtime-160x240
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-160x240Open http://<BOARD_IP>:8000; API parameters: /docs.
Command options
Docker options go before the image name; model/input options go after web_detection.py.
| Option | Purpose |
|---|---|
--privileged | Load the host PCIe driver and open the card. |
--net=host --ipc=host | Share the network/IPC used by the RKNN3 proxy. No -p mapping needed. |
-v /run/lock:/run/lock | Prevent concurrent managed models from using the card. |
-v /lib/modules:/lib/modules:ro and -v /usr/src:/usr/src:ro | Read matching vendor headers for driver builds on other kernels; do not install headers. |
--stop-timeout 300 | Allow shutdown time, including explicit firmware maintenance. |
PYTHONUNBUFFERED=1 / RKNN_LOG_LEVEL=0 | Immediate 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 0x1 | Model checkpoint / RK1820 core mask used for benchmarking. |
| Model files | Partitions 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
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:
CONTAINER=rv182x-rk3588-raft-stereo
IMAGE=ghcr.io/seeed-projects/recomputer-rk-cv/rv182x-rk3588-raft-stereo:latest1. 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.
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 doctordoctor 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:
curl -f http://127.0.0.1:8000/api/health2. Match the error and fix it
| Error | Command / fix |
|---|---|
DEVICE_BUSY, container name conflict, port 8000 in use | sudo 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_FOUND | lspci -nn -d 1d87:182a; if absent, check card power, seating and host PCIe configuration. |
KERNEL_HEADERS_MISSING, DRIVER_BUILD_FAILED, DRIVER_LOAD_FAILED | ls -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_ONLY | Restore sudo, --privileged and the /run/lock mount from the start command. |
No RKNN devices found, RKNN3_ERR_DEVICE_UNAVAILABLE, PROXY_START_FAILED | Run doctor above. Pull the current image and recreate with the full start command, including host network/IPC. Keep the image's default entrypoint. |
CARD_OFFLINE | Check 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_FAILED | Read 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 found | sudo docker pull "$IMAGE"; remove custom runtime/library mounts and recreate from the complete image. |
| Missing model/weight or model load failure | Use the command for the selected size; keep .rknn and .weight paired. Multi-partition projects select their files automatically. |
| Missing right image / input size error | Supply both left and right, with matching dimensions. Remove camera/video options. |
no space left on device, overlay mount error | df -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:
-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 error | Fix |
|---|---|
BOARD_CONFIRMATION_REQUIRED | Confirm the physical M.2 board before setting RK182X_BOARD=ext-m2. |
RECOVERY_LOCK_REQUIRED | Restore -v /run/lock:/run/lock. |
EXTERNAL_PROXY_ACTIVE | Stop the known external proxy/service and legacy inference users before recovery. Ordinary inference can reuse the proxy. |
FIRMWARE_RECOVERY_FAILED, CARD_OFFLINE_AFTER_RECOVERY | Save 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.
| Model | Input H×W | Runtime FPS | Pipeline FPS | Runtime p95 ms | Evidence |
|---|---|---|---|---|---|
| raftstereo-eth3d-160x240 | 160×240 × 2 | 4.75 | 1.84 | 211.66 | JSON |
| raftstereo-middlebury-160x240 | 160×240 × 2 | 4.76 | 1.87 | 210.81 | JSON |
| raftstereo-sceneflow-160x240 | 160×240 × 2 | 4.77 | 1.86 | 210.28 | JSON |
| raftstereo-realtime-160x240 | 160×240 × 2 | 16.48 | 2.56 | 61.58 | JSON |
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.