Beyond CLIP: Calibrated (Few-Shot) Defect Detection With System One Decision Models
Organizations: Farmer School of Business, Miami University, Oxford, OH 4050, USA · College of Arts and Sciences, University of Dayton, Dayton, OH 45469, USA
Abstract
Cameras and vision sensors are widely used for product and process inspection in manufacturing environments. Traditionally, this process required thousands of images of both nominal and defective products to train such models. Recent research shows that vision transformer (ViT) models, such as CLIP, can reduce this requirement to 50-100 images per nominal and defective class. However, collecting even 50 defective images can be difficult in high-yield or low-volume manufacturing processes. In this paper, we examine the utility of two recently proposed structured decision models (Jev and Clef-Flash) in applications using as few as k=2 reference images per class at inference. In the process, we provide three main contributions: (a) a framework for k-shot learning of these models for image classification/inspection applications; (b) an agentic approach for automatically refining the text descriptions that guide image classification in these decision models; and (c) an approach to calibrate the resulting defect probabilities to improve their reliability for inspection decisions. We test these contributions in five manufacturing case studies. Using two reference images per class, both Jev and Clef-Flash outperform CLIP's test accuracies with the same references (0.75-1.00 [Jev] and 0.71-0.99 [Clef-Flash] vs 0.67-0.84 [CLIP]). Furthermore, we show that our agentic refinement of text descriptions significantly improves accuracy across 6 of 8 model-application combinations, and our calibration approach reduces the Brier score in 13 of the 15 model-application configurations. To support the reproducibility of our work, we provide our replication code and have created the R "decisions" package for evaluating additional models. We also provide a publicly available web app that allows practitioners to inspect their own images with no code.
Figures & tables
| Learning Set | Partition of | Evaluation | |||
| Case Study | Test | ||||
| Pans | 10 | 2 | – | – | 78 |
| Extrusion | 50 | 2 | 48 | 25 | 200 |
| Textiles | 50 | 2 | 48 | 25 | 200 |
| Pipe staples | 50 | 2 | 48 | 17 | 100 |
| Microstructure | 50 | 2 | 48 | 25 | 450 |
| Candidate 1 , development AUC 0.59 | |
| Nominal | No visible manufacturing defects; the part appears conforming. |
| Defective | At least one visible manufacturing defect or anomaly. |
| Candidate 2 , development AUC 0.74 | |
| Nominal | A close-up of a 3D printing nozzle and freshly extruded plastic; the extruded material forms a smooth, even layer of steady width that lies flat on the print surface. |
| Defective | A close-up of a 3D printing nozzle and extruded plastic where the amount of material is wrong: either a thin, stringy or broken strand with dark gaps showing through, or a bulging, blobby, overly wide mass of plastic. |
| Candidate 3 , development AUC 0.78 | |