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

Training Methodology Issue: Incorrect Dataset Mode #8

Closed
mojtaba-nafez opened this issue Apr 11, 2024 · 2 comments
Closed

Training Methodology Issue: Incorrect Dataset Mode #8

mojtaba-nafez opened this issue Apr 11, 2024 · 2 comments

Comments

@mojtaba-nafez
Copy link

mojtaba-nafez commented Apr 11, 2024

I've encountered an issue in the paper's code regarding the training approach for the anomaly detector on the MVTec AD dataset. The problem lies in the train.py script at line 35 where the Dataset object for training is created without specifying mode="train":

train_data = Dataset(root=args.train_data_path, transform=preprocess, target_transform=target_transform, dataset_name=args.dataset)

This oversight leads to two critical problems:

  1. The model mistakenly uses the test set for training.
  2. The anomaly detection framework is deprived of abnormal data during training, yet it encounters anomalies during testing. This inconsistency suggests that the model might be functioning as a simple classifier rather than performing anomaly detection.

Could this be revised to ensure the correct dataset partitioning and training setup?

@cescomuch
Copy link

cescomuch commented Aug 20, 2024

I have also encountered this behavior. My suspicion is that they specified mode="test" to use normal and abnormal images during training (many Anomaly Detection datasets have only normal images in the training set but normal and abnormal in the test set).

@zqhang
Copy link
Owner

zqhang commented Aug 20, 2024

Hi, I believe this point has already been clarified in the paper. We fine-tune AnomalyCLIP using an auxiliary dataset and then test it on other datasets in zero-shot manner. Regarding the decision to set the test mode during training, this is because the MVTec dataset does not provide anomaly samples in its training dataset for fine-tuning AnomalyCLIP.

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

3 participants