Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in AI and Deep Learning by (3.5k points)
edited by
I want my model to be trained with some classified images. They are of different sizes, so how can I train my model without resizing the images?

1 Answer

0 votes
by (10.9k points)
edited by

@Ritik, you haven’t mentioned what architecture you are talking about so let us assume it’s a partly convolutional, partly connected network like AlexNet, GoogLeNet , etc. The answer to your question depends on the network type which you are working with.

Let us assume you have a network which contains a lot of convolutional units and does not have any fully connected layers, so it can be invariant to the size of the input image. This type of network can process the input images and return another image as output. Remember to make sure that the output matches your expectation since you have to find the loss.

If you are using fully connected units then it can be big trouble for you, following are some ways to solve your problem:

  • Don’t care about the squashing of images.
  • Centre-crop the images to a specific size.
  • Pad the image with a solid color and then resize it
  • Perform the combination of the above.

visit here for examples: https://github.com/tensorflow/models/blob/f98c5ded31d7da0c2d127c28b2c16f0307a368f0/slim/preprocessing/inception_preprocessing.py#L206-L216

Hope this answer helps!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...