hollance / YOLO-CoreML-MPSNNGraph

Tiny YOLO for iOS implemented using CoreML but also using the new MPS graph API.
MIT License
929 stars 251 forks source link

assert(features[0].count == 255 * 13 * 13) crash #72

Open moderateepheezy opened 3 years ago

moderateepheezy commented 3 years ago

Hi @hollance, thank you for this wonderful demo.

I tried to add the implementation you did for YOLO to my own model, and the line below crashed in the YOLO.swift file.

assert(features[0].count == 255 * 13 * 13)

If I comment out the assert, I can see the bounding box in the app, but are not placed correctly.

Please what do I need to look into that could cause the assert method to fail, and also why the bounding box are not correctly placed on the object I'm detecting.

Thank you.

hollance commented 3 years ago

Your YOLO model probably doesn't have a 13x13 output grid, or it has fewer detectors per grid, or it doesn't have the same number of classes. You'll need to tweak these numbers in the code to suit your own version of YOLO.