Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the size of the input image #9

Open
xfby2016 opened this issue Feb 9, 2021 · 3 comments
Open

About the size of the input image #9

xfby2016 opened this issue Feb 9, 2021 · 3 comments

Comments

@xfby2016
Copy link

xfby2016 commented Feb 9, 2021

Is the size of the input image unadjustable(resize, cropsize)? I get error after changing resize and cropsize.
The inference stage, how to deal with larger images, such as 900*1000, resize and crop makes area of anomaly incomplete! Thank you

@harewei
Copy link

harewei commented Feb 16, 2021

The size of the image is completely adjustable, just not with the current code.

Firstly, crop is not necessary; In fact I got higher AUC scores for some classes that I've test on than the original paper. However, be careful if your image isn't square, as explained here https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.Resize.
In this scenario, crop becomes necessary if you want to keep the original image's proportions (if not, just change T.Resize to take (h, w) instead of int). You would also need to change https://github.com/xiahaifeng1995/PaDiM-Anomaly-Detection-Localization-master/blob/main/main.py#L172 so that the upsampled output image match the size of your input image.

@DeepKnowledge1
Copy link

The size could be any value that is divisible by 16.
as @harewei mentioned, upsampled output image matches the size of your input image
score_map = F.interpolate(dist_list.unsqueeze(1), size=(x.size(2),x.size(3)), mode='bilinear', align_corners=False).squeeze().numpy()

@Omarelsaadany
Copy link

The size of the image is completely adjustable, just not with the current code.

Firstly, crop is not necessary; In fact I got higher AUC scores for some classes that I've test on than the original paper. However, be careful if your image isn't square, as explained here https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.Resize.
In this scenario, crop becomes necessary if you want to keep the original image's proportions (if not, just change T.Resize to take (h, w) instead of int). You would also need to change https://github.com/xiahaifeng1995/PaDiM-Anomaly-Detection-Localization-master/blob/main/main.py#L172 so that the upsampled output image match the size of your input image.

Do you know how to change T.Resize to take (h, w) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants