anomalib icon indicating copy to clipboard operation
anomalib copied to clipboard

[Bug]: Question about PaDiM model validation and testing

Open junhhaha opened this issue 1 year ago • 1 comments

Describe the bug

Does PaDiM model require validation and testing? notebooks/500_use_cases/501_dobot/501a_training_a_model_with_cubes_from_a_robotic_arm.ipynb when I see the above example code, they validate with the model using the testing function. My understanding is PaDiM model does not require validation. Just need to train the model and test the performance with metrics.

But when I use the PaDiM model with a custom dataset, the default setting automatically splits the normal dataset for validation and testing the dataset. (These three: test_split_ratio, val_split_ratio, and noraml_split_ratio and I try not to allocate normal images to the validation dataset, model training does not work.

Thank you!

Dataset

N/A

Model

N/A

Steps to reproduce the behavior

na

OS information

OS information: na

  • OS: [e.g. Ubuntu 20.04]
  • Python version: [e.g. 3.10.0]
  • Anomalib version: [e.g. 0.3.6]
  • PyTorch version: [e.g. 1.9.0]
  • CUDA/cuDNN version: [e.g. 11.1]
  • GPU models and configuration: [e.g. 2x GeForce RTX 3090]
  • Any other relevant information: [e.g. I'm using a custom dataset]

Expected behavior

na

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

No response

Configuration YAML

na

Logs

na

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

junhhaha avatar Jul 18 '24 02:07 junhhaha

yes I have the same issue, I want to use all my images for training and test on images later

hrudaykolla avatar Jul 24 '24 15:07 hrudaykolla

Padim, does not need abnormal images during training, but does need some during validation, during which it computes the adaptive threshold using normal and abnormal images. This threshold value is then used to compute the performance on the test dataset.

If you don't want to split your dataset, then you have two options: (i) Use synthetic normal images to compute the threshold, or (ii) do not compute the threshold, which means do not compute the test metrics.

If you want to do follow the first option, you could refer to this documentation https://anomalib.readthedocs.io/en/v1.1.1/markdown/guides/how_to/data/custom_data.html#with-only-normal-images

samet-akcay avatar Sep 25 '24 04:09 samet-akcay