PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
2.99k stars 465 forks source link

Custom trained yolov5/8 on rknpu2 for RK3588 #1888

Open programmeddeath1 opened 1 year ago

programmeddeath1 commented 1 year ago

Environment

FastDeploy version: 1.0.6 OS Platform: e.g. ubuntu Linux x64 & debian 11 on rk3588s board Hardware: e.g. Nvidia GPU 3070Ti CUDA 11.2 CUDNN 8.3 Program Language: e.g. Python 3.8

Problem description

I am trying to train my custom yolov5/v8 model, convert it to rknn format and then run inference on the same. Can someone explain the steps for me to find out what I am doing wrong.

I am trying to convert the default models from onnx to rknn using the fastdeploy tools/rknpu2 step. It fails with the following error """ {'mean': [[0, 0, 0]], 'std': [[255, 255, 255]], 'model_path': './yolov8n.onnx', 'outputs_nodes': ['p2o.Mul.1', 'p2o.Concat.49'], 'do_quantization': False, 'dataset': './coco_dataset_20.txt', 'output_folder': './yolov8_n_500e_coco'} W init: rknn-toolkit2 version: 1.4.0-22dcfef4 W load_onnx: If you don't need to crop the model, don't set 'inputs'/'input_size_list'/'outputs'! E load_onnx: The 'p2o.Mul.1' in outputs=['p2o.Mul.1', 'p2o.Concat.49'] is invalid! W load_onnx: ===================== WARN(2) ===================== E rknn-toolkit2 version: 1.4.0-22dcfef4 E load_onnx: Catch exception when loading onnx model: /home/dt/Projects/Work/greenox/rknn/yolov8onnxtorknn/FastDeploy/tools/rknpu2/yolov8n.onnx! E load_onnx: Traceback (most recent call last): E load_onnx: File "rknn/api/rknn_base.py", line 1136, in rknn.api.rknn_base.RKNNBase.load_onnx E load_onnx: File "rknn/api/rknn_log.py", line 113, in rknn.api.rknn_log.RKNNLog.e E load_onnx: ValueError: The 'p2o.Mul.1' in outputs=['p2o.Mul.1', 'p2o.Concat.49'] is invalid! Traceback (most recent call last): File "export.py", line 52, in assert ret == 0, "Load model failed!" AssertionError: Load model failed!"""

I tried using the rknn_model_zoo convert functionality, but it also only converts the standard models given by them.

Does your rkyolo demo at (https://github.com/PaddlePaddle/FastDeploy/tree/develop/examples/vision/detection/rkyolo) work on RK3588 and on custom models? If so how can i train custom and run inference on RK3588.

Thank you for your help in advance!

Ilyabasharov commented 9 months ago

Hello, @programmeddeath1 ! Did you solve this problem?

programmeddeath1 commented 6 months ago

Nope i could'nt do it through FastDeploy. I managed to get the custom C++ inference done. here is a detailed reference - https://github.com/programmeddeath1/custom_yolov5_npu_rk3588_orangepi