Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 3.1 KB

File metadata and controls

92 lines (64 loc) · 3.1 KB

Edge Inference 4 AADFlowNet

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.

Model interface

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.

Installation

Python 3.10 or newer is recommended.

python -m pip install -r requirements.txt

Install 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.

Quick start

1. Export ONNX

python srcs/export_onnx.py --aadflownet-root /work/AADFlowNet --checkpoint /path/to/aadflownet.pth --size 320 320 --name aadflownet_320x320_fp32

2. Convert for one target

Build a separate RKNN file for each target:

python srcs/rknn/convert.py --onnx build/onnx/aadflownet_320x320_fp32.onnx --target rk3588 --mode fp16

Supported modes are fp16, int8-ptq, and int8-qat. PTQ, QAT, and hybrid commands are documented in DEPLOYMENT.md (中文).

3. Run inference

python srcs/infer_1.py --model build/models/rk3588/aadflownet_320x320_fp32_fp16.rknn --backend rknn --platform rk3588 --sources 0 --show

Use 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.

Repository layout

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.

Documentation

License

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.