1
$\begingroup$

For example the task of transformation, the model consist convolutional layer and pooling layer only, take input of image, and output a feature map (loss MSE, trying to produce feature map that exactly match feature map in label)

The forward pass can take any image size and output a feature with size = [w/(n_max_pooling*2), h/(n_max_pooling*2)]

Thus, with batch size of 1, there are no "dimension mismatch error" when we feed different image size, different ratio. The network just output a feature map, due to the nature of convolutional layer and max pooling layer.

For example: (batch_size, channel, width, height)

  • Sample 1: 1x3x128x128 => target 64x64
  • Sample 2: 1x3x768x1024 => target 368x512

....

I would like to know in that case of inconsist input shape, will the network be able to train and update it weight correctly ?

$\endgroup$
2
$\begingroup$

Do not do this.

You are providing the algorithm with examples your training data should conform with the same dimensions otherwise you will skew the weights with alternate examples that do not reflect a true positive as like the original batch.

Your data preparation is important, if you have the ability to standardise the size then you should do this at the start before training.

If you have a library of images that you want to train on that are all different sizes; I suggest that you do the following:

Use opencv for the following 1) Write a script that cycles through the images 2) use the script to clip the images on the x:y axis making a square 2b)you can automate this by using the click point for centre which then clips and save the new sized image

obviously save all the files in another directory but they should all be standardised now.

$\endgroup$

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.