amazon-science / patchcore-inspection

Apache License 2.0
759 stars 152 forks source link

Could anyone explain resize and imagesize ? #5

Closed AlessandroPolidori closed 2 years ago

AlessandroPolidori commented 2 years ago

Hi, can someone please explain these two parameters and, above all, why should i choose a different output size ? For instance, if my images are 480x480, what values should i choose?

Confusezius commented 2 years ago

resize denotes the initial size each image is resized to (so in your case it would go from 480 x 480 to resize x resize). imagesize denotes the final size of the centercropped image. If you check https://github.com/amazon-research/patchcore-inspection/blob/b64be4734cb8295bfbadccf4f6a036b266181e57/src/patchcore/datasets/mvtec.py#L74 you can see exactly how these are used :).

AlessandroPolidori commented 2 years ago

@Confusezius Thank you for clearing that, but i was also interested in the reason why you would want to have a different output size (different wrt the resizing) and also why would i want to resize my images in the first place. I'm sorry if that's not really related to patchcore but i'm a novice :')

Confusezius commented 2 years ago

No problem :). The resizing/cropping is primarily to be in line with and comparable to previous works who used resizing/centercropping. In a practical setting, you may very well use the full input image!

gathierry commented 2 years ago

Hi @Confusezius could you kindly share which previous work used center cropping? I see most of them start with resizing to 256 but I've never seen one with center cropping to 224. Thanks