- Table of contents
- 1. Description
- 2. Current Support Platform
- 3. Pretrained Model
- 4. Convert to RKNN
- 5. Python Demo
- 6. Android Demo
- 7. Linux Demo
- 8. Expected Results
The model used in this example comes from the following open source projects:
https://github.com/sirius-ai/LPRNet_Pytorch/
RK3566, RK3588, RK3568, RK3562, RK1808, RV1109, RV1126
Download link:
Download with shell command:
cd model
./download_model.sh
Usage:
cd python
python convert.py <onnx_model> <TARGET_PLATFORM> <dtype(optional)> <output_rknn_path(optional)>
# such as: python convert.py ../model/lprnet.onnx rk3588
# output model will be saved as ../model/lprnet.rknn
Description:
<onnx_model>
: Specify ONNX model path.<TARGET_PLATFORM>
: Specify NPU platform name. Support Platform refer [here](#2 Current Support Platform).<dtype>(optional)
: Specify asi8
,u8
orfp
,i8
/u8
means to do quantization,fp
means no to do quantization, default isi8
/u8
.<output_rknn_path>(optional)
: Specify save path for the RKNN model, default save in the same directory as ONNX model with namelprnet.rknn
Usage:
cd python
# Inference with RKNN model
python lprnet.py --model_path <rknn_model> --target <TARGET_PLATFORM>
Description:
- <TARGET_PLATFORM>: Specified as the NPU platform name. Such as 'rk3588'.
- <rknn_model>: Specified as the model path.
The expected results are as follows:
车牌识别结果: 湘F6CL03
Note: RK1808, RV1109, RV1126 does not support Android.
Please refer to the Compilation_Environment_Setup_Guide document to setup a cross-compilation environment and complete the compilation of C/C++ Demo.
With device connected via USB port, push demo files to devices:
adb root
adb push install/<TARGET_PLATFORM>_android_<ARCH>/rknn_LPRNet_demo/ /data/
adb shell
cd /data/rknn_LPRNet_demo
export LD_LIBRARY_PATH=./lib
./rknn_lprnet_demo model/lprnet.rknn model/test.jpg
Please refer to the Compilation_Environment_Setup_Guide document to setup a cross-compilation environment and complete the compilation of C/C++ Demo.
Push install/<TARGET_PLATFORM>_linux_<ARCH>
to the board:
-
If use adb via the EVB board:
With device connected via USB port, push demo files to devices:
adb push install/<TARGET_PLATFORM>_linux_<ARCH>/rknn_LPRNet_demo/ /userdata/
-
For other boards, use the scp or other different approaches to push all files under
install/<TARGET_PLATFORM>_linux_<ARCH>
to /userdata
Please use the specific platform instead of <TARGET_PLATFORM> above.
adb shell
cd /userdata/rknn_LPRNet_demo
export LD_LIBRARY_PATH=./lib
./rknn_lprnet_demo model/lprnet.rknn model/test.jpg
This example will print the recognition result of license plate, as follows:
车牌识别结果: 湘F6CL03
- Note: Different platforms, different versions of tools and drivers may have slightly different results.