spring98 / flutter-yolo-realtime-plugin

실시간 객체검출 플러그인 배포 (2023)
MIT License
12 stars 4 forks source link

how to export model ? #5

Open kpthsu opened 10 months ago

kpthsu commented 10 months ago

Hello Amazing job! I'm new here, and it was very interesting to see your plug-in examples. To spent some time learning about python , installed yolo5 and flutter on my Windows desktop, I was trying to figure out how to use 'python modified_export.py --weights yolov5s.pt --include torchscript coreml'. After to change yolov5s.torchscript to yolov5s.pt,and put in asses/models. The program crashed when I tried to run it on an android phone. I try to put the yolov5_320.pt model in your directory example into the same directory as my flutter, it works! May I ask why the yolov5s.pt provided by yoylv5 cannot be converted into the yolov5s_320.pt in your example? I'm a beginner. Can you give me some advice? Thank you.

spring98 commented 10 months ago

hello! Thank you for your interest in my plugin.

It is difficult to predict what kind of problem there will be based on this information alone.

If you have an error log, could you leave it as it may help us solve the problem?

thank you

kpthsu commented 10 months ago

2024-01-06 11 14 24 I used yolov5's yolov5s.pt converted file to change androidModelPath and to add assets to pubspec.yam. Didn't see YoloRealtimeController try catch ERROR: in log,Can you give me some advice?Thank you.

spring98 commented 10 months ago

https://github.com/yasenh/libtorch-yolov5/issues/21#issuecomment-713567834

I also did some searching, and there seem to be two cases.

  1. Check CPU version and GPU version

  2. Check if model.model[-1].export = False

I hope this helps!

kpthsu commented 10 months ago

2024-01-06 16 14 31 2024-01-06 16 16 38 I tried to confirm the export output again. The export result is successful. But the size of the obtained 'yolov5s,torchscript' file is different from the size of your 'yolov5s_320.pt' file. but 'Check if model.model[-1].export = False ', how to confirm this?Thank you.

dxnghxn203 commented 4 months ago

Hello! I solved the hassle. I have changed androidModelHeight and androidModelWidth

Screenshot 2024-07-24 091702

(320, 320) => (640, 640)

Screenshot 2024-07-24 092601

from Screenshot 2024-07-24 091523

I hope this helps!