Avitzur
Avitzur

Reputation: 161

Does the aspect ratio of the training images affect the object detection model created by Turi Create?

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?

Upvotes: 2

Views: 604

Answers (1)

William J Bagshaw
William J Bagshaw

Reputation: 565

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.

Upvotes: 0

Related Questions