tiskw / patchcore-ad

Unofficial implementation of PatchCore and several additional experiments.
MIT License
12 stars 1 forks source link

non square input #6

Closed DHAiRYA2048 closed 4 months ago

DHAiRYA2048 commented 5 months ago

I have input images of size 150x750 and want to train the model with that size, without resizing it to 224x224, because the kind of anomalies in the test set are minor and resizing it to a square makes it lose important information. I tried doing a couple changes to facilitate this, but the results are coming out to be really random and the object in the image is getting distorted such that I am not able to identify it. This is what I tried;

main.py image image

patchcore.py did the following because the original (28,28,-1) was causing shape mismatch (I think there might be some issue with this. I know this is really dumb, sorry, but I am new to this and want to learn) image

did the following because without permuting the shape, it causes a shape mismatch; previous error: image

updated code to get rid of error: image

  1. Is it possible and advisable to input a non-square image to the model, with a wide-resnet50 backbone?
  2. If yes, can you guide me the correct way to do so?
DHAiRYA2048 commented 4 months ago

Found that converting the image into a square by padding on the shorter end gives better results than resizing the rectangular image.