RK3566, RK3568, RK3588, RK3562, RK1808, RV1109, RV1126
Repository: PaddleSeg
Download link:
Download with shell command:
cd model
./download_model.sh
Refer Paddle_2_ONNX.md
Usage:
cd python
python convert.py <onnx_model> <TARGET_PLATFORM> <dtype(optional)> <output_rknn_path(optional)>
# such as: python convert.py ../model/pp_liteseg_cityscapes.onnx rk3566
# output model will be saved as ../model/pp_liteseg.rknn
Description:
- <onnx_model> should be the ONNX model path.
- <TARGET_PLATFORM> could be specified as RK3562, RK3566, RK3568, RK3588, RK1808, RV1109, RV1126 according to board SOC version.
- <dtype> is optional, could be specified as
i8
,u8
orfp
,i8
/u8
means to do quantization,fp
means no to do quantization, default isi8
/u8
. - <output_rknn_path> is optional, used to specify the saving path of the RKNN model, default save path is
../model/pp_liteseg.rknn
Note: RK1808, RV1109, RV1126 does not support Android.
Modify the path of Android NDK in 'build-android.sh'.
For example,
ANDROID_NDK_PATH=~/opt/toolchain/android-ndk-r19c
Then, run this script:
./build-android.sh -t <TARGET_PLATFORM> -a arm64-v8a -d ppseg
Please use the specific platform instead of <TARGET_PLATFORM> above.
Connect the USB port to PC, then push all demo files to the board.
adb root
adb remount
adb push install/<TARGET_PLATFORM>_android_arm64-v8a/rknn_ppseg_demo/ /data/
adb shell
cd /data/rknn_ppseg_demo/
export LD_LIBRARY_PATH=./lib
./rknn_ppseg_demo model/pp_liteseg.rknn model/test.png
adb pull /data/rknn_ppseg_demo/result.png .
According to the target platform, modify the path of 'GCC_COMPILER' in 'build-linux.sh'.
export GCC_COMPILER=/opt/tools/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu
Then, run the script:
./build-linux.sh -t <TARGET_PLATFORM> -a aarch64 -d ppseg
Please use the specific platform instead of <TARGET_PLATFORM> above.
Push install/<TARGET_PLATFORM>_linux_aarch64/rknn_ppseg_demo to the board,
- If use adb via the EVB board:
adb push install/<TARGET_PLATFORM>_linux_aarch64/rknn_ppseg_demo /userdata/
- For other boards, use the scp or other different approaches to push all files under install/install/<TARGET_PLATFORM>_linux_aarch64/rknn_ppseg_demo to '/userdata'.
Please use the specific platform instead of <TARGET_PLATFORM> above.
adb shell
cd /userdata/rknn_ppseg_demo/
export LD_LIBRARY_PATH=./lib
./rknn_ppseg_demo model/pp_liteseg.rknn model/test.png
Note: Try searching the location of librga.so and add it to LD_LIBRARY_PATH if the librga.so is not found in the lib folder. Use the following command to add it to LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=./lib:<LOCATION_LIBRGA>
adb pull /data/rknn_ppseg_demo/result.png ./
- Note: Different platforms, different versions of tools and drivers may have slightly different results.