Search code examples
iosmachine-learningobject-detectioncoremlcreateml

Why does object detection result in multiple found objects?


I trained an object detector with CreateML and when I test the model in CreateML, I get a high number of identified objects:

enter image description here

Notes:

  • The model was trained on a small data set of ~30 images with that particular label face-gendermale occuring ~20 times.
  • Each training image has 1-3 labelled objects.
  • There are 5 label total.

Questions:

  • Is that expected or is there something wrong with the model?
  • If this is expected, how should I evaluate these multiple results or even count the number of objects found in the model?

Cross-posted in Apple Developer Forums. Photo of man © Jason Stitt | Dreamstime.com


Solution

  • A typical object detection model with make about 1000 predictions for every image (although it can be much more depending on the model architecture). Most of these predictions have very low confidence, so they are filtered out. Then the ones that are left over are sent through non-maximum suppression (NMS), which removes bounding boxes that overlap too much.

    In your case, it seems that the threshold for NMS is too low (or too high), because many overlapping boxes survive.

    However, it also seems that the model hasn't been trained very well yet, probably because you used very few images.