A compact deployment toolchain for running AADFlowNet dense optical flow on Rockchip RV1126B and RK3588. It supports ONNX export, RKNN conversion, PTQ/QAT/hybrid quantization, numerical comparison, and 1/2/5-stream inference.
This repository does not include pretrained weights, generated ONNX/RKNN models, datasets, or Rockchip SDK/runtime binaries. Supply your own AADFlowNet source, checkpoint, data, and compatible RKNN toolchain.
input image_pair: 1 x 6 x H x W, float32, NCHW
current BGR [0,1] + reference BGR [0,1]
output final_flow: 1 x 2 x H x W
flow_x + flow_y in model-grid pixels
See MODEL_CONTRACT.md (中文) for preprocessing, direction, and output-resizing rules.
Python 3.10 or newer is recommended.
python -m pip install -r requirements.txtInstall the Rockchip RKNN Toolkit on the conversion host and RKNN Lite/Runtime on the target board separately. On AArch64 boards, prefer the hardware-enabled OpenCV supplied by the BSP.
Obtain AADFlowNet separately. Put
it in AADFlowNet/ or pass its location with --aadflownet-root.
python srcs/export_onnx.py --aadflownet-root /work/AADFlowNet --checkpoint /path/to/aadflownet.pth --size 320 320 --name aadflownet_320x320_fp32Build a separate RKNN file for each target:
python srcs/rknn/convert.py --onnx build/onnx/aadflownet_320x320_fp32.onnx --target rk3588 --mode fp16Supported modes are fp16, int8-ptq, and int8-qat. PTQ, QAT, and
hybrid commands are documented in DEPLOYMENT.md
(中文).
python srcs/infer_1.py --model build/models/rk3588/aadflownet_320x320_fp32_fp16.rknn --backend rknn --platform rk3588 --sources 0 --showUse srcs/infer_2.py or srcs/infer_5.py for fixed stream counts, and
srcs/infer.py for a variable number of streams. Without --references,
each stream uses its own first frame as a fixed reference.
aadflow_edge/ model adapters, backends, preprocessing, and flow solver
srcs/ export, conversion, quantization, inference, and benchmark
configs/ example conversion and stream configurations
docs/ Chinese guide, model contract, and deployment guide
Generated files are written under the ignored build/ directory. Do not
commit checkpoints, models, datasets, vendor binaries, or local runtime files.
Project-owned source is released under the MIT License. AADFlowNet, datasets, checkpoints, Rockchip SDKs, runtimes, and other third-party components remain subject to their own licenses.