PaddlePaddle / PaddlePaddle/FastDeploy
自训练PPYOLOv3模型转RKNN格式模型过程中遇到的问题?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 756
- Avg merge
- 19h 28m
- Merged PRs (30d)
- 4
Description
环境
- 【FastDeploy版本】:fastdeploy-develop
- 【系统平台】:Windows x64(Windows10)
- 【硬件】: 说明具体硬件型号,如 Nvidia GPU 1060, CUDA 10.2 CUDNN 8.3
- 【模型转换环境】: rknn-toolkit2版本为1.4.3b4+48391b8f
- 【编译语言】: Python3.6
问题日志及出现问题的操作流程
-
- 【所用的自训练模型文件】
-
使用项目训练好的模型动转静导出Paddle模型文件,导出时设置export.nms=True,运行代码如下所示
python tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --output_dir=./inference_model/0630 -o weights=output/yolov3_darknet53_270e_coco/best_model.pdparams export.nms=True -
- Paddle模型转ONNX模型
-
导出Paddle模型后,按照Paddle模型转换为ONNX模型文档,静态图转ONNX、固定Shape操作,运行代码如下所示
-
静态图转ONNX:
paddle2onnx --model_dir inference_model/0630/yolov3_darknet53_270e_coco --model_filename model.pdmodel --params_filename model.pdiparams --save_file inference_model/0630/yolov3.onnx --enable_dev_version True -
固定shape:
python -m paddle2onnx.optimize --input_model ./inference_model/0630/yolov3.onnx --output_model ./inference_model/0630/new_yolov3.onnx --input_shape_dict "{'image':[1,3,416,416],'scale_factor':[1,2]}"
以上过程均能正常执行 -
- ONNX转RKNN
-
转换前准备:将模型文件拷贝到FastDeploy/tools/rknpu2下,根据模型netron可视化结构图、模型配置文件infer_cfg.yml,修改config文件,按照按照编写yaml文件文档修改、normaliz参数和output参数.
-
设置do_quantization为False并执行下面命令转换模型后出现错误
-
python export.py --config_path=./infer_cfg.yml --target_platform rk3588 -
错误信息提示:
E Loading dynamic inputs model is not support, please fix it first E Catch exception when loading onnx model: ./new_yolov3.onnx! -
设置do_quantization为True并执行下面命令转换模型后出现错误:
-
python export.py --config_path=./infer_cfg.yml --target_platform rk3588 -
Loading dynamic inputs model is not support, please fix it first E Catch exception when loading onnx model: ./new_yolov3.onnx!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/vision/detection/paddledetection/rknpu2/README_CN.md and tools/rknpu2/export.py, then review the supplied infer_cfg.yml and reproduce the commands for Paddle-to-ONNX and ONNX-to-RKNN conversion. Done means the self-trained YOLOv3 ONNX model converts for rk3588 with both quantization settings without the dynamic-input error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100