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.

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.








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.
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.