ObjectDetection-CoreML icon indicating copy to clipboard operation
ObjectDetection-CoreML copied to clipboard

Exporting from yolov5 to coreml

Open iceisfun opened this issue 3 years ago • 6 comments

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.

iceisfun avatar Sep 07 '22 23:09 iceisfun

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

eneskosr avatar Sep 15 '22 15:09 eneskosr

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

Archer-204 avatar Oct 18 '22 07:10 Archer-204

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

eneskosr avatar Oct 18 '22 07:10 eneskosr

@eneskosr Appreciated!!!!!

Archer-204 avatar Oct 18 '22 08:10 Archer-204

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

eneskosr avatar Oct 19 '22 07:10 eneskosr

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! 👍

Archer-204 avatar Oct 19 '22 09:10 Archer-204