跳到主要内容

LPRNet

环境配置

信息

参考 RKNN 安装 配置好相关环境。

参考 RKNN Model Zoo 下载示例文件。

模型下载

下载 onnx 模型文件。

X64 Linux PC
cd rknn_model_zoo/examples/LPRNet/model/
bash download_model.sh

模型转换

选择目标平台。

X64 Linux PC
export TARGET_PLATFORM=rk3576

将 onnx 模型转换为 rknn 模型。

X64 Linux PC
cd ../python/
python convert.py ../model/lprnet.onnx ${TARGET_PLATFORM}

C API

编译示例

切换到 rknn_model_zoo 目录下执行 build-linux.sh 编译脚本。

X64 Linux PC
cd ../../..
bash build-linux.sh -t ${TARGET_PLATFORM} -a aarch64 -d LPRNet

文件同步

然后将编译生成的 install 目录下的 demo 目录推送到板端。

X64 Linux PC
cd install/${TARGET_PLATFORM}_linux_aarch64/
scp -r rknn_lprnet_demo/ user@your_device_ip:target_directory

运行示例

导出运行时库到环境变量。

Device
cd rknn_lprnet_demo/
export LD_LIBRARY_PATH=./lib

运行示例。

Device
./rknn_lprnet_demo ./model/lprnet.rknn ./model/test.jpg
$ ./rknn_lprnet_demo ./model/lprnet.rknn ./model/test.jpg
model input num: 1, output num: 1
input tensors:
index=0, name=input, n_dims=4, dims=[1, 24, 94, 3], n_elems=6768, size=6768, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=0, scale=0.007843
output tensors:
index=0, name=output, n_dims=3, dims=[1, 68, 18], n_elems=1224, size=1224, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=50, scale=0.643529
model is NHWC input fmt
model input height=24, width=94, channel=3
origin size=94x24 crop size=80x16
input image: 94 x 24, subsampling: 4:2:0, colorspace: YCbCr, orientation: 1
rknn_run
车牌识别结果: 湘F6CL03

测试图片

Python API

激活虚拟环境

Device
conda activate rknn

运行示例

将相关文件推送到板端执行下面的命令。

Device
python lprnet.py --model_path ../model/lprnet.rknn --target ${TARGET_PLATFORM}
$ python lprnet.py --model_path ../model/lprnet.rknn --target rk3588
/home/radxa/miniforge3/envs/rknn/lib/python3.12/site-packages/rknn/api/rknn.py:51: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
self.rknn_base = RKNNBase(cur_path, verbose)
I rknn-toolkit2 version: 2.3.2
done
rk3588
--> Init runtime environment
I target set by user is: rk3588
done
--> Running model
W inference: The 'data_format' is not set, and its default value is 'nhwc'!
--> PostProcess
车牌识别结果: 湘F6CL03

    您需要登录 GitHub 才能发表评论。如果您已登录,请忽略此消息。

    Radxa-docs © 2026 by Radxa Computer (Shenzhen) Co.,Ltd. is licensed under CC BY 4.0