Dataset Viewer
The dataset could not be loaded because the splits use different data file formats, which is not supported. Read more about the splits configuration. Click for more details.
Couldn't infer the same data file format for all splits. Got {NamedSplit('train'): ('imagefolder', {}), NamedSplit('validation'): ('text', {}), NamedSplit('test'): ('imagefolder', {})}
Error code:   FileFormatMismatchBetweenSplitsError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Unified-IAD: A Unified Benchmark for Industrial Anomaly Detection

Unified-IAD harmonizes multiple publicly available industrial inspection datasets into a common representation while preserving their original annotations, provenance, and metadata.

Industrial anomaly detection datasets differ widely in annotation formats, directory structures, tasks, naming conventions, and evaluation protocols, which makes direct comparison between methods difficult. Unified-IAD addresses this by:

  • converting heterogeneous annotations into binary segmentation masks;
  • preserving original annotations, tasks, and dataset provenance whenever available;
  • providing a unified metadata description for every sample;
  • defining consistent, stratified train/validation/test splits.

Rather than introducing new data, Unified-IAD is generated through a reproducible benchmark generation pipeline, allowing it to be regenerated or extended with additional datasets in the future.


Included Datasets

Unified-IAD integrates seven publicly available industrial anomaly detection datasets spanning different industrial domains, products, materials, and defect types.

Dataset Original Task Original Annotation Source
AeBAD Image Segmentation Pixel masks zhangzilongc/MMR
MPDD Image Segmentation Pixel masks stepanje/MPDD
VisA Image Segmentation Pixel masks amazon-science/spot-diff · AWS Open Data
DAGM2007 Image Segmentation Elliptical annotations DAGM 2007 Challenge
BSData Object Detection Polygon annotations 2Obe/BSData
Large Scale Wood Defects Object Detection Bounding boxes Kaggle dataset
Simplified Object Detection for Manufacturing Object Detection Bounding boxes Zenodo record

All original annotation formats—native masks, polygons, ellipses, and bounding boxes—are converted into a common binary segmentation mask, while the original annotation is preserved whenever available.


Repository Structure

Unified-IAD/
├── images/
│   ├── aebad/
│   ├── bsdata/
│   ├── dagm2007/
│   ├── mpdd/
│   ├── visa/
│   ├── wood/
│   └── sodm/
├── masks/
│   ├── aebad/
│   ├── bsdata/
│   ├── dagm2007/
│   ├── mpdd/
│   ├── visa/
│   ├── wood/
│   └── sodm/
├── labels/
│   ├── aebad/
│   ├── bsdata/
│   ├── dagm2007/
│   ├── mpdd/
│   ├── visa/
│   ├── wood/
│   └── sodm/
└── metadata.csv

Large datasets are internally sharded to comply with Hugging Face repository recommendations. This organization is fully transparent when working through metadata.csv.

Every sample shares a single image_id across its image, mask, original label, and metadata row.


Benchmark Generation Pipeline

Unified-IAD is built through a reproducible four-stage pipeline:

  1. Annotation Conversion
    Native masks are preserved, polygons are rasterized, and ellipses and bounding boxes are converted into filled binary masks.

  2. Dataset Harmonization
    All datasets are reorganized into a common directory structure with standardized naming, a unified metadata schema, and globally unique sample identifiers.

  3. Metadata Generation
    Each image receives a metadata entry recording its source dataset, original task, annotation format, splits, anomaly information, category, dimensions, license, and original publication.

  4. Benchmark Assembly
    All datasets are merged into one benchmark while preserving annotations, provenance, licensing information, and publication references.

This design ensures that the original information is preserved, the benchmark can be regenerated from the released preprocessing scripts, and additional datasets can be incorporated without changing the overall structure.


Metadata

metadata.csv is the main entry point for the benchmark. Filtering, splitting, and loading samples can all be performed directly from it, without relying on dataset-specific folder structures.

Column Description
image_id Globally unique sample identifier shared by the image, mask, label, and metadata row.
dataset Original source dataset.
dataset_year Publication year of the original dataset.
license License of the original dataset.
original_task Original task: image_segmentation or object_detection.
annotation_type Annotation representation: pixel_mask, polygon_mask, ellipse_mask, bbox_mask, or empty_normal_mask.
annotation_origin Origin of the unified mask: native_mask, generated_from_polygon, generated_from_bbox, generated_from_ellipse, or generated_empty_normal.
split_original Original dataset split, such as train, test, or valid.
split_final Unified benchmark split: train, val, or test.
category_original Original product, object, or material category.
defect_type Original defect class; normal samples are labeled good.
is_anomalous Binary anomaly label: 0 for normal and 1 for anomalous.
mask_available Indicates whether a binary segmentation mask is available.
image_width Image width in pixels.
image_height Image height in pixels.
image_path Relative path to the image inside the repository.
mask_path Relative path to the binary segmentation mask.
label_path Relative path to the preserved original annotation, when available.
source_url Official URL of the original dataset or publication.
notes Dataset-specific notes, including information about annotation conversion.

The annotation_origin field makes it possible to distinguish native pixel-level annotations from automatically generated masks when defining an evaluation protocol.


Usage

Installation

pip install huggingface_hub pandas pillow torch

Download the Dataset

from huggingface_hub import snapshot_download

dataset_root = snapshot_download(
    repo_id="it4lia/Unified-IAD",
    repo_type="dataset",
)

Load Metadata and One Sample

from pathlib import Path

import pandas as pd
from PIL import Image

dataset_root = Path(dataset_root)
metadata = pd.read_csv(dataset_root / "metadata.csv")

sample = metadata.iloc[0]

image = Image.open(
    dataset_root / sample["image_path"]
).convert("RGB")

mask = Image.open(
    dataset_root / sample["mask_path"]
).convert("L")

print(f"Image ID: {sample['image_id']}")
print(f"Dataset: {sample['dataset']}")
print(f"Image size: {image.size}")
print(f"Anomalous: {bool(sample['is_anomalous'])}")

Filtering Functions

The following helper function can be used to select samples by original task, annotation origin, anomaly status, dataset, and final split.

import pandas as pd


def filter_metadata(
    metadata: pd.DataFrame,
    *,
    split: str | None = None,
    original_task: str | None = None,
    native_masks_only: bool = False,
    anomalous_only: bool = False,
    dataset: str | None = None,
) -> pd.DataFrame:
    """Return a filtered copy of the Unified-IAD metadata."""

    subset = metadata.copy()

    if split is not None:
        valid_splits = {"train", "val", "test"}
        if split not in valid_splits:
            raise ValueError(
                f"split must be one of {sorted(valid_splits)}"
            )
        subset = subset[subset["split_final"] == split]

    if original_task is not None:
        valid_tasks = {
            "image_segmentation",
            "object_detection",
        }
        if original_task not in valid_tasks:
            raise ValueError(
                f"original_task must be one of {sorted(valid_tasks)}"
            )
        subset = subset[
            subset["original_task"] == original_task
        ]

    if native_masks_only:
        subset = subset[
            subset["annotation_origin"] == "native_mask"
        ]

    if anomalous_only:
        subset = subset[
            subset["is_anomalous"] == 1
        ]

    if dataset is not None:
        subset = subset[
            subset["dataset"] == dataset
        ]

    return subset.reset_index(drop=True)

Original Image Segmentation Datasets

This subset includes datasets whose original task was image segmentation.

segmentation = filter_metadata(
    metadata,
    original_task="image_segmentation",
)

This includes:

  • AeBAD
  • MPDD
  • VisA
  • DAGM2007

All Samples with Segmentation Masks

Every Unified-IAD sample has a unified binary mask, regardless of its original task.

all_segmentation = metadata[
    metadata["mask_available"] == 1
].reset_index(drop=True)

Original Object Detection Datasets

object_detection = filter_metadata(
    metadata,
    original_task="object_detection",
)

This includes:

  • BSData
  • Large Scale Wood Defects
  • Simplified Object Detection for Manufacturing

Native Pixel-Level Masks Only

native_segmentation = filter_metadata(
    metadata,
    native_masks_only=True,
)

Train, Validation, and Test Splits

train = filter_metadata(metadata, split="train")
val = filter_metadata(metadata, split="val")
test = filter_metadata(metadata, split="test")

print(f"Train samples: {len(train):,}")
print(f"Validation samples: {len(val):,}")
print(f"Test samples: {len(test):,}")

Task-Specific Splits

Original image segmentation datasets in the training split:

segmentation_train = filter_metadata(
    metadata,
    split="train",
    original_task="image_segmentation",
)

Original object detection datasets in the test split:

detection_test = filter_metadata(
    metadata,
    split="test",
    original_task="object_detection",
)

Other Common Filters

# All generated masks
generated_masks = metadata[
    metadata["annotation_origin"] != "native_mask"
].reset_index(drop=True)

# All anomalous samples
anomalies = metadata[
    metadata["is_anomalous"] == 1
].reset_index(drop=True)

# All normal samples
normal = metadata[
    metadata["is_anomalous"] == 0
].reset_index(drop=True)

# Anomalous VisA samples
visa_anomalies = metadata[
    (metadata["dataset"] == "VisA")
    & (metadata["is_anomalous"] == 1)
].reset_index(drop=True)

# Leave-one-dataset-out generalization
train_lodo = metadata[
    metadata["dataset"] != "VisA"
].reset_index(drop=True)

test_lodo = metadata[
    metadata["dataset"] == "VisA"
].reset_index(drop=True)

Minimal PyTorch Dataset

from pathlib import Path
from typing import Any

import pandas as pd
from PIL import Image
from torch.utils.data import Dataset


class UnifiedIAD(Dataset):
    def __init__(
        self,
        root: str | Path,
        dataframe: pd.DataFrame,
        image_transform=None,
        mask_transform=None,
    ):
        self.root = Path(root)
        self.dataframe = dataframe.reset_index(drop=True)
        self.image_transform = image_transform
        self.mask_transform = mask_transform

    def __len__(self) -> int:
        return len(self.dataframe)

    def __getitem__(self, index: int) -> dict[str, Any]:
        row = self.dataframe.iloc[index]

        image_path = self.root / row["image_path"]
        mask_path = self.root / row["mask_path"]

        image = Image.open(image_path).convert("RGB")
        mask = Image.open(mask_path).convert("L")

        if self.image_transform is not None:
            image = self.image_transform(image)

        if self.mask_transform is not None:
            mask = self.mask_transform(mask)

        return {
            "image": image,
            "mask": mask,
            "image_id": row["image_id"],
            "dataset": row["dataset"],
            "category": row["category_original"],
            "defect_type": row["defect_type"],
            "is_anomalous": int(row["is_anomalous"]),
            "metadata": row.to_dict(),
        }

Create a DataLoader

from torch.utils.data import DataLoader
from torchvision.transforms import v2

image_transform = v2.Compose([
    v2.Resize((256, 256)),
    v2.ToImage(),
    v2.ToDtype(dtype=torch.float32, scale=True),
])

mask_transform = v2.Compose([
    v2.Resize(
        (256, 256),
        interpolation=v2.InterpolationMode.NEAREST,
    ),
    v2.ToImage(),
])

train_dataset = UnifiedIAD(
    root=dataset_root,
    dataframe=train,
    image_transform=image_transform,
    mask_transform=mask_transform,
)

train_loader = DataLoader(
    train_dataset,
    batch_size=16,
    shuffle=True,
    num_workers=4,
)

Remember to import PyTorch when using the transformations above:

import torch

Evaluation Protocol

Use split_final for reproducible comparisons:

  • train on split_final == "train";
  • tune hyperparameters on split_final == "val";
  • report final results on split_final == "test".

Because split_original is also preserved, experiments following the original per-dataset protocols remain possible.

Recommended settings include:

  • Unified benchmark: use the full metadata table.
  • Original image segmentation benchmark: filter on original_task == "image_segmentation".
  • Original object detection benchmark: filter on original_task == "object_detection".
  • Native pixel-level benchmark: filter on annotation_origin == "native_mask".
  • Cross-dataset generalization: perform leave-one-dataset-out experiments using the dataset column.

Recommended Applications

Unified-IAD is suitable for research on:

  • industrial anomaly detection;
  • defect localization;
  • industrial image segmentation;
  • vision-language models for industrial inspection;
  • foundation models for industrial inspection;
  • transfer learning;
  • domain adaptation;
  • cross-dataset generalization;
  • self-supervised learning;
  • weakly supervised learning;
  • benchmarking industrial computer vision algorithms.

The preserved metadata also allows users to reconstruct subsets corresponding to the original dataset tasks and annotation formats.


Limitations

  • Heterogeneous acquisition conditions.
    The source datasets use different acquisition setups, lighting conditions, resolutions, and industrial processes. The benchmark therefore spans a broad range of scenarios rather than one controlled protocol.

  • Generated masks are not manual pixel-level ground truth.
    For datasets originally based on bounding boxes, polygons, or ellipses, segmentation masks are generated automatically from the original annotations. Use annotation_origin == "native_mask" to select only native pixel-level annotations.

  • Inherited dataset bias.
    Unified-IAD does not rebalance or alter the original distributions of industrial sectors, products, materials, acquisition devices, or defect frequencies.

  • Benchmark scope.
    Unified-IAD targets industrial anomaly detection and defect localization. It is not intended as a general-purpose semantic segmentation benchmark.


License

The Unified-IAD benchmark is distributed under the Creative Commons Attribution-ShareAlike 4.0 International license (CC BY-SA 4.0).

Each sample also preserves the license of its original dataset through the license column in metadata.csv, together with its corresponding source_url.

Users are responsible for complying with the license terms of each original dataset. Unified-IAD does not alter the ownership or intellectual property rights associated with the original data.


Citation

If you use Unified-IAD, please cite this benchmark and the original datasets included in your experiments.

@dataset{unifiediad2026,
  title     = {Unified-IAD: A Unified Benchmark for Industrial Anomaly Detection},
  author    = {Milani, Luca and collaborators},
  year      = {2026},
  publisher = {Hugging Face},
  url       = {https://huggingface.co/datasets/it4lia/Unified-IAD}
}

AeBAD

Zhang, Z., Zhao, Z., Zhang, X., Sun, C., and Chen, X. (2023). Industrial Anomaly Detection with Domain Shift: A Real-world Dataset and Masked Multi-scale Reconstruction.

@article{zhang2023industrial,
  title   = {Industrial Anomaly Detection with Domain Shift: A Real-world Dataset and Masked Multi-scale Reconstruction},
  author  = {Zhang, Zilong and Zhao, Zhibin and Zhang, Xingwu and Sun, Chuang and Chen, Xuefeng},
  journal = {arXiv preprint arXiv:2304.02216},
  year    = {2023}
}

MPDD

Jezek, S., Jonak, M., Burget, R., Dvorak, P., and Skotak, M. (2021). Deep learning-based defect detection of metal parts: evaluating current methods in complex conditions.

@inproceedings{jezek2021deep,
  title     = {Deep learning-based defect detection of metal parts: evaluating current methods in complex conditions},
  author    = {Jezek, Stepan and Jonak, Martin and Burget, Radim and Dvorak, Pavel and Skotak, Milos},
  booktitle = {2021 13th International Congress on Ultra Modern Telecommunications and Control Systems and Workshops (ICUMT)},
  pages     = {66--71},
  year      = {2021},
  doi       = {10.1109/ICUMT54235.2021.9631567}
}

VisA

Zou, Y., Jeong, J., Pemula, L., Zhang, D., and Dabeer, O. (2022). SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation.

@article{zou2022spot,
  title   = {SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation},
  author  = {Zou, Yang and Jeong, Jongheon and Pemula, Latha and Zhang, Dongqing and Dabeer, Onkar},
  journal = {arXiv preprint arXiv:2207.14315},
  year    = {2022}
}

DAGM2007

Weakly Supervised Learning for Industrial Optical Inspection. Competition organized as part of the 29th Annual Symposium of the German Association for Pattern Recognition, Heidelberg, Germany, 2007.

@misc{dagm2007,
  title        = {Weakly Supervised Learning for Industrial Optical Inspection},
  howpublished = {29th Annual Symposium of the German Association for Pattern Recognition},
  address      = {Heidelberg, Germany},
  year         = {2007},
  url          = {https://conferences.mpi-inf.mpg.de/dagm/2007/prizes.html}
}

BSData

Schlagenhauf, T., and Landwehr, M. (2021). Industrial machine tool component surface defect dataset.

@article{schlagenhauf2021industrial,
  title   = {Industrial machine tool component surface defect dataset},
  author  = {Schlagenhauf, Tobias and Landwehr, Magnus},
  journal = {Data in Brief},
  volume  = {39},
  pages   = {107643},
  year    = {2021},
  doi     = {10.1016/j.dib.2021.107643}
}

Large Scale Wood Defects

Kodytek, P., Bodzas, A., and Bilik, P. (2022). A large-scale image dataset of wood surface defects for automated vision-based quality control processes.

@article{kodytek2022largescale,
  title   = {A large-scale image dataset of wood surface defects for automated vision-based quality control processes},
  author  = {Kodytek, Pavel and Bodzas, Alexandra and Bilik, Petr},
  journal = {F1000Research},
  volume  = {10},
  pages   = {581},
  year    = {2022},
  doi     = {10.12688/f1000research.52903.2}
}

Simplified Object Detection for Manufacturing

Werheid, J. (2024). Simplified Object Detection for Manufacturing: Introducing a Low-Resolution Dataset.

@dataset{werheid2024simplified,
  title     = {Simplified Object Detection for Manufacturing: Introducing a Low-Resolution Dataset},
  author    = {Werheid, Jonas},
  publisher = {Zenodo},
  year      = {2024},
  doi       = {10.5281/zenodo.10731976}
}

Acknowledgements

Unified-IAD was developed at the Italian Institute of Artificial Intelligence for Industry (AI4I) and released through the IT4LIA AI Factory, as part of AI4I's effort to promote open, reproducible, and standardized benchmarks for industrial artificial intelligence.

We gratefully acknowledge the authors of the original datasets whose work made this benchmark possible.


AI4I logo        IT4LIA AI Factory logo

Downloads last month
1

Collection including it4lia/Unified-IAD

Papers for it4lia/Unified-IAD