FastFlow
FastFlow learns how normal patches flow into a simple bell shape and flags patches that land in low probability zones as defects.
Why Does This Exist?
Memory banks grow with data and Gaussian bells miss curved normal shapes. Brushed textures and printed patterns form manifolds that bend. Factories need compact models that learn the bend and still localize.
FastFlow exists as the flow answer. Input is normal only images. Output is per patch likelihood plus a heatmap where low likelihood glows. The line frame is industrial vision; the supervised route is defect detection. The per position bell sibling is PaDiM.
Use it when normal texture curves beyond one bell and memory feels heavy. Use memory or bells when training budget is tiny or data is few hundred images.
Think of It Like This
A subway map that straightens a river
A river bends through town. A transit map redraws it as a straight line so distance along the river reads cleanly. A house far from the straightened line sits far along the true bend too.
The flow is that redrawing from patch texture to a round bell. Log likelihood is distance from the center on the straightened map. The analogy stops at invertibility: the transit map need not bend back exactly, while the flow must reconstruct its input to keep probabilities honest.
How It Actually Works
A 2D normalizing flow stacks invertible affine steps over patch features, preserving positions so maps stay sharp. Training maximizes log likelihood of normal patches under the mapped bell. At test time each patch reports ; low values mean the model spent little mass there. Negate and upsample for the heatmap. Clean patches near look routine while a scratch at stands nats below, an enormous probability gap.
Worked example
Three patches score , , and . Mean clean sits near . The scratch gap is nats, meaning the model finds it about times less likely than clean texture. A cut at passes and and flags . The heat peak lands on the scratch stroke while printed text stays dark because the flow learned print as normal.
Watch Out For
Flow that memorizes position instead of texture
With fixed pose the flow can cheat by learning where, not what, and flag any shift as defect. The symptom is edge glow on good parts after tiny moves. Fix it with mild translation jitter in training and by checking likelihood on shifted good images before shipping.
Thresholds tuned on too few anomalies
Teams with five defect images pick a cut that separates those five perfectly and fails the sixth shape. The symptom is silent misses on new scratches. Fix it by setting the cut on normal validation quantiles plus synthetic streaks, then updating after field audits.
The Quick Version
- FastFlow maps normal patches to a round bell with invertible steps.
- Score is log likelihood ; low means strange.
- The fixture flags against clean and at a cut.
- Position preserving steps keep heatmaps sharp on strokes.
- Jitter training and quantile cuts stop position cheating and thin thresholds.