tucan9389 / ObjectDetection-CoreML

An example running Object Detection using Core ML (YOLOv8, YOLOv5, YOLOv3, MobileNetV2+SSDLite)
https://github.com/motlabs/awesome-ml-demos-with-ios
MIT License
295 stars 51 forks source link

Exporting from yolov5 to coreml #8

Open iceisfun opened 2 years ago

iceisfun commented 2 years ago

having trouble exporting our ultralytics yolov5 models to coreml.

git clone repo, cd repo, checkout fix/coreml_export_nms_layer, install req, run export cmd

python3 export.py --weights ../../output/best.pt --include coreml

... lots of stuff happening, and eventually ...

added const 10 for builder <coremltools.models.neural_network.builder.NeuralNetworkBuilder object at 0x7f078bb94580> added const 11 for builder <coremltools.models.neural_network.builder.NeuralNetworkBuilder object at 0x7f078bb94580> added const 12 for builder <coremltools.models.neural_network.builder.NeuralNetworkBuilder object at 0x7f078bb94580> Translating MIL ==> NeuralNetwork Ops: 97%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 656/678 [00:00<00:00, 1012.99 ops/s]added const 878 for builder <coremltools.models.neural_network.builder.NeuralNetworkBuilder object at 0x7f078bb94580> Translating MIL ==> NeuralNetwork Ops: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 678/678 [00:00<00:00, 1160.80 ops/s]

CoreML: export failure: 0 has type int, but expected one of: bytes, unicode /usr/src/app/temp/yolov5#

if its helpful we can share our best.pt.

eneskosr commented 2 years ago

same here. @iceisfun did you manage to solve it?

Archer-204 commented 2 years ago

Same issue here. @iceisfun did you find a way out?

eneskosr commented 2 years ago

@Archer-204 i have found a solution. i will post it tonight.

Archer-204 commented 2 years ago

@eneskosr Appreciated!!!!!

eneskosr commented 2 years ago

i have uploaded my export_nms.py to a repo. can you check it out? @Archer-204 https://github.com/eneskosr/yolov5-coreml-export

Archer-204 commented 2 years ago

i have uploaded my export_nms.py to a repo. can you check it out? @Archer-204 https://github.com/eneskosr/yolov5-coreml-export

Thanks! It works! 👍