Skip to content
ModelListedExternal
Download

AD MVTec

This repository contains pre-trained VAE-GAN model checkpoints for visual anomaly detection on the MVTec AD dataset.

KindOtherVersionRevision c8f2a4d

Model source

Kind
Other
File size
233 MB
Version
vRevision c8f2a4d
Updated
Sep 28, 2026
Downloads
0
Source
Hugging Face

Source description

VAE-GAN Checkpoints for MVTec Anomaly Detection

This repository contains pre-trained VAE-GAN model checkpoints for visual anomaly detection on the MVTec AD dataset.

Overview

The models were trained in a one-class anomaly detection setting using only normal training images. During inference, each input image is reconstructed by the VAE-GAN model, and anomaly scores are computed from the reconstruction error between the input and reconstructed image.

These checkpoints are useful for:

  • Reconstruction-based anomaly detection
  • Threshold selection experiments
  • Multi-point threshold evaluation
  • Anomaly localization
  • Explainable anomaly detection
  • Baseline comparison with AE, VAE, PatchCore, PaDiM, and other methods

Dataset

The checkpoints are trained on MVTec AD object and texture categories.

Reference:

@article{bergmann2021mvtec,
  title={The MVTec Anomaly Detection Dataset: A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection},
  author={Bergmann, Paul and Batzner, Kilian and Fauser, Michael and Sattlegger, David and Steger, Carsten},
  journal={International Journal of Computer Vision},
  year={2021}
}

Available Checkpoints

CategoryCheckpoint
Bottlemodel_bottle_64.pt
Cablemodel_cable_64.pt
Capsulemodel_capsule_64.pt
Carpetmodel_carpet_64.pt
Gridmodel_grid_64.pt
Hazelnutmodel_hazelnut_64.pt
Leathermodel_leather_64.pt
Metal Nutmodel_metal_nut_64.pt
Pillmodel_pill_64.pt
Screwmodel_screw_64.pt
Tilemodel_tile_64.pt
Toothbrushmodel_toothbrush_64.pt
Transistormodel_transistor_64.pt
Woodmodel_wood_64.pt
Zippermodel_zipper_64.pt

Model Details

PropertyValue
ModelVAE-GAN
Training SettingOne-Class Learning
Training DataNormal Samples Only
Input Size128 × 128 × 3
Latent Dimension64
FrameworkPyTorch

Checkpoint Structure

Each checkpoint contains:

{
    "encoder_state_dict": ...,
    "decoder_state_dict": ...,
    "discriminator_state_dict": ...
}

Loading a Checkpoint

import torch

checkpoint = torch.load(
    "model_bottle_64.pt",
    map_location="cpu",
    weights_only=False
)

encoder.load_state_dict(checkpoint["encoder_state_dict"])
decoder.load_state_dict(checkpoint["decoder_state_dict"])
discriminator.load_state_dict(checkpoint["discriminator_state_dict"])

encoder.eval()
decoder.eval()
discriminator.eval()

Example Anomaly Score

with torch.no_grad():
    mu, logvar = encoder(image)
    z = reparameterize(mu, logvar)
    reconstruction = decoder(z)

anomaly_map = torch.abs(image - reconstruction).mean(dim=1)
anomaly_score = anomaly_map.mean().item()

Device Support

The checkpoints can be loaded on:

  • CPU
  • NVIDIA CUDA GPUs
  • Apple Silicon (MPS)
import torch

if torch.cuda.is_available():
    device = "cuda"
elif torch.backends.mps.is_available():
    device = "mps"
else:
    device = "cpu"

Intended Use

This repository is intended for research on:

  • Visual Anomaly Detection
  • Reconstruction-Based Anomaly Scoring
  • Threshold Calibration
  • Multi-Point Thresholding
  • Explainable Anomaly Detection
  • Industrial Inspection Systems

Limitations

  • Models are trained on resized 128×128 images.
  • Performance depends on preprocessing, anomaly score design, and threshold selection.
  • These checkpoints are intended for research purposes and should be validated before deployment in industrial or safety-critical environments.

Citation

@misc{rao2026vaeganmvtec,
  title={VAE-GAN Checkpoints for MVTec Anomaly Detection},
  author={Rao, Rashid},
  year={2026},
  publisher={Hugging Face},
  url={https://huggingface.co/rashidrao/AnomalyDetection}
}

Author

Rashid Rao
Industrial PhD Researcher
University of Turin, Italy

Research Areas:

  • Explainable AI (XAI)
  • Visual Anomaly Detection
  • Trustworthy AI
  • Industrial AI Systems

Sources

1 source
Hugging FacePrimaryVersion c8f2a4d950a033ef9a1322b49c630a070b064387
huggingface.co/rashidrao/AD_MVTec/tree/c8f2a4d950a033ef9a1322b49c630a070b064387

Verified Sep 28

Model artifacts

15 artifacts

checkpoints/model_bottle_64.pt

pt · 233 MB · SHA-256 9e7e4f788c7a…ce90 · Hugging Face

Download

checkpoints/model_cable_64.pt

pt · 233 MB · SHA-256 c926d9e723c5…758a · Hugging Face

Download

checkpoints/model_capsule_64.pt

pt · 233 MB · SHA-256 6de1abe96877…0f27 · Hugging Face

Download

checkpoints/model_carpet_64.pt

pt · 233 MB · SHA-256 96534c58540f…8a84 · Hugging Face

Download

checkpoints/model_grid_64.pt

pt · 233 MB · SHA-256 77d81e5ac0c5…9927 · Hugging Face

Download

checkpoints/model_hazelnut_64.pt

pt · 233 MB · SHA-256 454c1e6eed8e…52fe · Hugging Face

Download

checkpoints/model_leather_64.pt

pt · 233 MB · SHA-256 ffe660e2b757…f89d · Hugging Face

Download

checkpoints/model_metal_nut_64.pt

pt · 233 MB · SHA-256 ed4ca546d20f…c817 · Hugging Face

Download

checkpoints/model_pill_64.pt

pt · 233 MB · SHA-256 920d916b7fcd…8e51 · Hugging Face

Download

checkpoints/model_screw_64.pt

pt · 233 MB · SHA-256 b18a892ea06e…2777 · Hugging Face

Download

checkpoints/model_tile_64.pt

pt · 233 MB · SHA-256 26f4ac0c2feb…5fa6 · Hugging Face

Download

checkpoints/model_toothbrush_64.pt

pt · 233 MB · SHA-256 f62f898daa40…fc8f · Hugging Face

Download

checkpoints/model_transistor_64.pt

pt · 233 MB · SHA-256 33d2b687364a…d0f4 · Hugging Face

Download

checkpoints/model_wood_64.pt

pt · 233 MB · SHA-256 15c05f7abbaf…96c8 · Hugging Face

Download

checkpoints/model_zipper_64.pt

pt · 233 MB · SHA-256 dc2464f10125…9b70 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: mit language: - en tags: - anomaly-detection - computer-vision - vae-gan - industrial-ai - mvtec - pytorch library_name: pytorch pipeline_tag: image-classification datasets: - mvtec-ad --- # VAE-GAN Checkpoints for MVTec Anomaly Detection This repository contains pre-trained VAE-GAN model checkpoints for visual anomaly detection on the MVTec AD dataset. ## Overview The models were trained in a one-class anomaly detection setting using only normal training images. During inference, each input image is reconstructed by the VAE-GAN model, and anomaly scores are computed from the reconstruction error between the input and reconstructed image. These checkpoints are useful for: - Reconstruction-based anomaly detection - Threshold selection experiments - Multi-point threshold evaluation - Anomaly localization - Explainable anomaly detection - Baseline comparison with AE, VAE, PatchCore, PaDiM, and other methods ## Dataset The checkpoints are trained on MVTec AD object and texture categories. Reference: ```bibtex @article{bergmann2021mvtec, title={The MVTec Anomaly Detection Dataset: A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection}, author={Bergmann, Paul and Batzner, Kilian and Fauser, Michael and Sattlegger, David and Steger, Carsten}, journal={International Journal of Computer Vision}, year={2021} } ``` ## Available Checkpoints | Category | Checkpoint | |-----------|-----------| | Bottle | model_bottle_64.pt | | Cable | model_cable_64.pt | | Capsule | model_capsule_64.pt | | Carpet | model_carpet_64.pt | | Grid | model_grid_64.pt | | Hazelnut | model_hazelnut_64.pt | | Leather | model_leather_64.pt | | Metal Nut | model_metal_nut_64.pt | | Pill | model_pill_64.pt | | Screw | model_screw_64.pt | | Tile | model_tile_64.pt | | Toothbrush | model_toothbrush_64.pt | | Transistor | model_transistor_64.pt | | Wood | model_wood_64.pt | | Zipper | model_zipper_64.pt | ## Model Details | Property | Value | |-----------|-----------| | Model | VAE-GAN | | Training Setting | One-Class Learning | | Training Data | Normal Samples Only | | Input Size | 128 × 128 × 3 | | Latent Dimension | 64 | | Framework | PyTorch | ## Checkpoint Structure Each checkpoint contains: ```python { "encoder_state_dict": ..., "decoder_state_dict": ..., "discriminator_state_dict": ... } ``` ## Loading a Checkpoint ```python import torch...

Source context: 0 downloads · 0 likes · Pipeline image-classification · Library pytorch · Repo rashidrao/AD_MVTec