cvlab-stonybrook / LearningToCountEverything

MIT License
361 stars 75 forks source link

Divisible by 8 #8

Closed ZohrehAdabi closed 3 years ago

ZohrehAdabi commented 3 years ago

Hi @Viresh-R, Why should the resized image be divisible by 8? Can I discard this and use e.g. scale_factor * W?

class resizeImageWithGT_org(object):
    """
    If either the width or height of an image exceed a specified value, resize the image so that:
        1. The maximum of the new height and new width does not exceed a specified value
        2. The new height and new width are divisible by 8
        3. The aspect ratio is preserved
    No resizing is done if both height and width are smaller than the specified value
    By: Minh Hoai Nguyen (minhhoai@gmail.com)
    Modified by: Viresh
    """
Viresh-R commented 3 years ago

Hey, Resnet-50 backbone downsamples the image 8 times. If the input isn't divisible by 8, the output size may end being slightly different from the input size. You can of course discard this and use e.g. scale_factor * W. But you may need to resize the GT map so that it's of the same size as the output (required for computing the training loss).

ZohrehAdabi commented 3 years ago

Hey, Resnet-50 backbone downsamples the image 8 times. If the input isn't divisible by 8, the output size may end being slightly different from the input size. You can of course discard this and use e.g. scale_factor * W. But you may need to resize the GT map so that it's of the same size as the output (required for computing the training loss).

Thank you.