A03ki / f-AnoGAN

Implementation of f-AnoGAN with PyTorch
MIT License
128 stars 35 forks source link

wrong line in mvtec jupyter notebook #20

Closed ytz123456 closed 1 year ago

ytz123456 commented 1 year ago

Hi @A03ki , Thank you for this amazing repository! When trying out training on mvtec-ad dataset, in the visualization part, there is a line that seems to be wrong. Instead of training_label=0, we should set training_label=3. Thank you!

ytz123456 commented 1 year ago

One more question is that during my training process, the discriminator loss is stable (around 0) while the generator loss is fluctuating wildly (like tens to thousands), does that mean there are problems with my training?

A03ki commented 1 year ago

Hi, @ytz123456. Thank you for using this repository and your comments.

Response to the first comment: The directory 'good', which contains normal images, corresponds to training_label=0, so I think there is no mistake. Even when checking the label IDs of the bottle dataset as shown in the code below, training_label=0 corresponds to 'good'.

>>> from torchvision4ad.datasets import MVTecAD

>>> mvtec_ad = MVTecAD(".", "bottle", train=False, download=True)
>>> mvtec_ad._find_classes("/content/bottle/train")
(['good'], {'good': 0})
>>> mvtec_ad._find_classes("/content/bottle/test")
(['broken_large', 'broken_small', 'contamination', 'good'],
 {'good': 0, 'broken_large': 1, 'broken_small': 2, 'contamination': 3})

Response to the second comment: Can the trained generator generate images based on the training data? There are no constraints on the generator loss, so if the discriminator loss has decreased to around 0 and the generator is able to generate images, there should be no problem.

ytz123456 commented 1 year ago

Thank you for your prompt reply!