Ubuntu 20.04 LTS 在3588安卓主板上测试yolov8-1.0版本的yolov8n-seg模型

0. 创建虚拟环境

#!< 创建虚拟环境yolov8
$ sudo pip install virtualenv
$ sudo pip install virtualenvwrapper
$ mkvirtualenv yolov8 -p /usr/bin/python3.8

1. 将yolov8n-seg.pt转换为yolov8n-seg.onnx文件

#!< 创建项目目录yolov8-rknn并下载yolov8n-seg.pt模型文件
(yolov8) $ mkdir -p /home/tianzx/Github/yolov8-rknn/epbox/model/
(yolov8) $ cd /home/tianzx/Github/yolov8-rknn/epbox/model/
(yolov8) $ wget https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n-seg.pt

#!< 将yolov8n-seg.pt转换为yolov8n-seg.onnx
(yolov8) $ cd /home/tianzx/Github/yolov8-rknn/
(yolov8) $ git clone https://github.com/airockchip/ultralytics_yolov8.git
(yolov8) $ cd ultralytics_yolov8
(yolov8) $ vi ./ultralytics/cfg/default.yaml
model: /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.pt # (str, optional) path to model file, i.e. yolov8n.pt, yolov8n.yaml
(yolov8) $ export PYTHONPATH=./
(yolov8) $ python ./ultralytics/engine/exporter.py
......
Ultralytics YOLOv8.0.151 🚀 Python-3.8.10 torch-2.1.0+cu121 CPU ()
YOLOv8n-seg summary (fused): 195 layers, 3404320 parameters, 0 gradients, 12.6 GFLOPs

PyTorch: starting from '/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.pt' with input shape (16, 3, 640, 640) BCHW and output shape(s) ((16, 64, 80, 80), (16, 80, 80, 80), (16, 1, 80, 80), (16, 32, 80, 80), (16, 64, 40, 40), (16, 80, 40, 40), (16, 1, 40, 40), (16, 32, 40, 40), (16, 64, 20, 20), (16, 80, 20, 20), (16, 1, 20, 20), (16, 32, 20, 20), (16, 32, 160, 160)) (6.7 MB)

RKNN: starting export with torch 2.1.0+cu121...

RKNN: feed /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx to RKNN-Toolkit or RKNN-Toolkit2 to generate RKNN model.
Refer https://github.com/airockchip/rknn_model_zoo/tree/main/models/CV/object_detection/yolo
RKNN: export success ✅ 0.3s, saved as '/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx' (13.0 MB)

Export complete (2.2s)
Results saved to /home/tianzx/Github/yolov8_rknn/epbox/model
Predict:         yolo predict task=segment model=/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx imgsz=640 
Validate:        yolo val task=segment model=/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx imgsz=640 data=coco.yaml 
Visualize:       https://netron.app

2. 将yolov8n-seg.onnx转换为yolov8n-seg-3588.rknn

# 安装rknn-toolkit2
(yolov8) $ cd  /home/tianzx/Github/yolov8_rknn/
(yolov8) $ git clone https://github.com/airockchip/rknn-toolkit2.git --depth 1
(yolov8) $ cd rknn-toolkit2/rknn-toolkit2/
(yolov8) $ pip install -r packages/requirements_cp38-2.0.0b0.txt
(yolov8) $ pip install packages/rknn_toolkit2-2.0.0b0+9bab5682-cp38-cp38-linux_x86_64.whl

#!< 3588 主板 只能使用v1.6.0版本  ☆☆☆☆☆ 
(yolov8) $ cd /home/tianzx/Github/yolov8_rknn
(yolov8) $ git clone -b v1.6.0 --depth=1 https://github.com/airockchip/rknn_model_zoo.git
(yolov8) $ cd rknn_model_zoo/examples/yolov8_seg/python
(yolov8) $ python convert.py /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx rk3588 i8 /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg-3588.rknn
I rknn-toolkit2 version: 2.0.0b0+9bab5682
--> Config model
done
--> Loading model
I It is recommended onnx opset 19, but your onnx model opset is 12!
I Model converted from pytorch, 'opset_version' should be set 19 in torch.onnx.export for successful convert!
I Loading : 100%|██████████████████████████████████████████████| 162/162 [00:00<00:00, 50331.65it/s]
done
--> Building model
W build: found outlier value, this may affect quantization accuracy
                        const name                        abs_mean    abs_std     outlier value
                        model.22.cv3.1.1.conv.weight      0.12        0.18        -12.310     
I GraphPreparing : 100%|████████████████████████████████████████| 183/183 [00:00<00:00, 8442.40it/s]
I Quantizating : 100%|████████████████████████████████████████████| 183/183 [00:05<00:00, 35.36it/s]
W build: The default input dtype of 'images' is changed from 'float32' to 'int8' in rknn model for performance!
                       Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '375' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of 'onnx::ReduceSum_383' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '388' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '354' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '395' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of 'onnx::ReduceSum_403' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '407' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '361' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '414' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of 'onnx::ReduceSum_422' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '426' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '368' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '347' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
I rknn building ...
I rknn buiding done.
done
--> Export rknn model
--> The RKNN model saved in: /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg-3588.rknn
done

3. 测试onnx模型和rknn模型

3.1 测试onnx模型

(yolov8) $ cd /home/tianzx/Github/yolov8_rknn/
(yolov8) $ cd rknn_model_zoo/examples/yolov8_seg/python/
(yolov8) $ python yolov8_seg.py --model_path /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx --img_show                     
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/py_utils/onnx_executor.py:12: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  if getattr(np, 'bool', False):
Model-/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg.onnx is onnx model, starting val
infer 1/1

IMG: bus.jpg
person @ (209 241 285 510) 0.867
bus  @ (95 137 558 440) 0.867
person @ (109 235 224 535) 0.842
person @ (476 232 560 520) 0.801

yolov8n-seg.onnx-detect

3.2 测试rknn模型

3588安卓主板如果要调用rknn模型,需要更新3588安卓主板内的 rknn_server 和 librknnrt.so 文件。

(yolov8) $ cd /home/tianzx/Github/yolov8_rknn/
(yolov8) $ cd rknn-toolkit2/rknpu2/
# 切换到 root 用户权限
(yolov8) $ adb root
# 挂载文件系统为可读写模式
(yolov8) $ adb remount
(yolov8) $ adb shell
rk3588_s:/ # cd /vendor/bin/
# 我这边3588安卓主板的rknn_server 和 librknnrt.so 均是1.5.0版本, arm64架构
rk3588_s:/ # cp rknn_server rknn_server.1.5.0
rk3588_s:/ # cd ../lib64
rk3588_s:/ # cp librknnrt.so librknnrt.so.1.5.0
rk3588_s:/ # exit
(yolov8) $ adb push runtime/Android/rknn_server/arm64/rknn_server /vendor/bin/
runtime/Android/rknn_server/arm64/rknn_server: 1 file pushed, 0 skipped. 227.7 MB/s (895216 bytes in 0.004s)
(yolov8) $ adb push runtime/Android/librknn_api/arm64-v8a/librknnrt.so /vendor/lib64/
runtime/Android/librknn_api/arm64-v8a/librknnrt.so: 1 file pushed, 0 skipped. 465.1 MB/s (7366800 bytes in 0.015s)
(yolov8) $ adb shell
rk3588_s:/ # chmod +x /vendor/bin/rknn_server
rk3588_s:/ # su
rk3588_s:/ # setenforce 0
rk3588_s:/ # /vendor/bin/rknn_server &                                                                                                                                                                             
[1] 3895
rk3588_s:/ # start rknn server, version:2.0.0b0 (18eacd0 build@2024-03-22T14:07:01)
rk3588_s:/ # exit
(yolov8) $ cd ~/Github/yolov8_rknn/rknn_model_zoo/examples/yolov8_seg/python
(yolov8) $ python yolov8_seg.py --model_path /home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg-3588.rknn --target rk3588 --img_show                            
I rknn-toolkit2 version: 2.0.0b0+9bab5682
--> Init runtime environment
adbd is already running as root
I target set by user is: rk3588
I Get hardware info: target_platform = rk3588, os = Android, aarch = aarch64
I Check RK3588 board npu runtime version
I Starting ntp or adb, target is RK3588
I Start adb...
I Connect to Device success!
I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36)
D RKNNAPI: ==============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI:   API: 2.0.0b0 (18eacd0 build@2024-03-22T06:07:59)
D RKNNAPI:   DRV: rknn_server: 2.0.0b0 (18eacd0 build@2024-03-22T14:07:01)
D RKNNAPI:   DRV: rknnrt: 2.0.0b0 (35a6907d79@2024-03-24T10:30:08)
D RKNNAPI: ==============================================
D RKNNAPI: Input tensors:
D RKNNAPI:   index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=1228800, w_stride = 0, size_with_stride = 0, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
D RKNNAPI: Output tensors:
D RKNNAPI:   index=0, name=375, n_dims=4, dims=[1, 64, 80, 80], n_elems=409600, size=409600, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-55, scale=0.138304
D RKNNAPI:   index=1, name=onnx::ReduceSum_383, n_dims=4, dims=[1, 80, 80, 80], n_elems=512000, size=512000, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.002873
D RKNNAPI:   index=2, name=388, n_dims=4, dims=[1, 1, 80, 80], n_elems=6400, size=6400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003169
D RKNNAPI:   index=3, name=354, n_dims=4, dims=[1, 32, 80, 80], n_elems=204800, size=204800, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=26, scale=0.023277
D RKNNAPI:   index=4, name=395, n_dims=4, dims=[1, 64, 40, 40], n_elems=102400, size=102400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-40, scale=0.095424
D RKNNAPI:   index=5, name=onnx::ReduceSum_403, n_dims=4, dims=[1, 80, 40, 40], n_elems=128000, size=128000, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003418
D RKNNAPI:   index=6, name=407, n_dims=4, dims=[1, 1, 40, 40], n_elems=1600, size=1600, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
D RKNNAPI:   index=7, name=361, n_dims=4, dims=[1, 32, 40, 40], n_elems=51200, size=51200, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=32, scale=0.020263
D RKNNAPI:   index=8, name=414, n_dims=4, dims=[1, 64, 20, 20], n_elems=25600, size=25600, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-43, scale=0.075364
D RKNNAPI:   index=9, name=onnx::ReduceSum_422, n_dims=4, dims=[1, 80, 20, 20], n_elems=32000, size=32000, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003874
D RKNNAPI:   index=10, name=426, n_dims=4, dims=[1, 1, 20, 20], n_elems=400, size=400, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
D RKNNAPI:   index=11, name=368, n_dims=4, dims=[1, 32, 20, 20], n_elems=12800, size=12800, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=26, scale=0.022538
D RKNNAPI:   index=12, name=347, n_dims=4, dims=[1, 32, 160, 160], n_elems=819200, size=819200, w_stride = 0, size_with_stride = 0, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-119, scale=0.029378
done
Model-/home/tianzx/Github/yolov8_rknn/epbox/model/yolov8n-seg-3588.rknn is rknn model, starting val
W inference: The 'data_format' is not set, and its default value is 'nhwc'!


IMG: bus.jpg
person @ (209 240 285 509) 0.868
bus  @ (94 137 557 439) 0.841
person @ (108 235 221 536) 0.829
person @ (475 233 560 521) 0.783

yolov8n-seg-3588.rknn-detect
查看3588安卓主板的基本信息,这里需要用到 adb 命令,需要自行安装,比如我这边系统的adb路径为: /home/tianzx/Android/Sdk/platform-tools/adb

(yolov8) $ cd /home/tianzx/Github/yolov8_rknn/
#!< 安卓主板返回数字
(yolov8) $ adb shell getprop ro.build.version.release
12
#!< 如果板端是 Android 系统,可以在计算机端执行以下命令查询系统架构:
# 该命令的输出信息参考如下,其中 arm64-v8a 表示 ARM 64 位架构、第八版本的 ABI。
(yolov8) $ adb shell getprop ro.product.cpu.abi 
arm64-v8a
#!< 查看RKNPU2驱动版本信息
# rknpu 0.8.8 20230428
(yolov8) $ adb shell
rk3588_s:/ # dmesg | grep -i rknpu
[    4.875203] RKNPU fdab0000.npu: Adding to iommu group 0
[    4.875369] RKNPU fdab0000.npu: RKNPU: rknpu iommu is enabled, using iommu mode
[    4.876734] RKNPU fdab0000.npu: can't request region for resource [mem 0xfdab0000-0xfdabffff]
[    4.876759] RKNPU fdab0000.npu: can't request region for resource [mem 0xfdac0000-0xfdacffff]
[    4.876777] RKNPU fdab0000.npu: can't request region for resource [mem 0xfdad0000-0xfdadffff]
[    4.877338] [drm] Initialized rknpu 0.8.8 20230428 for fdab0000.npu on minor 1
[    4.881011] RKNPU fdab0000.npu: RKNPU: bin=0
[    4.881195] RKNPU fdab0000.npu: leakage=8
[    4.881248] debugfs: Directory 'fdab0000.npu-rknpu' with parent 'vdd_npu_s0' already present!
[    4.889245] RKNPU fdab0000.npu: pvtm=855
[    4.894164] RKNPU fdab0000.npu: pvtm-volt-sel=2
[    4.895645] RKNPU fdab0000.npu: avs=0
[    4.895857] RKNPU fdab0000.npu: l=10000 h=85000 hyst=5000 l_limit=0 h_limit=800000000 h_table=0
[    4.907412] RKNPU fdab0000.npu: failed to find power_model node
[    4.907459] RKNPU fdab0000.npu: RKNPU: failed to initialize power model
[    4.907473] RKNPU fdab0000.npu: RKNPU: failed to get dynamic-coefficient
#!< 启动rknn_server服务
rk3588_s:/ # su
rk3588_s:/ # setenforce 0
rk3588_s:/ # /vendor/bin/rknn_server &
# 可以看到rknn_server已经更新版本为 2.0.0b0
rk3588_s:/ # start rknn server, version:2.0.0b0 (18eacd0 build@2024-03-22T14:07:01)
# 查询 librknnrt.so 库版本
# 64 位系统 [已更新64位librknnrt.so文件,版本信息为2.0.0b0
rk3588_s:/ # strings /vendor/lib64/librknnrt.so | grep -i "librknnrt version"
librknnrt version: 2.0.0b0 (35a6907d79@2024-03-24T10:30:08)
# 32 位系统 [未更新32位librknnrt.so文件,版本信息为1.5.0]
rk3588_s:/ # strings /vendor/lib/librknnrt.so | grep -i "librknnrt version"
librknnrt version: 1.5.0 (e6fe0c678@2023-05-25T08:09:02)

4. 3588安卓主板apk测试

(yolov8) $ cd /home/tianzx/Github/yolov8_rknn/rknn_model_zoo
#!< https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
(yolov8) $ export ANDROID_NDK_PATH=/home/tianzx/Android/Sdk/ndk/android-ndk-r19c/
(yolov8) $ chmod +x build-android.sh
(yolov8) $ ./build-android.sh -t rk3588 -a arm64-v8a -d yolov8_seg
===================================
BUILD_DEMO_NAME=yolov8_seg
BUILD_DEMO_PATH=examples/yolov8_seg/cpp
TARGET_SOC=rk3588
TARGET_ARCH=arm64-v8a
BUILD_TYPE=Release
ENABLE_ASAN=OFF
INSTALL_DIR=/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo
BUILD_DIR=/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/build/build_rknn_yolov8_seg_demo_rk3588_android_arm64-v8a_Release
ANDROID_NDK_PATH=/home/tianzx/Android/Sdk/ndk/android-ndk-r19c/
===================================
-- Android: Targeting API '23' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is Clang 8.0.2
-- The CXX compiler identification is Clang 8.0.2
-- Check for working C compiler: /home/tianzx/Android/Sdk/ndk/android-ndk-r19c//toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/tianzx/Android/Sdk/ndk/android-ndk-r19c//toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/tianzx/Android/Sdk/ndk/android-ndk-r19c//toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /home/tianzx/Android/Sdk/ndk/android-ndk-r19c//toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 64bit
-- Found OpenCV: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/3rdparty/opencv/opencv-android-sdk-build (found version "3.4.5") 
-- OpenCV_DIR=/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/examples/yolov8_seg/cpp/../../../3rdparty/opencv/opencv-android-sdk-build/sdk/native/jni/abi-arm64-v8a
-- OpenCV_LIBS=opencv_calib3dopencv_coreopencv_features2dopencv_imgcodecsopencv_imgproc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/build/build_rknn_yolov8_seg_demo_rk3588_android_arm64-v8a_Release
Scanning dependencies of target fileutils
Scanning dependencies of target imageutils
Scanning dependencies of target imagedrawing
[ 10%] Building C object utils.out/CMakeFiles/fileutils.dir/file_utils.c.o
[ 20%] Building C object utils.out/CMakeFiles/imageutils.dir/image_utils.c.o
[ 30%] Building C object utils.out/CMakeFiles/imagedrawing.dir/image_drawing.c.o
[ 40%] Linking C static library libfileutils.a
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/utils/image_utils.c:282:35: warning: passing 'const image_buffer_t *' to parameter of type 'image_buffer_t *' discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
        int size = get_image_size(img);
                                  ^~~
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/utils/image_utils.h:67:36: note: passing argument to parameter 'image' here
int get_image_size(image_buffer_t* image);
                                   ^
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/utils/image_utils.c:626:15: warning: incompatible pointer types initializing 'char *' with an expression of type 'int *' [-Wincompatible-pointer-types]
        char* p_imcolor = &imcolor;
              ^           ~~~~~~~~
[ 40%] Built target fileutils
[ 50%] Linking C static library libimagedrawing.a
[ 50%] Built target imagedrawing
2 warnings generated.
[ 60%] Linking C static library libimageutils.a
[ 60%] Built target imageutils
Scanning dependencies of target rknn_yolov8_seg_demo
[ 70%] Building CXX object CMakeFiles/rknn_yolov8_seg_demo.dir/rknpu2/yolov8_seg.cc.o
[ 80%] Building CXX object CMakeFiles/rknn_yolov8_seg_demo.dir/postprocess.cc.o
[ 90%] Building CXX object CMakeFiles/rknn_yolov8_seg_demo.dir/main.cc.o
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/examples/yolov8_seg/cpp/postprocess.cc:925:16: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        return "null";
               ^
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/examples/yolov8_seg/cpp/postprocess.cc:933:12: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
    return "null";
           ^
2 warnings generated.
[100%] Linking CXX executable rknn_yolov8_seg_demo
[100%] Built target rknn_yolov8_seg_demo
[ 20%] Built target fileutils
[ 40%] Built target imageutils
[ 60%] Built target imagedrawing
[100%] Built target rknn_yolov8_seg_demo
Install the project...
-- Install configuration: "Release"
-- Installing: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/./rknn_yolov8_seg_demo
-- Installing: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/lib/librknnrt.so
-- Installing: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/model/bus.jpg
-- Installing: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/model/coco_80_labels_list.txt
-- Up-to-date: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/lib/librknnrt.so
-- Installing: /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/lib/librga.so
The RKNN model can not be found in "/home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/model", please check!
(yolov8) $ cp ../epbox/model/yolov8n-seg-3588.rknn install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/model/
(yolov8) $ ls -hl /home/tianzx/Github/yolov8_rknn/rknn_model_zoo/install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/model/
total 4.7M
-rw-r--r-- 1 tianzx tianzx 178K 417 15:36 bus.jpg
-rw-r--r-- 1 tianzx tianzx  621 417 15:36 coco_80_labels_list.txt
-rw-rw-r-- 1 tianzx tianzx 4.6M 417 17:59 yolov8n-seg-3588.rknn
(yolov8) $ adb root
adbd is already running as root
(yolov8) $ adb remount
remount succeeded
(yolov8) $ adb push install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo /data/
install/rk3588_android_arm64-v8a/rknn_yolov8_seg_demo/: 6 files pushed, 0 skipped. 73.0 MB/s (30818071 bytes in 0.403s)
(yolov8) $ adb shell
rk3588_s:/ # cd data/rknn_yolov8_seg_demo/                                                                                                                                                                         
rk3588_s:/data/rknn_yolov8_seg_demo # export LD_LIBRARY_PATH=./lib
rk3588_s:/data/rknn_yolov8_seg_demo # ./rknn_yolov8_seg_demo model/yolov8n-seg-3588.rknn model/bus.jpg                                                                                                             
load lable ./model/coco_80_labels_list.txt
model input num: 1, output num: 13
input tensors:
  index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=1228800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
output tensors:
  index=0, name=375, n_dims=4, dims=[1, 64, 80, 80], n_elems=409600, size=409600, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-55, scale=0.138304
  index=1, name=onnx::ReduceSum_383, n_dims=4, dims=[1, 80, 80, 80], n_elems=512000, size=512000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.002873
  index=2, name=388, n_dims=4, dims=[1, 1, 80, 80], n_elems=6400, size=6400, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003169
  index=3, name=354, n_dims=4, dims=[1, 32, 80, 80], n_elems=204800, size=204800, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=26, scale=0.023277
  index=4, name=395, n_dims=4, dims=[1, 64, 40, 40], n_elems=102400, size=102400, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-40, scale=0.095424
  index=5, name=onnx::ReduceSum_403, n_dims=4, dims=[1, 80, 40, 40], n_elems=128000, size=128000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003418
  index=6, name=407, n_dims=4, dims=[1, 1, 40, 40], n_elems=1600, size=1600, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=7, name=361, n_dims=4, dims=[1, 32, 40, 40], n_elems=51200, size=51200, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=32, scale=0.020263
  index=8, name=414, n_dims=4, dims=[1, 64, 20, 20], n_elems=25600, size=25600, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-43, scale=0.075364
  index=9, name=onnx::ReduceSum_422, n_dims=4, dims=[1, 80, 20, 20], n_elems=32000, size=32000, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003874
  index=10, name=426, n_dims=4, dims=[1, 1, 20, 20], n_elems=400, size=400, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922
  index=11, name=368, n_dims=4, dims=[1, 32, 20, 20], n_elems=12800, size=12800, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=26, scale=0.022538
  index=12, name=347, n_dims=4, dims=[1, 32, 160, 160], n_elems=819200, size=819200, fmt=NCHW, type=INT8, qnt_type=AFFINE, zp=-119, scale=0.029378
model is NHWC input fmt
model input height=640, width=640, channel=3
origin size=640x640 crop size=640x640
input image: 640 x 640, subsampling: 4:2:0, colorspace: YCbCr, orientation: 1
scale=1.000000 dst_box=(0 0 639 639) allow_slight_change=1 _left_offset=0 _top_offset=0 padding_w=0 padding_h=0
src width=640 height=640 fmt=0x1 virAddr=0x0xb400007585f0b000 fd=0
dst width=640 height=640 fmt=0x1 virAddr=0x0xb400007585ddc000 fd=0
src_box=(0 0 639 639)
dst_box=(0 0 639 639)
color=0x72
rga_api version 1.10.0_[2]
rknn_run
person @ (209 240 285 509) 0.868
bus @ (94 137 557 439) 0.841
person @ (108 235 221 536) 0.829
person @ (475 233 560 521) 0.783
write_image path: out.png width=640 height=640 channel=3 data=0xb400007585f0b000
rk3588_s:/data/rknn_yolov8_seg_demo # exit
(yolov8) $ adb pull /data/rknn_yolov8_seg_demo/out.png 
/data/rknn_yolov8_seg_demo/out.png: 1 file pulled, 0 skipped. 36.2 MB/s (692055 bytes in 0.018s)
(yolov8) $ pwd
/home/tianzx/Github/yolov8_rknn/rknn_model_zoo

3588-android-yolov8n-rknn-detect

5. 参考连接

  1. ultralytics_yolov8
  2. yolov8/README.md
  3. yolov8_seg/README.md
  4. rknn-toolkit2/issues/10

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/553177.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

MATLAB环境下基于随机期望最大化的多分量信号瞬时频率估计方法

相对于频率成分单一、周期性强的平稳信号来说&#xff0c;具有非平稳、非周期、非可积特性的非平稳信号更普遍地存在于自然界中。调频信号作为非平稳信号的一种&#xff0c;由于其频率时变、距离分辨率高、截获率低等特性&#xff0c;被广泛应用于雷达、地震勘测等领域。调频信…

.net反射(Reflection)

文章目录 一.概念&#xff1a;二.反射的作用&#xff1a;三.代码案例&#xff1a;四.运行结果&#xff1a; 一.概念&#xff1a; .NET 反射&#xff08;Reflection&#xff09;是指在运行时动态地检查、访问和修改程序集中的类型、成员和对象的能力。通过反射&#xff0c;你可…

SAP项目任务一览表

根据SAP Activate项目管理方法论的主要精神&#xff0c;浓缩到一些主要的团队和任务。 主要的团队有&#xff1a; 项目管理(办公室)Project Management(office)&#xff1a;项目经理团队&#xff0c;包括项目办公室。负责项目整体运行和监控&#xff0c;项目办公室负责项目的…

【MySQL 安装与配置】Window简单安装MySQL,并配置局域网连接

文章日期&#xff1a;2024.04.17 系统&#xff1a;Window10 || Window11 类型&#xff1a;安装与配置MySQL数据库 文章全程已做去敏处理&#xff01;&#xff01;&#xff01; 【需要做的可联系我】 AES解密处理&#xff08;直接解密即可&#xff09;&#xff08;crypto-js.js…

Stm32-hal库串口教程

工程是在上一节的LED的基础上修改的。 串口原理图 串口配置 led参考 CubelMX点灯-CSDN博客https://blog.csdn.net/anlog/article/details/137830323生成工程 编写包含文件 编写重定向代码 编写发送 编译下载 串口没有收到数据 查找原因 少配置了下图 再编译下载 收到数据…

【MySQL 数据宝典】【内存结构】- 002 Page管理机制

一、 Page 管理机制 Buffer Pool 的底层采用链表数据结构管理Page。在InnoDB访问表记录和索引时会在Page页中缓存&#xff0c;以后使用可以减少磁盘IO操作&#xff0c;提升效率。 1.1 Page 页的分类 free page &#xff1a; 空闲page&#xff0c;未被使用clean page&#xff…

Ubuntu 系统安装 VS Code 并配置 C++ 环境

Linux 系列教程&#xff1a; VMware 安装配置 Ubuntu&#xff08;最新版、超详细&#xff09;FinalShell 远程连接 Linux&#xff08;Ubuntu&#xff09;系统Ubuntu 系统安装 VS Code 并配置 C 环境 ➡️➡️ ➡️VS Code 官方教程&#xff1a;Using C on Linux in VS Code&…

Meta因露骨AI图片陷入困境

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

wsl安装与日常使用

文章目录 一、前向配置1、搜索功能2、勾选下面几个功能&#xff0c;进行安装二、安装WSL1、打开Windows PowerShell,查找你要安装的linux版本2、选择对应版本进行安装3、输入用户名以及密码 三、配置终端代理1、打开powershell,查看自己的IP把以下信息加入到~/.bashrc中 四、更…

目标检测——食品饮料数据集

一、重要性及意义 对食品和饮料进行目标检测的重要性和意义体现在多个方面&#xff1a; 商业应用与市场分析&#xff1a;目标检测技术在食品和饮料行业有着广泛的应用前景。通过对超市货架、餐馆菜单或广告海报中的食品和饮料进行自动识别和计数&#xff0c;商家可以获取关于产…

【C语言】——字符串函数的使用与模拟实现(下)

【C语言】——字符串函数的使用与模拟实现&#xff08;下&#xff09; 前言五、长度受限类字符串函数5.1、 s t r n c p y strncpy strncpy 函数5.2、 s t r n c a t strncat strncat 函数5.3、 s t r n c m p strncmp strncmp 函数 六、 s t r s t r strstr strstr 函数6.1、函…

go语言context

context在服务端编程基本都贯穿所有&#xff0c; Context 是请求的上下文信息。对于RPC Server来说&#xff0c;一般每接收一个新的请求&#xff0c;会产生一个新的Context&#xff0c;在进行内部的函数调用的时候&#xff0c;通过传递Context&#xff0c;可以让不同的函数、协…

常用的数据结构及算法

一、数据结构 &#xff08;一&#xff09;线性结构&#xff1a;一对一。 1.可以使用数组、链表来表示。数组又分为静态数组和动态数组两种。链表常用的是单链表。 2.两种特殊的线性结构&#xff1a;队列和栈。其中队列是先进先出&#xff08;排队&#xff09;&#xff0c;栈…

reportlab 生成pdf文件 (python)

1 安装 pip install reportlab2 应用场景 通过网页动态生成PDF文档大量的报告和数据发布用XML一步生成PDF 官网案例 3 PLATYPUS Platypus是“Page Layout and Typography Using Scripts”&#xff0c;是使用脚本的页面布局和印刷术的缩写&#xff0c;这是一个高层次页面布局…

网易狼人杀创建房间方法

进入游戏后 如下图 点击 建房 进入后 会要我们选择 自己想玩的板子 例如 我们就选进阶场的第一个 点击后 我们就会进来了

TCP的一些功能详述

文章制作不易&#xff0c;望各位大佬多多点赞&#xff0c;球球各位啦&#xff01;&#xff01;&#xff01;&#xff01; 目录 1.TCP的简介 2.TCP协议中部分数据的理解 1.端口号 2.序列号 3.四位首部长度 4.6位保留位 5. 16位校验和 6.数据&#xff08;TCP的载荷&#…

upload-labs靶场详解

靶场环境 下载链接&#xff1a;https://codeload.github.com/c0ny1/upload-labs/zip/refs/heads/master 使用小皮集成环境来完成这个靶场 将文件放到WWW目录下就可以进行访问 进入关卡后页面呈现&#xff1a; Pass-01&#xff08;前端绕过&#xff09; 我们先尝试上传一个web.…

c++ qt6.5 打包sqlite组件无法使用,尽然 也需要dll支持!这和开发php 有什么区别!

运行 程序会默认使用当前所在文件夹中的 dll 文件&#xff0c;若文件不存在&#xff0c;会使用系统环境变量路径中的文件&#xff1b;又或者是需要在程序源代码中明确指定使用的 dll 的路径。由于我安装 Qt 时将相关 dll 文件路径都添加到了系统环境变量中&#xff0c;所以即使…

arcgis中坡向计算工作原理说明

用于识别出从每个像元到其相邻像元方向上值的变化率最大的下坡方向。坡向可以被视为坡度方向。输出栅格中各像元的值可指示出各像元位置处表面的朝向的罗盘方向。将按照顺时针方向进行测量&#xff0c;角度范围介于 0&#xff08;正北&#xff09;到 360&#xff08;仍是正北&a…

Go: 理解 Sync.Pool 的设计

sync 包提供了一个强大且可复用的实例池&#xff0c;以减少 GC 压力。在使用该包之前&#xff0c;我们需要在使用池之前和之后对应用程序进行基准测试。这非常重要&#xff0c;因为如果不了解它内部的工作原理&#xff0c;可能会影响性能。 池的限制 我们来看一个例子以了解它…