Jim OHalloran
Jim OHalloran

Reputation: 5908

Size of image for prediction with SageMaker object detection?

I'm using the AWS SageMaker "built in" object detection algorithm (SSD) and we've trained it on a series of annotated 512x512 images (image_shape=512). We've deployed an endpoint and when using it for prediction we're getting mixed results.

If the image we use for prediciton is around that 512x512 size we're getting great accuracy and good results. If the image is significantly larger (e.g. 8000x10000) we get either wildly inaccurate, or no results. If I manually resize those large images to 512x512pixels the features we're looking for are no longer discernable to the eye. Which suggests that if my endpoint is resizing images, then that would explain why the model is struggling.

Note: Although the size in pexels is large, my images are basically line drawings on a white background. They have very little color and large patches of solid white, so they compress very well. I'm mot running into the 6Mb request size limit.

So, my questions are:

  1. Does training the model at image_shape=512 mean my prediction images should also be that same size?
  2. Is there a generally accepted method for doing object detection on very large images? I can envisage how I might chop the image into smaller tiles then feed each tile to my model, but if there's something "out of the box" that will do it for me, then that'd save some effort.

Upvotes: 2

Views: 1052

Answers (1)

Vineet Khare
Vineet Khare

Reputation: 81

Your understanding is correct. The endpoint resizes images based on the parameter image_shape. To answer your questions:

  1. As long as the scale of objects (i.e., expansion of pixels) in the resized images are similar between training and prediction data, the trained model should work.
  2. Cropping is one option. Another method is to train separate models for large and small images as David suggested.

Upvotes: 1

Related Questions