Skip to content

InspectRT: A Portable Runtime for Industrial Visual Inspection

CI Python 3.11 | 3.12 License: Apache-2.0

InspectRT is a reproducible, reduced feature-memory baseline for one MVTec AD category at a time. RT means Runtime. InspectRT records scientific outputs and runtime measurements for its frozen workloads.

Status

inspectrt_feature_memory_v1 is the implemented profile. It uses a frozen ResNet-50 feature extractor, a complete nominal patch bank, exact nearest-neighbor retrieval, raw anomaly maps, and threshold-free metrics. The supported installed/user commands are evaluate, benchmark, fixture validate and onnx validate. Fixture and ONNX export are source-checkout reproducibility workflows; portability commands are scoped maintainer/evidence tooling. The complete command, schema and experimental Python API boundary is in docs/public-interface.md. See docs/retrieval-fixtures.md for the format, commands, and validation limits.

The baseline freeze covers bottle and leather on a ThinkPad P53 with a Quadro T1000 and the current locked Linux stack. The frozen bottle workload also has reviewed results for Intel Core i7-9850H CPU, RTX 4080 Super CUDA under WSL 2, M1 Pro CPU, and M1 Pro MPS. Floating outputs and metrics stayed within the reviewed envelope, although exact nearest-neighbour indices varied across devices. The synchronized wall-clock record contains six descriptive timing rows. See docs/portability.md and the baseline method contract in docs/baseline.md.

The frozen bottle workload also has a reviewed ONNX feature boundary for layer2 and row-major patch embeddings. ONNX Runtime CPU results pass the policy-v2 calibration and independent Ryzen/WSL2 holdout. See docs/onnx-portability.md and the compact scientific evidence.

Bundled fixture quickstart

InspectRT supports CPython 3.11 and 3.12. Install a reviewed wheel by following docs/installation.md, including the CPU-first or CUDA-first PyTorch sequence for Linux.

An installed distribution can validate the bundled canonical synthetic fixture offline on CPU:

inspectrt fixture validate --device cpu

The fixture identity and validation limits are documented in docs/retrieval-fixtures.md.

ONNX feature artifact

The optional ONNX tools use the onnx extra in a locked source checkout:

uv sync --locked --extra onnx

Export is a source-checkout reproducibility workflow. It requires a clean source tree and the accepted pretrained weight already cached:

uv run --extra onnx inspectrt onnx export \
  --output-root outputs

The generated artifact contains only manifest.json and model.onnx. Its model bytes remain ignored. Validation is a supported installed/user workflow when inspectrt[onnx] is installed:

uv run --extra onnx inspectrt onnx validate \
  --artifact \
  outputs/artifacts/inspectrt_onnx_feature_portability_v1/<artifact-id>

Validation covers artifact structure and graph identities. The graph emits the two feature tensors; InspectRT's PyTorch pipeline handles preprocessing, retrieval, scoring, maps, and metrics. See the ONNX portability guide for the experimental direct CPU consumer API and reviewed limits.

MVTec AD

Obtain MVTec AD from the official dataset page. The download form asks for your email, name, and occupation, and commercial use is not allowed. Place the categories below one dataset root:

datasets/mvtec_ad/
├── bottle/
└── leather/

The dataset remains untracked through .gitignore. Pass datasets/mvtec_ad, not an individual category directory, as --dataset-root.

Installed MVTec quickstart

inspectrt evaluate \
  --dataset-root /path/to/mvtec_ad \
  --category bottle \
  --device cpu \
  --output-root /path/to/output

The wheel includes the frozen baseline profile. Use a separately obtained MVTec root; torchvision supplies the official pretrained weight. An explicit --config remains supported. See the baseline guide for the method, complete run bundle and benchmark command.

Benchmark

benchmark is supported for the frozen bottle workload with exactly five warm-ups and 30 measured repetitions. See docs/baseline.md for the command, device rules, eight-file bundle and reviewed measurements.

Method scope

inspectrt_feature_memory_v1 is InspectRT's reduced feature-memory reference. Interpret its results under the method in the baseline guide. Supported installation paths are listed in the installation and support guide, while reviewed scientific portability evidence is documented in docs/portability.md.

License and distribution

InspectRT-authored code is licensed under the Apache License 2.0, and NOTICE preserves first-party attribution. Dependencies, datasets, and pretrained weights retain separate terms. MVTec AD is obtained separately by the user.

Release archives contain InspectRT code, the baseline profile, the synthetic fixture, and legal metadata. Users obtain MVTec and torchvision weights separately and generate run bundles or ONNX models locally. THIRD_PARTY_NOTICES.md records the dependency, dataset, weight, and generated-artifact boundaries.

About

A reproducible, reduced feature-memory baseline for industrial anomaly detection, with exact retrieval fixtures and PyTorch/ONNX portability evidence.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages