An inspection camera misses cracked parts. Should you give the neural network more training images, change the warning threshold, or replace it with a simple rule? All three could change its accuracy. Only one might fix the problem on your production line. Start with the decision the model gets wrong, then change one condition at a time.
Start with the cost of a miss, not the accuracy score
Suppose a line produces 100 parts: 95 sound and five cracked. A rule that passes every part is 95% accurate and misses all five cracks. Compare it with a hypothetical network that catches four cracks but also flags four sound parts. It still gets 95 of 100 right. Look at the eight parts sent for inspection: four are cracked (50% precision). Of the five cracked parts, it catches four (80% recall). These are invented counts, not results from a trained model.
Is that an improvement? If the inspector can check eight flags per hundred and a missed crack is costly, it may be. If the inspector can only check two, this threshold will not work. Choose a recall target and a review budget before tuning. Use the same held-out parts to compare the network with your current inspection rule, not just with the deliberately weak “pass everything” baseline.
Training looks good, but new parts fail inspection
First ask what “new” means. If adjacent frames of the same part appear in both training and validation, the model can recognize a part it has already seen. Look for shared part IDs across the split. Keep all frames of each part together and rerun the comparison with the same model settings. A drop on the grouped split and evidence of shared IDs weaken the original score; a drop alone does not prove leakage. The scikit-learn developers’ leakage example shows a related trap: selecting features before the split lets test labels influence training.
If the parts are independent and come from the same line, compare training and validation loss over time. Training loss that keeps falling after validation loss starts rising points toward overfitting. Select an earlier checkpoint on validation data; check it once on untouched test parts. Early stopping cannot repair a contaminated split. If even training loss stays flat, inspect a small batch and its labels before increasing model size. For the specific case of updates fading in early layers, see how to diagnose vanishing gradients.
The same part gets a different verdict at another station
A new camera may hide fine cracks, or the network may be using the tray as a cue. To separate those explanations, photograph the same labeled parts on both trays with the camera and lighting fixed. Then keep the tray fixed and vary the camera. Check that a human can still see the crack. If flags follow the tray rather than the part, collect examples of cracked and sound parts on each tray and retest on a station excluded from training. If neither camera nor inspector can resolve a crack, better labels alone will not restore the missing detail.
This paired test is illustrative. In an actual texture-versus-shape experiment, Robert Geirhos and colleagues gave ImageNet-trained networks conflicting cues and found that the tested networks tended to follow texture. That result motivates changing one cue at a time; it does not establish what an inspection camera uses.
The model is confident even when it is wrong
One wrong prediction at 90% confidence is not a calibration failure. On a labeled holdout, collect many predictions near 90%, count how often the predicted class is correct, and compare that fraction with their mean confidence. Break the counts out by station: a small group may tell you very little. If classes are usually ranked correctly but confidence runs high, fit a calibration adjustment on separate data, then recheck it on untouched examples. In On Calibration of Modern Neural Networks, Chuan Guo and colleagues found temperature scaling helpful on most datasets they tested. It rescales scores without changing the top-ranked class; it cannot make a missed crack visible.
The network is accurate enough but too slow for the line
Time capture, resizing, inference, and delivery of the verdict separately on the actual device, one part at a time under normal load. Compare the 95th-percentile end-to-end time with the deadline for diverting a part. If the camera transfer dominates, shrinking the network may save almost nothing. If inference dominates, try a smaller network or a simple inspection rule, then remeasure both latency and crack recall. Keep the simpler system if it meets the same decision requirements. For the underlying trade-off, see how neural networks compare with other machine learning methods.
Further reading: Goodfellow, Bengio, and Courville’s Deep Learning covers regularization and the practical methodology behind these checks. As an Amazon Associate I earn from qualifying purchases. View the MIT Press hardcover on Amazon US.



