2

I'm training a custom object detection model with Turi Create using tc.object_detector.create and seeing different behavior running the mlmodel on an iPhone in landscape or portrait mode. Trying to determine if it is just a bug in the app, or does the aspect ratio of images in the object detection model training set affect the model?

Do I need to ensure that training images are in a variety of aspect ratios to generate a robust model?

Avitzur
  • 161
  • 1
  • 8

1 Answers1

0

Yes, it makes difference. The images are squashed to a square in training. You need to also check that the model is using

objectRecognition.imageCropAndScaleOption = . scaleFill

Also which way around is the capture buffer? this is controlled by...

conn?.videoOrientation = .portrait

and which way around the model interprets the image...

 let exifOrientation = CGImagePropertyOrientation.up
 let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: exifOrientation, options: [:])

An alternative is to train on square images and set the model to .centerCrop. But then only the centre square of the image is searched.