InspectServe logo
InspectServe
Upload normal images. Score any new image for anomalies.
memory-bank detector · FastAPI

Step 1 · Build the memory bank (normal images)

Upload a few photos of good products or surfaces. The detector stores their feature vectors — exactly like the Python service.

Step 2 · Score a test image

0.999206InspectAI image AUROC (MVTec AD bottle)
0.992126InspectAI F1
83held-out test images
25.6 msmedian CPU latency (InspectAI)

How the detector works

Each image becomes a 1,076-dimension feature vector: 32×32 downscaled grayscale structure, per-channel color histograms, and gradient/contrast summaries, L2-normalized. The anomaly score is the Euclidean distance to the nearest normal reference in the memory bank; above the threshold (default 0.35) the image is flagged as an anomaly.

The benchmark numbers above are from the related InspectAI project on MVTec AD bottle. InspectServe packages the serving layer around the same detector family — reproduce benchmarks on your own camera data before quoting deployment metrics.

Limits

The bundled feature extractor is a lightweight CPU baseline. Production inspection needs dataset-specific training, threshold calibration, and validation on representative images.

FastAPI service

GET /health — service status · GET /model-info — detector config + benchmark context · POST /predict — multipart image upload, returns score, label, threshold and latency.

Try it from a terminal:

curl -X POST https://inspectserve.vercel.app/predict -F "file=@your-image.jpg"

Interactive docs: /docs. The browser scorer on the Inspect tab runs the identical feature extraction and nearest-neighbor scoring locally, so it works even if the API is cold.