It's the Utility of Rockchip's RKNN C API on rk3588.
Written in Rust with FFI.
src/bindings.rs
was generated by
bindgen wrapper.h -o src/bindings.rs
This repo is actually a Rust port of the yolov8 example in rknn_model_zoo
To run it:
- Download yolov8n.onnx
git clone https://github.com/NessajCN/rkod.git
cd rkod/model
bash ./download_model.sh
- Convert onnx to rknn model following this instruction. Install any dependencies necessary.
cd python
python convert.py <onnx_model> <TARGET_PLATFORM> <dtype(optional)> <output_rknn_path(optional)>
# such as:
python convert.py ../model/yolov8n.onnx rk3588
-
Move
yolov8.rknn
inrkod/model
-
Fill
model/label_list.txt
with object name labels as you trained(one per line). Example could be found inmodel/coco_80_labels_list.txt
. -
Change the const
OBJ_CLASS_NUM
insrc/od.rs
to the total number of entries you put inmodel/labels_list.txt
. e.g.const OBJ_CLASS_NUM: i32 = 80;
if you adoptedmodel/coco_80_labels_list.txt
as the labels_list. -
To detect objects in a single image:
cargo run -- -m <model/path> -i <image/path>
- To continuously detect the rtsp stream:
cargo run -- -m <model/path> -i rtsp://<rtsp-stream-path>
Note: It is recommended to compile and install the Rockchip version of ffmpeg following this guild if you intend to detect an rtsp streaming.