Article sections
1. First, make the physical problem measurable2. Do not start the comparison with the model alone3. Method 1 - Improving the optics and inspecting with simple rules4. Method 2 - Classical image processing5. Method 3 - Image classification with a CNN6. Method 4 - Supervised detection or segmentation7. Method 5 - Anomaly detection8. Exactly what outputs do the five methods produce?9. Requirements for a fair experimental design10. Compare performance and maintenance costs together11. Change the scenarios before choosing a winner12. Why do surface differences lead to misleading comparisons?13. Ways to simplify the same vision problem14. Creating a second stage for uncertain decisions15. Report format for the pilot comparison16. An example decision: which method would I choose?17. Release and lifecycle requirements18. Which method is more affected when scratch orientation changes?19. How does the comparison change as defect width decreases?20. How can the experiment remain fair with few defective samples?21. Labeling quality affects the methods differently22. Identify each method's hardest negatives in advance23. The final decision: a single champion or a sustainable workflow?24. Which method handles borderline samples better?25. Separate optical and model effects in the experimental design26. Runtime comparisons should not be reduced to a single FPS figure27. Feed production errors back into the comparison28. Reading the five methods in a single test table29. Reusable outputs of the comparison30. Can results be transferred from one product family to another?31. What evidence should complete the comparison decision?Frequently asked questionsReferences and further readingDo we have to train a model for a scratch? Sometimes changing the lighting angle simplifies the entire problem; sometimes only a learning-based model can tolerate the surface's natural variability. A sound comparison is based on the same part, the same cost of errors, and the same acceptance criterion.
Imagine that we are inspecting surface scratches on an aluminum housing production line. The part is reflective, and machining marks form natural patterns on its surface. Some scratches are thin and long; others are short and wide. The quality team wants to reject scratches that create a functional risk or exceed the cosmetic threshold. There are five candidate solutions for the same image: rule-based inspection enhanced by an optical setup, classical image processing, CNN classification, supervised detection/segmentation, and anomaly detection that learns from normal samples.
This article does not aim to declare a particular algorithm the winner. How do we set up a comparable experiment, identify the conditions under which each method will fail, and select the most appropriate solution for production? These are the questions we want to answer. The metal part, defect markings, and algorithm outputs in the illustrations are educational simulations, not results obtained from actual trained models.
1. First, make the physical problem measurable
Let us assume that the part surface to be inspected measures 80 x 60 mm, the smallest meaningful scratch width is 0.12 mm, and the cycle time is 250 ms. These values are an application example; in an actual design, they must be verified against the quality standard and product geometry. Scratch location also matters: the same mark on a sealing surface may be subject to a different acceptance rule than on a decorative surface.
Using only an 'is there a scratch?' label leaves borderline samples ambiguous. A machined surface may contain normal tool marks, oil residue, fingerprints, and directional reflections. Defining normal variation is therefore as important as measuring defects. A reference gallery should be prepared with the quality team, and disputed samples should be handled separately. Using one image of a part under one lighting condition for training and another image of the same part under different lighting for testing can create data leakage.
Let us also assume the business objectives for this case: a high capture rate for critical scratches, avoiding capacity overload due to false rejects, and recording all decisions against the correct product identity. The comparison is not fair unless the methods are tested against the same defect class and operational constraints.
2. Do not start the comparison with the model alone
Although the initial input to all five methods appears to be a 'picture,' image quality determines each method's performance. Lighting, focus, lens, polarization, and mechanical positioning are common factors. First establish a reference image acquisition setup using the same camera and fixed geometry. If optical improvement is to be compared as a separate method, include its hardware and setup costs alongside those of the other options.
At a station that makes the same defect visible in some images but not in others, an advanced algorithm's performance can be misleading. Document contrast variation by imaging reference samples across different shifts, batches, and product positions. Specular reflections, especially on shiny surfaces, can create false marks that resemble scratches. A model cannot be called 'robust' unless these factors are represented in the test set.
3. Method 1 - Improving the optics and inspecting with simple rules
The first candidate attempts to increase the defect's physical visibility. Scratch contrast can be changed using bright-field or dark-field illumination, directional line lighting, or polarization. In a dark-field arrangement, some scratches may appear bright because of scattered light while the smooth portion of the surface remains dark. This does not hold for every surface; machining direction, coating, and scratch geometry all have an effect.
When the defect is clearly distinguishable, simple thresholding or a region-size or length rule may be sufficient. Development costs may be low, explainability high, and latency short. However, the product must be positioned at the same angle every time, light intensity must remain stable, and normal tool marks must be distinguishable. The optical setup may take up physical space, and a new surface coating may require readjustment.
The critical point is this: the optical design and the rule-based algorithm must be evaluated as a single system. Making a defect visible at one lighting angle does not mean that all defects will be captured consistently. Test performance on the hardest negatives.
4. Method 2 - Classical image processing
The second candidate processes intensity or color differences in the image. An example workflow might include image alignment, correction of nonuniform illumination, noise reduction, local thresholding, morphological filtering, and contour features. A scratch can be defined as a region with a high length-to-width ratio. The method risks confusing natural linear tool marks on the surface with actual defects.
The strength of the classical approach is its controllability. The output of each step can be examined, revealing which filter or threshold caused an incorrect decision. However, a system optimized for one threshold value may break down under new oiling or brightness conditions. Adaptive thresholding can mitigate some variation, but it is not a solution on its own if physical contrast is insufficient.
In actual production, the system's maintenance burden grows as the number of rules increases. A rule chain with dozens of exceptions can sometimes become harder to maintain than a small CNN. It is therefore necessary to measure whether the initial simplicity can be preserved throughout the system's lifetime.
5. Method 3 - Image classification with a CNN
The third candidate classifies the entire image or a particular surface patch as 'nondefective/defective.' Labeling appears straightforward: assigning one label to an image is often less expensive than preparing a pixel mask. However, a small scratch may disappear within a large image. It may therefore be necessary to split the image into patches, maintain an appropriate resolution, or use attention mechanisms.
A CNN can be a strong choice because it can learn to distinguish defects across different contrast levels and normal surface variation. Nevertheless, it must be tested to determine whether it is looking at the intended defect or at incidental cues such as lighting, batch labels, or the camera background. Grad-CAM-type visualizations can help, but they are not causal evidence on their own. Another limitation of classification is that it does not inherently provide the defect's location or actual dimensions.
Classification may suffice if the business objective is simply to sort products. If operators need to see the defect location, count multiple defects, or mark a repair area, the localization requirement may make classification inadequate.
6. Method 4 - Supervised detection or segmentation
Object detection attempts to produce a bounding box for a scratch, while segmentation attempts to produce a pixel-level mask. These approaches are suitable for showing where a defect is, finding multiple scratches on the same part, and applying stricter quality rules in certain regions. Because thin, elongated scratches can be awkward to represent with conventional rectangular boxes, a rotated box or pixel mask may be more informative.
The cost of this flexibility is data labeling. If two experts draw defect boundaries differently, the consistency of the training masks decreases. Pixel scale and label resolution also become critical for fine defects. Segmentation should not be assumed to constitute physical measurement with micrometer precision; that requires camera calibration and measurement uncertainty assessment.
A supervised detection model may struggle to capture previously unseen defects. A change in product family may require new annotations and retraining. Nevertheless, it is a strong candidate for lines with clear defect definitions, recurring classes, and sufficient training data.
7. Method 5 - Anomaly detection
In anomaly detection, the model primarily learns normal product examples and flags regions that deviate from that distribution. PaDiM, PatchCore, and similar representation-based approaches can be investigated when very few well-labeled defect examples are available. An anomaly heatmap shows regions that the model finds unusual. However, 'unusual' and 'defective according to the quality standard' are not the same concept.
For example, a new but acceptable surface machining pattern may produce a high anomaly score. Conversely, hidden defects recorded as normal during training can corrupt the method's reference. Challenging benchmarks such as MVTec AD 2 demonstrate why variable lighting and fine defects are difficult for anomaly detection; because of the dataset's noncommercial license conditions, we do not republish its images on this blog without permission.
The strength of anomaly detection is its potential to reduce the need for defect examples. Its weakness is that setting a reliable production threshold and maintaining representative normal variation can be difficult. It may therefore be necessary to route uncertain samples into a reinspection workflow rather than automatically rejecting products based solely on an anomaly score.
8. Exactly what outputs do the five methods produce?
The first and second approaches generally produce rule-based nondefective/defective decisions and geometric candidate regions. A classification model provides a class score. Detection produces a class, box, and confidence score; segmentation produces a mask and region features. The anomaly approach may provide a score for deviation from normal and a localization map. None of these outputs is a direct physical defect measurement without proper calibration and an acceptance procedure.
The comparative images below show, on the same synthetic metal surface, what outputs of these types might look like. The images were prepared for educational purposes; no CNN, detector, or PatchCore model was run. Keeping this distinction explicit prevents the images from being mistakenly interpreted as performance evidence.

Enhancing contrast with lighting
Educational simulation; not an actual trained model output.

Classical edge representation
Educational simulation; not an actual trained model output.

Classification input
Educational simulation; not an actual trained model output.

Illustrative mask
Educational simulation; not an actual trained model output.

Illustrative anomaly heatmap
Educational simulation; not an actual trained model output.
9. Requirements for a fair experimental design
The fundamental rule of the comparison is to use, as far as possible, the same product, the same defect definition, an independent test group, and the same operating cost basis. Each method should be tested with settings that suit its strengths, but those settings must not be selected using the test set. Optimize hyperparameters, lighting angles, or thresholds only on development data. The final test set should be reserved for a single independent evaluation before the decision.
Data should be split by product/lot. If close-up images of the same part appear in both training and testing, this may create an unfair advantage between methods. Record the labeling time required by supervised methods, the normal-data collection burden of the anomaly method, the classical approach's optical setup requirements, and the runtime hardware of each. Measure p95/p99 end-to-end decision latency, not just average inference time.
Derive metrics from the quality objective: critical-defect recall, false rejects per 10,000 nondefective products, product-level decisions, operator review workload, maintenance labor hours, and total cost. Good IoU from a segmentation method does not mean that it is economically effective for automatic rejection decisions. Measure the quality of the required final production decision for each method.
10. Compare performance and maintenance costs together
A method that initially looks perfect may become expensive when a new product arrives. Maintenance items include new lighting settings or thresholds in a rule-based system, new labeled examples for a CNN, new pixel masks for segmentation, and updates to the reference normal distribution for anomaly detection. The systems differ in how they are updated and in the expertise they require.
Total cost of ownership must therefore account for hardware, data collection, labeling, training, production monitoring, and maintenance following errors together. Although a simple method may require a low initial investment, increasing product variety may require the management of many recipes. Although a deep learning model may have a high initial cost, its redevelopment burden for new products may be lower if it generalizes sufficiently. The outcome can only be established using field data.
11. Change the scenarios before choosing a winner
It is easy to declare a winner in a five-method contest, but the ranking of the selected methods can change with defect type, lighting, product variety, and training data. Optics + thresholding may have an advantage for a high-contrast scratch in a fixed position. Supervised segmentation may be more suitable when visual diversity is high but a large labeled dataset is available. Anomaly detection can be investigated when defect examples are almost nonexistent.
This assessment is a basic suitability analysis; the scores used in the tool below are not actual test results. Users can vary conditions such as data volume, line speed, defect variety, and maintenance capacity to see which methods might take priority for a pilot. The tool does not, on its own, make a purchasing or production deployment decision.
Preliminary assessment of five approaches
Change the production conditions. The results are illustrative suitability priorities, not actual benchmark scores.
12. Why do surface differences lead to misleading comparisons?
Shiny aluminum, brushed stainless steel, painted sheet metal, textiles, and plastics may bear marks resembling the same family of visual defects, but their interactions with light and normal surface variations differ. A feature extractor that performs well on one dataset should not be assumed to transfer to another material with the same reliability. Even surface orientation, oil film, or temperature on the same material can change the result.
Benchmark results therefore do not replace field performance. A benchmark helps researchers compare methods; field acceptance requires testing with actual product batches, lighting conditions, and the costs of incorrect decisions. The licensing and reuse conditions for benchmark images must also be checked separately before sharing images on the blog.
13. Ways to simplify the same vision problem
In some projects, improving the process to prevent a defect gives better economic results than detecting it. Presenting the part to the camera in a fixed orientation, reducing vibration, removing surface oil before inspection, or using a standardized lighting enclosure can reduce differences between methods. Such improvements increase the reliability of all solutions, independently of the classification algorithm.
However, process changes can add a production burden. Cleaning the part surface, for example, may add cycle time, material costs, or safety requirements. The total cost of simplification must therefore also be calculated. Rather than the 'simplest algorithm,' the simplest reliable system should be the goal.
14. Creating a second stage for uncertain decisions
We do not have to view the five methods as competitors. A fast primary inspection can route uncertain products to a more detailed second station. For example, optical rules might capture obvious defects while a CNN evaluates borderline samples; an anomaly map might indicate the region an operator should examine. The benefit of such hybrid structures depends on whether it justifies the second stage's additional latency and maintenance cost.
Hybrid systems also introduce new failure paths. The second model's result must be matched to the first stage's identity, safe timeout behavior must be defined, and the versions of both models must be tracked together. Complexity should only be added when the necessary performance gain has been demonstrated. An unnecessary second stage can introduce new points of failure into an already solved problem.
15. Report format for the pilot comparison
The pilot should deliver a standardized comparison table rather than a single score: method, dataset version, optical setup, threshold selection, critical-defect recall, false rejects, latency, manual review workload, operational cost, uncertainty, and revalidation plan. Every figure should include a sample count, confidence interval, and measurement conditions. Do not directly rank results obtained without a shared test set.
Three recommendations are useful in a report supporting management decisions: a feasible short-term solution, a medium-term development option, and unacceptable risks. For example, a conclusion such as 'the classical method under dark-field illumination meets the pilot requirements; a coating change requires revalidation rather than automatic acceptance; a segmentation alternative should be investigated for future products with high variability' combines technical and operational realities.
16. An example decision: which method would I choose?
It would not be appropriate to select a definitive method based solely on this illustrative problem definition. Nevertheless, as the first investment step, I would test optical visibility and establish a baseline solution using a classical method under controlled lighting. If that method could not provide sufficient recall for critical defects and manageable false rejects, I would add supervised detection/segmentation to the pilot candidates depending on data availability, or anomaly detection when defect examples are scarce.
The reasoning is not a belief that the simple method must win. The first experiment quickly and clearly shows how much of the problem can be explained by physical image quality. The more complex method's incremental contribution can then be measured. Engineering judgment matures not only through familiarity with the most advanced technology, but also through choosing not to use it when appropriate.
17. Release and lifecycle requirements
Even after a winning method has been identified, the project is not complete until acceptance tests and a maintenance plan have been prepared. Reproducible inspection using the same sample set, version records for camera and lighting settings, backups, error logs, a sample image archive, and approvals for retraining or readjustment underpin system reliability. It must be determined in advance which tests will be repeated when production changes affect the image distribution.
Ultimately, comparing five methods is not a competition but an exercise in improving the basis for decision-making. A well-designed comparison shows not only which method is better, but also under what conditions and why it is better, and when it needs to be reassessed.
18. Which method is more affected when scratch orientation changes?
If machining marks on a part's surface run in a particular direction, the same defect can appear with different contrast from different angles. Dark-field illumination may work well in certain directions while a scratch at another angle almost disappears. For a rule-based system, the solution is not simply to change one threshold; multidirectional illumination, imaging from different angles, or mechanically fixing the product orientation can be investigated.
Learning-based methods may be more robust to this angular change, but there is no guarantee. If training mostly contains horizontal scratches, performance on vertical scratches may decline. Rotated images used for data augmentation may help; however, rotating an image does not fully represent a new lighting condition because the physical lighting direction does not rotate with it. This nuance shows that synthetic augmentation is no substitute for collecting real data.
In a fair comparison, treat scratch orientation as a separate test slice. Reporting separate error rates for horizontal, vertical, and oblique defects can expose a weakness hidden beneath a model's average score. Results for the most critical orientation groups should enter the decision matrix alongside overall recall.
19. How does the comparison change as defect width decreases?
A defect's continued visibility is limited by the camera's field of view and pixel scale. For example, a system imaging an 80 mm-wide area across 2048 pixels has an approximate scale of 0.039 mm/pixel. A 0.12 mm-wide mark spans about three pixels. That figure alone does not establish that reliable detection is possible; lens MTF, sensor noise, exposure, and scratch contrast also matter.
In a rule-based method, thin lines may disappear during filtering. A CNN may benefit from multiscale features, but downsampling may render small defects ineffective. A segmentation mask can show the scratch location; the physical accuracy of the mask boundary must be evaluated separately. Downsampling and smoothing in an anomaly map may spread out a small defect's effect.
Separate evaluation by defect width is therefore necessary. Once the minimum size of critical defects has been established, optical resolution and the imaging design must be verified before the model architecture. Methods can only be compared meaningfully if sufficient information is present in the image.
20. How can the experiment remain fair with few defective samples?
The amount of data requiring pixel masks for supervised segmentation is not the same as the tuning data for a classical method. Nevertheless, the methods' total setup effort can be measured for comparison: labor hours for sample collection, labeling, hyperparameter trials, lighting adjustment, and acceptance testing can be recorded. Model training time alone does not capture the full cost comparison.
In a test with few defective samples, repeatedly examining the examples and adjusting thresholds accordingly effectively turns the test set into a development set. The solution is to reserve independent samples, restrict access to test data, and agree on the experimental protocol at the start of the pilot. When new data arrives, evaluation should be repeated using the same protocol.
Anomaly detection may be promising when supervised training is difficult, but the suitability of the normal dataset remains critical. If acceptable surface variations are absent from training, the model may consider normal products anomalous. Data scarcity does not automatically make any method superior.
21. Labeling quality affects the methods differently
In classification, assigning an image-level 'defective' label may be relatively easy. However, if a labeler misses a scratch in a small portion of the image, a false-negative label results. Segmentation, meanwhile, requires precisely drawn scratch boundaries; experts may outline the same defect differently. This disagreement can directly affect the pixel IoU score.
Although a classical method may appear to require few labels, it still needs a reliable reference for threshold selection and error analysis. In an anomaly method, hidden defects mixed into normal data can corrupt the learned reference. No method is therefore entirely independent of labeling quality problems. Data collection and acceptance rules form the foundation of the entire comparison.
The labeling standard should specifically include borderline samples, normal machining marks, and definitions of critical regions. A relabeling round and inter-expert agreement analysis should identify which samples are ambiguous. In practice, these ambiguous samples can be reserved for human review.
22. Identify each method's hardest negatives in advance
False positives often arise from acceptable surface features that resemble defects. Examples include oil film, glare, tool marks, label residue, or natural surface grain. Each method may have different hard negatives. A rule-based filter may count a long natural machining mark as a scratch; a CNN may associate a production batch's background with a defect; anomaly detection may interpret a new but nondefective surface type as a high deviation score.
Systematically collecting hard negatives is more useful than merely trying to reduce the overall false-alarm rate. Samples should be grouped by material, shift, lighting, product position, and resemblance to defects. A shared panel can show how the different methods score the same hard negative. This panel makes it easier to explain the reasons for preferring a method.
Focusing only on false negatives is also incomplete. On high-volume lines, even a small number of false alarms can exceed operator capacity. Decision thresholds must be selected together with actual line volume and reinspection capacity.
23. The final decision: a single champion or a sustainable workflow?
The method with the highest score at the end of the pilot may not be deployable on its own. For example, even if segmentation localizes defects better, a different production-line architecture is needed if its latency exceeds the cycle time. A classical method is fast, but its maintenance burden increases if a new coating requires frequent adjustments. Anomaly detection may be sensitive to new defects, but if false rejects are unmanageable, it may be more suitable as an operator-support tool than for automatic decisions.
The final report should therefore address the following questions about the methods together: where they are strong, where they are weak, what data they were tested on, and under what conditions they need revalidation. The decision should not rely on a single current benchmark ranking. A recommendation justified with metrics and error costs provides a shared deliverable that everyone, from the technical team to quality and management, can understand.
How revalidation will be performed during long-term operation, and who will approve changes, should also be determined at the outset. In a world of variable production processes, true success is less about selecting a model that works correctly on day one than about knowing the conditions under which that correctness will be maintained.
24. Which method handles borderline samples better?
A scratch very close to the tolerance limit can be difficult for all methods. In a rule-based system, a threshold may be sensitive to a small intensity change. A CNN may produce an unstable class score. Segmentation may draw the mask boundary a few pixels differently. Anomaly detection may be unable to distinguish normal variation from a defect. These differences are various expressions of the same problem: uncertainty exists between the physical quality standard and the information in the image.
Rather than discarding borderline samples, it is useful to create a separate evaluation set. Systematically record parts on which quality experts also disagree; if necessary, verify the actual defect size with a more precise independent measurement. When designing the band of cases to be reinspected by an operator, calculate the number of products to be reviewed and the impact on the cycle.
In the final acceptance decision, it must be clear which reference definition supports the statement 'all borderline samples were captured.' A definitive accuracy contest between models can be misleading when the actual quality boundary is uncertain.
25. Separate optical and model effects in the experimental design
If performance improves when a new model is introduced alongside a new lighting system, it becomes difficult to tell which component contributed. In a controlled comparison, a factorial approach can therefore be used wherever possible: the same model with different lighting, followed by the same lighting with different models. All combinations may not always be economical, but separating the effects of the two or three most critical variables improves decision quality.
For example, if a classical rule performs better under dark-field illumination, the CNN's incremental contribution under the new lighting must be measured separately. If the new model merely reproduces the gains of the new optical setup, choosing the more complex system may be unnecessary. Conversely, a hybrid design can be justified if combining the optical setup with a learning-based model improves results for a group of defects that neither option could capture on its own.
In these experiments, the test set must not change according to the method. The fundamental subjects of comparison should be the same physical products and the same business decision.
26. Runtime comparisons should not be reduced to a single FPS figure
A classical image processing pipeline may produce a result very quickly for a single frame. However, camera image acquisition, positioning, data copying, and the PLC response are all part of total latency. A CNN or anomaly method may run faster on a GPU, but initial loading, waiting for a batch, and queuing can increase total time. The methods must therefore be compared on the same industrial hardware, at actual line speed if possible.
Measure not only average FPS but also end-to-end p95/p99 latency, the maximum acceptable decision time, and memory behavior during prolonged operation. If products are closely spaced, latency variation can increase the risk of matching a result to the wrong product. A fast but unstable method may be harder to manage than a slightly slower but deterministic workflow.
Model optimization requires revalidation. FP16 or INT8 quantization can change prediction scores for some borderline samples. The optimized version must be tested for decision quality as well as speed.
27. Feed production errors back into the comparison
The shared laboratory test set prepared for the five methods may become inadequate over time. Difficult samples arising from new raw materials, different product variants, or after maintenance expose the methods' real limits. Their quality must be verified, and they must be appropriately versioned and added to a new evaluation set. However, if the same samples are continually used to tune hyperparameters, the strength of independent testing diminishes.
To reduce this problem, clear boundaries can be maintained between development, regression, and independent evaluation sets. A production error sample is first examined for its root cause; if the problem originates in the optics, simply adding it to model training may not be the right approach. This prevents inappropriate data accumulation.
Better method selection is not just about preserving the result of the initial comparison, but about being able to reassess using the same metrics when new evidence arrives. This discipline is fundamental to technical progress.
28. Reading the five methods in a single test table
In an example comparison report, rows might represent methods, while columns show product-level critical-defect recall, false rejects per nondefective product, end-to-end latency, labeling effort, and the cost of moving to a new product type. Rather than adding a single 'best' cell to these columns, note the conditions under which candidates that pass the acceptance limits are strong. Segmentation provides defect locations, while classification may only produce a product decision; these outputs cannot be compared using the same IoU metric.
The field experiment report should also include the number of test parts, the number of defective samples, lot distribution, lighting settings, camera model, and algorithm version. This makes it possible to determine whether a new result obtained six months later is comparable with the earlier one. Measuring one method's performance in one optical setup and another's in a different setup weakens the claim of an 'algorithm comparison.'
The report should also honestly identify areas that could not be measured. For example, if maintenance costs have not yet been observed during the pilot, they should be stated as estimates. Colorful ranking tables without sources for their numbers do not support reliable decisions.
29. Reusable outputs of the comparison
A well-designed method study leaves more than a winning model. A shared defect catalog, an independent test set, optical setup notes, a gallery of failure cases, a speed measurement protocol, and maintenance requirements can also be carried into future projects. These assets can reduce trial time when a similar inspection station is built.
The hard-negative gallery is particularly valuable for the future. An oil stain or tool mark once misinterpreted as a scratch may also trouble a new system. Similarly, records of part positioning tolerance and lighting geometry help establish which images are comparable. Archiving model weights alone does not preserve this information.
The final decision is this: rather than searching for the 'winning algorithm,' select an inspection system that aligns with the business objective and has explicit limitations. Once the required data, physical conditions, and operational responsibilities are defined, algorithm selection becomes a much better-founded technical problem.
30. Can results be transferred from one product family to another?
The same scratch detection system should not be expected to deliver identical performance across different aluminum alloys, surface treatments, or mechanical fixtures. The algorithm family may remain the same, but optical contrast, normal machining marks, defect prevalence, and the cost of incorrect decisions can change. Showing only a few easy samples from the new product family does not prove that the previous decision remains valid.
In a transfer trial, first collect reference images of the new surface, then conduct independent testing with hard negatives and critical defects. If the problem stems from optical visibility, review lighting and positioning before retraining the model. Starting from scratch for every new product may not be necessary, but which assumptions transfer must be documented. The lasting value of a method comparison lies in leaving a reusable decision protocol.
31. What evidence should complete the comparison decision?
Even if all methods were evaluated against the same defect catalog during the pilot, two additional checks are needed before making the final decision. The first is how the selected method behaves on the hardest defect and false-alarm examples. The second is which resources setup and maintenance actually require. An algorithm may be clearly better on easy examples, but if it offers no gain on borderline critical defects, it may not justify its additional cost.
The technical report should place each candidate's test conditions, validation method, and operational limits side by side. For example, specific tests can examine inter-expert mask consistency for segmentation, false alarms on new normal surfaces for anomaly detection, lighting aging and scratch orientation for optical rules, and images in which the defect occupies only a small area for a CNN. These checks make it clearer where the system is reliable.
A measurement plan must be prepared for conditions that remain uncertain after the decision. If a new product variant is introduced, what data will be collected, which acceptance test will be repeated, and who will approve the result? Declaring that 'the best method has been found' is incomplete without answers to these questions. The ultimate measure of success is not the algorithm's name, but the inspection system's repeatable and justifiable performance.
Frequently asked questions
Is YOLO or PatchCore better for scratch detection?
There is no universal answer. YOLO-like detection models use annotated defect examples, whereas PatchCore-type anomaly methods rely largely on normal examples. The decision depends on the data structure, defect diversity, and actual test results.
Should classical image processing still be used?
Yes. With controlled imaging conditions and clear geometric rules, it can be fast, understandable, and inexpensive to maintain. It has limitations when surface variation is complex.
Does an anomaly map directly provide a scratch measurement?
No. The map shows deviation from normal. Measuring physical dimensions requires camera calibration, a defined defect boundary, and uncertainty analysis.
Is segmentation always better than classification?
No. If defect location is not needed, classification can be simpler and less expensive to label. Segmentation adds value when location or shape information is necessary for the decision.
How can I compare the five methods fairly?
Use shared defect definitions and an independent test set; keep the methods' training/tuning processes separate from test data; report latency, quality, and maintenance costs together.
References and further reading
- MVTec AD - Industrial Anomaly Detection: anomaly detection research dataset, CC BY-NC-SA 4.0.
- MVTec AD 2 - Advanced Industrial Anomaly Detection: challenging lighting and anomaly scenarios, noncommercial use.
- MVTec LOCO AD - Logical Anomalies: distinction between structural and logical anomalies.
- NIST AI RMF: risk assessment and verifiable decisions.
The defect images, heatmaps, boxes, and comparison values in this article were generated synthetically for educational purposes; they are not actual trained model outputs.