This repository demonstrates the full offline deployment workflow of YOLOv8 for warehouse box detection on an RK3576 + RK1820 edge AI platform, together with a runnable Web demo for image upload, RK1820 inference, and result visualization.
Note: the repository includes sample
RKNNmodel artifacts and weight files inmodel/for easier offline deployment and reproducibility.
model/best.rknn: RKNN model filebest.weight: weight file loaded by RKNN3Lite
server/: FastAPI backend for RK1820 inference and the Web UImain.py: main entry point with home page,/detectAPI, and static file mountingdetector.py: RKNN3Lite inference wrapper withtarget="rk1820"static/result/: output directory for visualized inference results
examples/: sample input imagesresult/: sample output images, includingtest_result.jpg
See requirements.txt:
pip install -r requirements.txt
server/detector.py attempts to add the site-packages directory under server/../rknn3_env into sys.path in order to load:
rknn3lite.api.rknn3_lite.RKNN3Lite
You can therefore prepare a Python runtime with a similar layout based on your device environment, for example by placing the Rockchip runtime packages under rknn3_env.
Below is a typical offline deployment path. The exact commands may vary depending on your training codebase and RKNN Toolkit version:
- Train or fine-tune YOLOv8 to obtain
best.pt - Export to ONNX:
yolo export model=best.pt format=onnx imgsz=640 - Convert the ONNX model to RKNN using RKNN Toolkit / RKNN3 tools, and generate any required runtime weight or auxiliary files
- Place the generated artifacts under
model/and verify the paths inserver/detector.py:MODEL = "../model/best.rknn"WEIGHT = "../model/best.weight"
After installing the required Python packages and RKNN3Lite runtime on the target device, run the following command from the repository root:
python -m uvicorn server.main:app --host 0.0.0.0 --port 8000
Then open the following URL in your browser:
http://<device-ip>:8000/
Upload an image on the page and click the detection button. The backend will run inference on RK1820 and return both the object count and the visualized result image.
Input example: examples/test.jpg
Output example: result/test_result.jpg
The image below shows the offline inference visualization bundled with this repository:
MIT License. See LICENSE for details.
