Files
zeekay dda5b2a367 restore the tree
The previous commit was meant to remove .github/workflows and removed
every tracked path instead — 892 files, the whole repo. This puts back
the 874 that were never in scope; the eighteen workflow files stay gone,
for the reasons that commit gives.

Content is byte-identical to 9d2aec9 outside .github/workflows.
2026-08-13 23:27:57 -07:00

3.1 KiB

Anomalib DataModules Tutorial

Notebook GitHub Colab
BTech 101_btech Open In Colab
MVTec 102_mvtec Open In Colab
Folder 103_folder Open In Colab
Tiling 104_tiling Open In Colab

Notebook Contents

The notebooks in this section demonstrate the mechanics of anomalib data modules, with a specific focus on benchmarks such as MVTec AD, BTech, and custom datasets via the Folder module. Anomalib data modules are structured as follows: Each data collection implements the Torch Dataset and the PyTorch Lightning DataModule objects.

The Torch Dataset inherits torch.utils.data.Dataset and implement the __len__ and __getitem__ methods. This implementation might therefore be utilized not just for anomalib, but also for other implementations.

The DataModule implementation inherits the PyTorch Lightning DataModule object. The advantage of this class is that it organizes each step of data from download to creating the Torch dataloader.

Overall, a data implementation has the following structure:

anomalib
├── __init__.py
├── data
│   ├── __init__.py
│   ├── btech.py
│   │   ├── BTechDataset
│   │   └── BTech
│   ├── folder.py
│   │   ├── FolderDataset
│   │   └── Folder
│   ├── inference.py
│   │   ├── InferenceDataset
│   │   mvtec.py
│   │   ├── MVTecADDataset
└── └── └── MVTec

Let's deep dive into each dataset supported in anomalib and check their functionality.

Installation Instructions

If you have not installed all required dependencies, follow the Installation Guide.