airockchip / rknn_model_zoo

Apache License 2.0
751 stars 155 forks source link

Fail to model conversion. #135

Open bchoineubility opened 1 week ago

bchoineubility commented 1 week ago

Hi community,

I have tried to run a simple demo but, model conversion is failed as following:

Traceback (most recent call last):
  File "/home/bchoi/work/rknn_model_zoo/examples/yolov5/python/convert.py", line 3, in <module>
    from rknn.api import RKNN
ModuleNotFoundError: No module named 'rknn'
bchoi@firefly:~/work/rknn_model_zoo/examples/yolov5/python$

I have no idea how to install rknn module for python3 because I could not find doc for it now.

Can you please help me?

BR, Mark

suqitao commented 1 week ago

change from rknn.api import RKNN into from rknnlite.api import RKNNLite

bchoineubility commented 6 days ago

Hi @suqitao , Many thanks for reply.

I tried but could not succeed.

bchoi@firefly:~/work/rknn_model_zoo/examples/yolov5/python$ python3 convert.py  ../model/yolov5s_relu.onnx  rk3588
Traceback (most recent call last):
  File "/home/bchoi/work/rknn_model_zoo/examples/yolov5/python/convert.py", line 4, in <module>
    from rknn.api import RKNNLite
ModuleNotFoundError: No module named 'rknn'
bchoi@firefly:~/work/rknn_model_zoo/examples/yolov5/python$

Is there any prepend job to run it?

BR, Mark

suqitao commented 6 days ago

You don't seem to be running convert.py on a computer, you should run it on a computer not on the rk series of boards And on a computer :from rknn.api import RKNN on a rk:rknnlite.api import RKNNLite

bchoineubility commented 3 days ago

Hi @suqitao ,

Good morining.

I tried it to also Ubuntu-18.04, but, cmake version do not meet requirement because Ubuntu-18.04 EOL now and don't support it any more.

bchoi@ubuntu-18:~/work/rknn_model_zoo$ ./build-linux.sh -t rk3588 -a aarch64 -d mobilenet
./build-linux.sh -t rk3588 -a aarch64 -d mobilenet
/opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu
===================================
BUILD_DEMO_NAME=mobilenet
BUILD_DEMO_PATH=examples/mobilenet/cpp
TARGET_SOC=rk3588
TARGET_ARCH=aarch64
BUILD_TYPE=Release
ENABLE_ASAN=OFF
INSTALL_DIR=/home/bchoi/work/rknn_model_zoo/install/rk3588_linux_aarch64/rknn_mobilenet_demo
BUILD_DIR=/home/bchoi/work/rknn_model_zoo/build/build_rknn_mobilenet_demo_rk3588_linux_aarch64_Release
CC=/opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-gcc
CXX=/opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-g++
===================================
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- Check for working C compiler: /opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-gcc -- 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: /opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-g++
-- Check for working CXX compiler: /opt/toolchains/linaro/6.3.1/bin/aarch64-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/bchoi/work/rknn_model_zoo/3rdparty/CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.15 or higher is required.  You are running version 3.10.2

-- Configuring incomplete, errors occurred!
See also "/home/bchoi/work/rknn_model_zoo/build/build_rknn_mobilenet_demo_rk3588_linux_aarch64_Release/CMakeFiles/CMakeOutput.log".

I can build rknn-toolkit2 instead of it, by the way, I could not find what I how to run . I just hope to run my mp4 file with inference with YOLO.

I hope to know explicit way to run inference demo.

Can you please help me?

BR, Mark

bchoineubility commented 3 days ago

@suqitao ,

Additionally, I tried copies some file from my pc to RK3588 board then, start test.py as described in documentation

(venv) bchoi@firefly:~/work/examples/onnx/yolov5$ python test.py
Traceback (most recent call last):
  File "/home/bchoi/work/examples/onnx/yolov5/test.py", line 8, in <module>
    from rknn.api import RKNN
ModuleNotFoundError: No module named 'rknn'
(venv) bchoi@firefly:~/work/examples/onnx/yolov5$

My Ubuntu version of RK3588 board as following:

(venv) bchoi@firefly:~/work/examples/onnx/yolov5$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
(venv) bchoi@firefly:~/work/examples/onnx/yolov5$

I followed installing venv and python packages in the file packages/requirements_cp310-2.0.0b0.txt except tensorflow-2.8 which is not supported on the jammy.

Documentation would be out of date and implicit to me to run it.

BR, Mark

bchoineubility commented 3 days ago

@suqitao ,

Good afternoon,

I built example in the rknpu2 and make installation tar file to copy to RK3588 board.

(venv) bchoi@ubuntu-18:~/work/rknpu2/examples/rknn_yolov5_demo$ pwd
/home/bchoi/work/rknpu2/examples/rknn_yolov5_demo
(venv) bchoi@ubuntu-18:~/work/rknpu2/examples/rknn_yolov5_demo$ ls
CMakeLists.txt  README.md  README_CN.md  build  build-android_RK3562.sh  build-android_RK3566_RK3568.sh  build-android_RK3588.sh  build-linux_RK3562.sh  build-linux_RK3566_RK3568.sh  build-linux_RK3588.sh  convert_rknn_demo  include  install  install.tar  model  set_toolchain_path.sh  src  utils
(venv) bchoi@ubuntu-18:~/work/rknpu2/examples/rknn_yolov5_demo

Then, I copied install.tar to my RK3588 and make a script to run it.

bchoi@firefly:~/work/install/rknn_yolov5_demo_Linux$ cat run_demo.sh
#!/bin/bash

target_platform=RK3588

export LD_LIBRARY_PATH=./lib
./rknn_yolov5_demo model/$target_platform/yolov5s-640-640.rknn model/bus.jpg
bchoi@firefly:~/work/install/rknn_yolov5_demo_Linux$

When I run it, it complained rknpu driver was not loaded.

post process config: box_conf_threshold = 0.25, nms_threshold = 0.45
Loading mode...
E RKNN: [04:43:22.270] failed to open rknpu module, need to insmod rknpu dirver!
E RKNN: [04:43:22.270] failed to open rknn device!
rknn_init error ret=-1
bchoi@firefly:~/work/install/rknn_yolov5_demo_Linux$

So, I checked whether it was not.

bchoi@firefly:~/work/install/rknn_yolov5_demo_Linux$ zcat /proc/config.gz | grep RKNPU
# RKNPU
CONFIG_ROCKCHIP_RKNPU=y
CONFIG_ROCKCHIP_RKNPU_DEBUG_FS=y
# CONFIG_ROCKCHIP_RKNPU_PROC_FS is not set
# CONFIG_ROCKCHIP_RKNPU_FENCE is not set
# CONFIG_ROCKCHIP_RKNPU_SRAM is not set
CONFIG_ROCKCHIP_RKNPU_DRM_GEM=y
# end of RKNPU
bchoi@firefly:~/work/install/rknn_yolov5_demo_Linux$

I think it was implemented in the kernel and lib files was not built in the example sources also.

BR, Mark