0
$\begingroup$

Image classification:

I am having a data set of image collection more than 10k but even though all are the same image but taken in different sizes (pixels into pixels) some are in square and some are in a rectangle. When I am trying to make them similar, I have planned to zoom to the image exactly where my learning is concentrated but I don't know how to do this.

Note these are color images.

I don't whether this is the good approach or any approach is appreciable.

$\endgroup$
1
$\begingroup$

You don't need to change their size. You can zero pad the images when you feed them into the Network. Zero padding creates a "frame of zeros" around each image, so that they all take equal shape.

conv layers in Keras / TensorFlow 2.0 come with already built-in zero padding arguments.

$\endgroup$
0
$\begingroup$

One obvious way is resizing images to a fixed size either by padding zeros for smaller ones or cropping for larger ones.

But a better one is just pass the image as it is to the convolution layers. Convolution layers works irrespective of image size variation.

The problem comes with fully connected layers, because they need exact input size. For this you can use max pooling layer before fully connected layer to convert variable size input to fixed size.

In this way we don't loose information neither add noise, which happens with resizing.

$\endgroup$
  • $\begingroup$ Thanks ashukid, all images containing different resolution. Some images got already zoomed in and some images are squared resolution. Example Atos blind datasets in kaggle.. that's what a actually I am doing $\endgroup$ – Mohan Raj Raja Jul 7 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.