amazon-science / patchcore-inspection

Apache License 2.0
691 stars 142 forks source link

AttributeError: 'MVTecDataset' object has no attribute 'transform_std' #80

Open William9Baker opened 1 year ago

William9Baker commented 1 year ago

What's wrong with this error?

zsffuture commented 1 year ago

I also encountered the same problem, did you solve it?

zsffuture commented 1 year ago

I solved this problem, because backbone is based on imagenet dataset training, so the mean and variance is imagenet, you can add it in src\patchcore\datasets\mvtec.py file can be seen at the top, and then modify it to add it. image

PauloFavero commented 11 months ago

I fixed this issue in the simplenet repo with the following pull request: https://github.com/DonaldRR/SimpleNet/pull/20 To fix the issue here in patchcore just follow the modifications in simplenet dateset folder.

romanvelichkin commented 10 months ago

Long story short:

in patchcore/datasets/mvtec.py in class MVTecDataset in def __init__ add this rows:

self.transform_std = IMAGENET_STD
self.transform_mean = IMAGENET_MEAN
IESSTTJP commented 2 months ago

I am using a different dataset, but adding those two sentences still reports the same error, can you please tell me in which rows they are added?