Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yolov8 to rknn model #326

Open
Jay12138-max opened this issue Aug 19, 2024 · 0 comments
Open

Yolov8 to rknn model #326

Jay12138-max opened this issue Aug 19, 2024 · 0 comments

Comments

@Jay12138-max
Copy link

PC: x86 Ubuntu 22.04
rknn-toolkit2 version: 2.0.0b0+9bab5682

When I tried to convert my model "yolov8n.torchscript" or "yolov8.onnx" to "*.rknn", the following issues will occur.
I also tried this method , but not worked yet.
When I change target_platform from 'rk3588' to 'rk3568', there is no issue. How to solve this issue? Help!


I PtParse: 100%|█████████████████████████████████████████████████| 824/824 [00:06<00:00, 117.77it/s]
I Loading : 100%|████████████████████████████████████████████████| 149/149 [00:00<00:00, 395.82it/s]
I GraphPreparing : 100%|█████████████████████████████████████████| 177/177 [00:00<00:00, 672.25it/s]
I Quantizating : 100%|███████████████████████████████████████████| 177/177 [00:00<00:00, 421.73it/s]
W build: The default input dtype of 'x.3' 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 '1313' 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 ...
E RKNN: [09:17:20.658] REGTASK: The bit width of field value exceeds the limit, target: v2, offset: 0x500c, shift = 0, limit: 0x1fff, value: 0x20cf
E RKNN: [09:17:20.658] REGTASK: The bit width of field value exceeds the limit, target: v2, offset: 0x500c, shift = 0, limit: 0x1fff, value: 0x20cf
E RKNN: [09:17:20.659] REGTASK: The bit width of field value exceeds the limit, target: v2, offset: 0x500c, shift = 0, limit: 0x1fff, value: 0x20cf
E RKNN: [09:17:20.705] failed to config argb mode layer!
已放弃 (核心已转储)


My conversation code is shown as follows:
(.onnx or .torchscript to .rknn)


from rknn.api import RKNN
import numpy

if __name__ == '__main__':
    rknn = RKNN()
    rknn.config(mean_values=[[0,0,0]],std_values=[[255,255,255]],target_platform='rk3588')

    # ret = rknn.load_onnx(model="best_22.onnx")
    ret  = rknn.load_pytorch(model = "best_22_rknnopt.torchscript",input_size_list=[[1,3,640,640]])
    rknn.build(do_quantization=True,dataset="dataset11.txt")
    print(ret)
    rknn.export_rknn('best33.rknn')
    rknn.release()

(.pt to .torchscript)

from ultralytics import YOLO 
model = YOLO("best_22.pt") 
model.export(format='RKNN')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant