Skip to main content

visual-defect-detection

warning
[UNTESTED] — v0.9 paper-correct

The defect_map core is host-unit-tested on native_sim/native/64; the full app runs end-to-end on native_sim with synthetic clean + defect frames. No model ships (stub + statistical fallback). HiL with a real CSI camera + a trained autoencoder is bench-gated.

A camera-fed surface-inspection station that flags manufacturing defects as unsupervised anomalies: an autoencoder reconstructs the "normal" surface, and a region it reconstructs poorly (high error) is a defect — including defect types never seen in training.

Source: examples/ai/visual-defect-detection/.

Why unsupervised​

Good product is abundant and uniform; defects are rare, varied, and costly to label. An autoencoder trained only on good surface flags anything it cannot reconstruct, so one model needs no defect labels and catches novel defects — a supervised classifier must see every defect class up front.

Pipeline​

CSI camera --RGB565--> 64x64 luma grid --> autoencoder (reconstruction)
-> per-tile anomaly score (recon error, or statistical fallback)
-> worst tile (tx,ty) + coverage % + severity + PASS/FAIL

The luma grid is scored as an 8×8 grid of tiles; worst_tx/worst_ty ∈ [0,7] locate the worst tile, coverage_pct is the fraction of tiles flagged, and severity ∈ [0,1].

board.yaml​

libraries:
- name: tflite-micro
cores: [m55_hp]

som:
sku: E1M-AEN801

preset: e1m-evk
supported_boards:
- e1m-evk
- e1m-x-evk

cores:
a32_cluster:
os: "off"
m55_hp:
app: ./src
inference:
default_arena_kib: 256
peripherals:
- i2c # Camera SCCB (OV5640 control bus)
- gpio # Camera ancillaries (reset, power-down)

chips:
- ov5640 # 5 MP CSI camera sensor

diagnostics:
log_level: info

A som.sku flip to E1M-V2M101 does not reach the DEEPX DX-M1: the DX-M1 is an A55 / Linux-only backend, and E1M-V2M101 has only a55_cluster and m33_sm (no m55_hp). An M33 build gets the TFLM CPU kernels; a DX-M1 path needs an A55 / Yocto app.

Expected output​

# DEFECT,frame,verdict,severity,coverage_pct,worst_tx,worst_ty,worst_score
DEFECT,1,PASS,0.00,0.0,0,0,0.33
DEFECT,2,FAIL,0.98,1.6,5,3,1.98

See also​

Questions about this page? Email contact@alplab.ai