Skip to content

Add an end-to-end anomaly detection tutorial using PyTorch Lightning #21809

Description

@rashidrao-pk

📚 Documentation

Motivation

PyTorch Lightning is widely used for supervised learning tasks, but there is currently no end-to-end tutorial demonstrating anomaly detection.

Anomaly detection is an important application in industrial inspection, healthcare, cybersecurity, and time-series monitoring. A beginner-friendly tutorial would help users understand how Lightning can simplify training and evaluation for these workflows.

Proposed tutorial

I would like to contribute a tutorial that demonstrates:

  • Building an Autoencoder (or Variational Autoencoder) using LightningModule
  • Organizing datasets with LightningDataModule
  • Training only on normal samples
  • Computing reconstruction-error anomaly scores
  • Selecting an anomaly threshold using validation data
  • Evaluating on normal and anomalous samples
  • Logging metrics with Lightning loggers
  • Visualizing reconstructed images and anomaly scores

The tutorial would follow Lightning's recommended coding style and be suitable for beginners.

Possible extensions

Depending on maintainer feedback, the tutorial could later include:

  • Callbacks for reconstruction visualization
  • TensorBoard logging
  • Multiple datasets
  • Industrial anomaly detection examples

I'd be happy to implement this if the maintainers think it would be a useful addition.

cc @lantiga

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation relatedneeds triageWaiting to be triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions