john-rocky / CoreML-Models

Converted CoreML Model Zoo.
1.23k stars 111 forks source link

Procedure for exporting yolov5? #16

Closed titanium-cranium closed 2 years ago

titanium-cranium commented 2 years ago

Hi @john-rocky:

Thanks so much for this repo. I wondered if you could describe how you went about exporting the yolov5s model to use CoreML?

I have tried this repeatedly on the most recent version of the yolov5 repo.

export.py --weights yolov5s.pt --include coreml to get the default values but whenever I try to import the resulting yolov5s.mlmodel into Xcode, the preview panel does not render and if I try to deploy it into an iOS app like this: https://github.com/shu223/MLModelCamera, it fails to function.

When I downloaded your yolov5s.mlmodel file, however Xcode was happy and it worked fine in MLModelCamera.

I'm running macOS v12.3.1 (Monterey), on a 2019 Intel MacBook Pro. Any thoughts you might have on why this is failing would be most welcome.

titanium-cranium commented 2 years ago

After seeing the comment about NMS being implemented I did some more research and eventually stumbled over this PR on the yolov5 repo that implements nms and worked really well for me.

https://github.com/mshamash/yolov5/tree/fix/coreml_export_nms_layer