All projects
SampleSample · unsupportedUnsupported · no SLA

Anomalib Defect Inspection Archive

Inspection-line archive (Next.js 16 + FastAPI) that stores every part image in Backblaze B2, scores it with Anomalib PatchCore, keeps the heatmap and score with the model version behind it, routes high scores to operator review, and retrains new model versions from adjudicated images read back from B2.

Built for: Developers and AI coding agents who want a working, traceable visual-inspection pipeline to study or adapt: part images and derived artifacts on object storage, an open source anomaly model, and an operator review loop.

MIT licensed · Updated Nov 19, 2026

Dashboard with inspection metrics, parts-per-day chart and archive bytes in B2
Parts inspected, parts above threshold, review backlog, verdicts and model versions, with archive bytes in B2 by kind.

What it's built with

Each piece of the stack, and the job it does in this project.

Next.js 16 + React 19
Web dashboard UI
Tailwind CSS v4 + shadcn/ui
Design tokens and interface primitives
TanStack Query + Recharts
Data fetching and dashboard charts
FastAPI + Pydantic v2
Layered Python API (Python 3.12+)
boto3 + Backblaze B2
S3-compatible storage for images, heatmaps, scores, labels and models
pyarrow
Parquet score files stored next to the images they describe
Anomalib 2.7.0 PatchCore (PyTorch)
Local anomaly scoring and retraining, optional ML extra
pnpm workspaces
TypeScript and Python monorepo workflow

Core capabilities

What the project does out of the box, before you write any code of your own.

  • Dashboard

    Parts inspected, parts above threshold, review backlog, verdicts and model versions, a parts-per-day chart and archive bytes in B2 by kind.

  • Capture and scoring

    Store each part image in B2 under its line and date, then score it with the line's active Anomalib PatchCore model. The score, threshold, model version and heatmap are kept with it.

  • Review queue

    Parts at or above the threshold wait for an operator, oldest first, with the image beside its heatmap and a pass or fail verdict form.

  • Lines

    Create inspection lines and choose the active model version for each.

  • Line detail

    Per-line counts, the PatchCore score distribution and the day's parts with status, score, threshold and model version.

  • Retraining and model versions

    Train a new PatchCore version from images read back from B2, stored with its checkpoint, AUROC, threshold and a manifest of every image key and ETag, then activate it.

  • Trace

    Open a part serial to see its image, heatmaps, score history, verdict history and the model version behind each score.

  • Inspection archive

    Browse the images, heatmaps, scores, labels and models a line has written to B2, by line and date.

  • Bucket Explorer

    Browse, preview and download any object in the bucket.

A closer look

More screens from the running project.

Capture form for storing and scoring a part image
Pick a line, enter a part serial and drop an image; it is stored in B2 and scored by the line's active PatchCore model.
Review queue with a captured candle image, its anomaly heatmap and the verdict form
Parts at or above the threshold wait here, with the image beside its anomaly heatmap and a pass or fail verdict form.
Lines page listing inspection lines and their active model versions
Every inspection line with its description, active model version and last update.
Line detail with part counts, score distribution and today's parts
Per-line counts, the PatchCore score distribution, and the day's parts with status, score, threshold and model version.
Model versions table with activation controls and the train-new-version form
PatchCore versions trained from images read back from B2, with AUROC and threshold, plus the form to train a new version.
Model version detail with configuration, metrics and the training-set manifest
One version's configuration, metrics and the training-set manifest of B2 images with their ETags.
Trace view of a failed part with image, heatmap, score history and verdict history
A part serial opened to its image, heatmap, score history and verdict history, with controls to change the verdict or re-score.
Inspection archive grid of part images paired with their heatmaps
Every image and heatmap a line has written to B2, paired by capture date, with tabs for scores, labels and models.

Choose it for the right job

Anomalib Defect Inspection Archive is a head start for a specific shape of project, not a supported, general-purpose product.

Use it when

  • You want a traceable visual-inspection example that keeps images, heatmaps, scores and model versions together on S3-compatible object storage.
  • You want to see an open source anomaly model (Anomalib PatchCore) retrained from adjudicated images read back from the same bucket.
  • You want an operator review loop, from threshold routing to a recorded pass or fail verdict, that runs on a laptop CPU, with CUDA or Apple MPS optional.
  • You plan to extend it with an AI coding agent and value explicit repository docs and enforced layering.

Choose another path when

  • You need camera or PLC integration, line-rate throughput guarantees, or compliance with a quality standard; none of these are claimed.
  • You need authentication, user accounts or tenant isolation: anyone who can reach the API can capture, review and train.
  • You need to delete inspection records from the interface; the archive deliberately has no user-facing delete for them.
  • You need scoring and training in a serverless deployment; PyTorch training and a model checkpoint do not fit a serverless function, and a Railway deployment returns 503 for scoring until the ML extra is added to its build.
  • You need a supported product or a service-level agreement.
Sample · unsupported

Project status and support

Backblaze maintains this open-source sample to help developers get started with B2; report defects and requests through the repository's GitHub Issues. It has no service-level agreement (SLA) and no guaranteed support.