Open jumengbo opened 1 month ago
You need the rknpu2 toolkit and the rknn_model_zoo. Here, you find https://github.com/airockchip/rknn_model_zoo/tree/main/examples/yolov8/python, for instance. The Python convert.py can be used to get the rknn model. Keep in mind that every type of model (YoloV5, YoloV6, YoloV7, or YoloV10) has it's own convert.py. If not sure, check with kaylorchen to get the right one. I thought he uses YoloV8.
这些工具包我是用过,在kaylorchen那里我找到了将pt转换为onnx和onnx转换为rknn方法,在转换为onnx之后,转化为rknn时遇到了问题,问题如下,我在尝试自己解决并询问[kaylorchen],谢谢你的回答 (toolkit2_py3.8) book@100ask:~/Desktop/onnx->rknn/rk3588-convert-to-rknn-master$ python convert.py yolov10s.onnx rk3566 i8 yolov10.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 13! I Model converted from pytorch, 'opset_version' should be set 19 in torch.onnx.export for successful convert! I Loading : 0%| | 0/I Loading : 100%|██████████████████████████████████████████████| 193/193 [00:00<00:00, 24905.41it/s] done --> Building model E build: The input 0 of TopK('/model.23/TopK') need to be constant! It will cause the graph to be a dynamic graph! Remove TopK('/model.23/TopK') manually and try again! I ===================== WARN(0) ===================== E rknn-toolkit2 version: 2.0.0b0+9bab5682 E build: Catch exception when building RKNN model! E build: Traceback (most recent call last): E build: File "rknn/api/rknn_base.py", line 1977, in rknn.api.rknn_base.RKNNBase.build E build: File "rknn/api/graph_optimizer.py", line 814, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant E build: File "rknn/api/graph_optimizer.py", line 361, in rknn.api.graph_optimizer._dynamic_check E build: File "rknn/api/rknn_log.py", line 92, in rknn.api.rknn_log.RKNNLog.e E build: ValueError: The input 0 of TopK('/model.23/TopK') need to be constant! It will cause the graph to be a dynamic graph! E build: Remove TopK('/model.23/TopK') manually and try again! W If you can't handle this error, please try updating to the latest version of the toolkit2 and runtime from: https://console.zbox.filez.com/l/I00fc3 (Pwd: rknn) Path: RKNPU2_SDK / 2.X.X / develop / If the error still exists in the latest version, please collect the corresponding error logs and the model, convert script, and input data that can reproduce the problem, and then submit an issue on: https://redmine.rock-chips.com (Please consult our sales or FAE for the redmine account) Build model failed!-1
Please consult kaylorchen. TopK indicating a recent onnx operation unknown to rknn. kalorchen has fixed it for us.
我想要将自己的训练的模型转换为rknn来预测,.pt转换为onnx的方法是用你readme里面提到的kaylorchen