Skip to main content

Model Comparison, Explainability and Trust in Computer Vision

· 6 min read
Ross Bulat
Full Stack Engineer

Using Yu et al. (2024) as a comparison framework, I consider how conventional machine learning and deep learning could be evaluated for production-line visual inspection, and how their decisions could be explained to the people expected to act on them.

1. Model Comparison in Practice: Visual Defect Inspection

My selected domain is automated visual quality inspection, specifically estimating surface defects from production-line images to decide whether an item should pass, be reworked or receive manual inspection. A conventional pipeline might extract colour, edge, texture and defect-area measurements for a random forest, support vector machine, multilayer perceptron or decision tree. A CNN instead learns spatial features directly from pixels, which suits the local relationships among edges, textures and shapes (Mienye and Swart, 2024).

Yu et al. (2024) solve a different but transferable regression problem: predicting supply-chain management distribution cost (SCMDC) from 12 order and shipping variables. Their 180,519 records are divided into 70% training, 15% testing and 15% validation data. Five model families are evaluated on the same target, partitions and error measures. The labelled test results in Table 2 are:

ModelRMSE
CNN0.5180.961
Decision tree1.3720.896
Random forest1.7380.892
SVM1.8150.887
MLP1.8740.885

Lower RMSE indicates predictions closer to observed costs, while higher R² indicates more explained variance. The paper also reports a narrower CNN test-error range (−6.8 to 10.3). However, its abstract and conclusion describe RMSE 0.528 and R² 0.953 as test results, although the table labels them as training results. I therefore use the explicitly labelled test table above.

CNNs learn visual hierarchies without predefined features but often require more labelled images, specialist hardware, training time and energy. Traditional models can compete on smaller datasets, run cheaply on CPUs and expose engineered inputs; a shallow tree is especially transparent. Yet feature engineering may discard information and transfer poorly when lighting, cameras or materials change. Deployment efficiency should therefore always be measured.

For a defensible experiment, I would use the same batch- and time-separated test set for every model. I would report RMSE and R² alongside errors by defect and product type, then measure latency, memory use and energy consumption. Batch separation prevents nearly identical items leaking across random splits. Because Yu et al. use tabular rather than image data, their findings offer a comparison method to reproduce in a multitude of visual-inspection scenarios, but not a direct performance benchmark.

2. Explainability and Trust in an Inspection System

Because the model informs whether an item is accepted, reworked, sent for further inspection or scrapped—and may even trigger a production-line stop when defects cluster—its recommendations have material consequences. Incorrectly rejecting an item wastes a usable product, while overlooking a defect may allow an unsafe product to reach customers and create warranty costs. Operators therefore need sufficient evidence to understand, question and, when necessary, override its recommendations.

An unexplained model may react to glare, a camera border or a supplier mark rather than the defect, or degrade after lighting and material changes. If rejections cannot be challenged, staff may defer to what looks like an objective score and accountability becomes less clear. Explanations can expose these failures and unequal errors across products, suppliers or sites. The goal is appropriate trust: users should see evidence and uncertainty.

SHAP attributes feature contributions locally and can aggregate them into global patterns (Lundberg and Lee, 2017); in a conventional pipeline, it might show that defect area and texture raised predicted severity. Image SHAP depends on masking and background choices. LIME highlights influential superpixels through a local surrogate, but its stability should be tested across runs and segmentations (Ribeiro, Singh and Guestrin, 2016). For CNNs, Grad-CAM maps influential regions without retraining (Selvaraju et al., 2017). A map may overlap a crack, but a plausible heatmap is neither causal evidence nor proof of correctness. Each method must be used with its purpose and limitations in mind (Molnar, 2023).

I would treat explainability as a product and governance requirement. Quality leads would define error costs and escalation thresholds, while inspectors would check whether highlighted regions were meaningful. Data engineers would maintain provenance and labelling guidance, and computer-vision engineers would benchmark a simple model. UX and safety specialists would test displays and probe failures. MLOps engineers would monitor drift by camera, site and product type while retaining auditable versions and decision logs.

My responsibility would be to communicate subgroup errors and limitations plainly, preserve reproducible evidence and never present an explanation as certainty. Release should require user testing, stability checks, a documented human override and feedback for disputed cases. Quantitative evidence, visual explanation and accountable review together are stronger evidence than vague measures like a black-box score or an attractive heatmap alone.

References

Lundberg, S.M. and Lee, S.-I. (2017) ‘A unified approach to interpreting model predictions’, Advances in Neural Information Processing Systems, 30. Available at: https://proceedings.neurips.cc/paper_files/paper/2017/hash/8a20a8621978632d76c43dfd28b67767-Abstract.html (Accessed: 10 June 2026).

Mienye, I.D. and Swart, T.G. (2024) ‘A comprehensive review of deep learning: architectures, recent advances, and applications’, Information, 15(12), article 755. Available at: https://doi.org/10.3390/info15120755 (Accessed: 10 June 2026).

Molnar, C. (2023) Interpretable Machine Learning: A Guide for Making Black Box Models Explainable. 2nd edn. Available at: https://christophm.github.io/interpretable-ml-book/ (Accessed: 10 June 2026).

Ribeiro, M.T., Singh, S. and Guestrin, C. (2016) ‘“Why should I trust you?”: Explaining the predictions of any classifier’, Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1135–1144. Available at: https://doi.org/10.1145/2939672.2939778 (Accessed: 10 June 2026).

Selvaraju, R.R., Cogswell, M., Das, A., Vedantam, R., Parikh, D. and Batra, D. (2017) ‘Grad-CAM: Visual explanations from deep networks via gradient-based localization’, Proceedings of the IEEE International Conference on Computer Vision, pp. 618–626. Available at: https://openaccess.thecvf.com/content_iccv_2017/html/Selvaraju_Grad-CAM_Visual_Explanations_ICCV_2017_paper.html (Accessed: 10 June 2026).

Yu, X., Tang, L., Long, L. and Sina, M. (2024) ‘Comparison of deep and conventional machine learning models for prediction of one supply chain management distribution cost’, Scientific Reports, 14, article 24195. Available at: https://doi.org/10.1038/s41598-024-75114-9 (Accessed: 10 June 2026).