There is no single number, but as a starting point, an AI visual inspection proof of concept usually needs a few hundred images of good parts and dozens of real examples of each defect type; a production model typically grows to thousands of good images and a hundred or more per important defect. Anomaly detection can start from good parts alone. Consistency of the imaging and of the labels matters more than raw quantity: 300 well-lit, consistently labeled images beat 3,000 messy ones.
This article is part of our guide to industrial AI. Data is the longest and most underestimated step of an AI vision project, so here we cover what drives the number, how to plan a data collection, labeling, augmentation and synthetic data, and what to do when defects are rare.
What drives how much data you need
| Factor | Needs less data | Needs more data |
|---|---|---|
| Imaging consistency | Fixtured parts, controlled lighting | Random orientation, ambient light changes |
| Natural variation of good parts | Machined metal, molded plastic of one color | Castings, wood, food, textiles, many colors or suppliers |
| Defect contrast | Obvious, high-contrast defects | Faint, low-contrast or tiny defects |
| Number of defect classes | Pass/fail only | Many classes to sort by type |
| Model approach | Anomaly detection, transfer learning | Training from scratch, fine-grained classification |
| Label quality | One clear written standard | Inspectors disagree on borderline parts |
A practical data plan
| Stage | Good parts | Each defect type | Purpose |
|---|---|---|---|
| Feasibility check | 50–100 | 10–20 | Confirm the defect is visible in the images |
| Proof of concept | 300–1,000 | 30–100 | Train a first model and estimate accuracy |
| Production model | 1,000–5,000+ | 100–500+ | Cover lots, shifts, suppliers and borderline cases |
| Ongoing | Continuous sample | Every new escape or false reject | Monitor drift and retrain |
These are typical ranges, not rules. A consistent, fixtured part with obvious defects may need far fewer; a natural product with subtle defects may need more. Set aside a separate test set, never used in training, that represents real production, including borderline parts, to measure the final false-reject and escape rates.
First, make sure the defect is visible: a resolution check
No amount of data fixes a defect the camera cannot resolve. A common rule of thumb is that the smallest defect should span at least 3 to 5 pixels.
Worked example: a 50 mm field of view on a camera 2,448 pixels wide gives 50 ÷ 2,448 ≈ 0.020 mm per pixel. A 0.1 mm scratch covers about 0.1 ÷ 0.020 ≈ 4.9 pixels, which is workable. A 0.04 mm scratch would be about 2 pixels: too small. You would need a smaller field of view, a higher-resolution camera or better lighting to raise its contrast, before collecting any training data.
The same arithmetic matters when images are resized for a model or a vision language model; see VLM token usage for how API resizing can shrink small defects.
Labeling: the step that decides accuracy
- Write a defect standard first. For each defect type: a definition, accept and reject examples and a size limit. Most “model errors” on borderline parts are label disagreements.
- Choose the label type to match the task. Image-level labels for pass/fail, bounding boxes for locating and counting, pixel masks for measuring defect area.
- Double-label a sample. Have two inspectors label the same 100 images; where they disagree, refine the standard.
- Label borderline parts deliberately. Models learn the boundary from the hard cases, not the obvious ones.
- Keep provenance. Record lot, shift, supplier and camera for every image so you can check coverage and trace problems.
When defects are rare
A good process produces few defects, which is exactly what makes them hard to learn. Options, roughly in order of preference:
- Collect from scrap, rework and returns. Quarantined and returned parts are often the best defect library.
- Use anomaly detection. Train on good parts only and flag anything unusual; real defects are then needed only to validate the threshold. See AI anomaly detection.
- Use transfer learning. Start from a network pre-trained on millions of general images and fine-tune it, which cuts the images needed. See transfer learning in AI vision.
- Create defects deliberately. Seed scratches, contamination or missing features on sacrificial parts, as long as they look like real defects.
- Augment. Rotations, flips, small shifts, brightness and blur variations multiply the dataset, but only within variations that can really occur on the line.
- Add synthetic images carefully. Rendered or generated defects can fill gaps, but a model trained mostly on synthetic data may not transfer to real images. Always validate on real parts.
Balance and splits
If 98% of images are good, a model can score 98% accuracy by calling everything good. Track recall (the share of defects caught) and false-reject rate separately, not overall accuracy. Split data by lot or by time rather than at random, so near-identical images of the same part do not land in both training and test sets and inflate the results.
After launch: drift and retraining
Images change over time: new suppliers, tooling wear, lighting aging, product revisions. Plan for it from the start:
- Log every image with its model score, at least for rejects and low-confidence passes
- Review a random sample of passes and all rejects regularly
- Add every escape and false reject to the training set with a correct label
- Retrain on a schedule or when score distributions shift, and re-validate before release
- Keep previous model versions so you can roll back
Not sure your parts and data are ready for AI?
Sciotex runs feasibility checks on your parts, then designs and builds industrial AI systems with the imaging, data collection and labeling standard to make them work, designed, programmed, built and supported in the US since 1997.
Frequently asked questions
A proof of concept usually starts with a few hundred good images and dozens of examples of each defect type. Production models typically use thousands of good images and a hundred or more per important defect, depending on part variation and defect subtlety.
Yes, with anomaly detection, which learns what normal looks like and flags deviations. You still need some real defects to check that the threshold catches them.
It can fill gaps, especially for rare defects, but models trained mainly on synthetic images often perform worse on real parts. Mix it with real data and always validate on real production images.
It is limited by the imaging, not the AI. As a rule of thumb, the smallest defect should span at least 3 to 5 pixels with enough contrast, which sets the field of view, camera resolution and lighting.
When the process or images change, such as new suppliers, product revisions or lighting changes, and whenever escapes or false rejects reveal gaps. Many plants also retrain on a regular schedule with newly reviewed images.