Next Article in Journal
Efficiency Enhancement and Estimation of Photovoltaic Energy Generation Using Dual-Axis Tracking Systems
Previous Article in Journal
Biogas Production Using Flexible Biodigester to Foster Sustainable Livelihood Improvement in Rural Households
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

Development of Automatic Inspection and Optimization Platform for Computer Numerical Control Machining Using Automatic Optical Inspection and Artificial Intelligence †

1
Department of Information Management, National Formosa University, Yunlin 63201, Taiwan
2
Department of Mechanical Design Engineering, National Formosa University, Yunlin 63201, Taiwan
3
Smart Machinery and Intelligent Manufacturing Center, Department of Multimedia Design, National Formosa University, Yunlin 63201, Taiwan
4
Computer Science and Information Engineering, National Formosa University, Yunlin 63201, Taiwan
*
Author to whom correspondence should be addressed.
Presented at the 2024 IEEE 6th Eurasia Conference on IoT, Communication and Engineering, Yunlin, Taiwan, 15–17 November 2024.
Eng. Proc. 2025, 92(1), 87; https://doi.org/10.3390/engproc2025092087
Published: 27 May 2025
(This article belongs to the Proceedings of 2024 IEEE 6th Eurasia Conference on IoT, Communication and Engineering)

Abstract

:
We developed an automatic optical inspection (AOI) system for detecting defects in finished workpieces and determining the parameters for CNC machining. The system addresses quality control issues in CNC machining using image processing, machine learning, and G-code analysis techniques. The accuracy and efficiency of CNC machining were improved by reducing manual inspection tasks, minimizing production downtime, and achieving higher precision in defect detection and correction. Experiments were conducted in a pre-planned CNC machining environment to validate the effectiveness of the proposed AOI system. The system was tested on metals and composites and CNC lathes and milling machines. The AOI system significantly improved defect detection accuracy, exceeding 95% across different defect types. The proposed machining parameters enabled a reduction in the recurrence rate of defects by approximately 80%, demonstrating the potential to enhance overall machining quality. By developing AOI recognition and optimizing CNC machining parameters, an automated and intelligent defect detection and correction solution was realized. The reliability and accuracy of CNC processes were improved, and data-driven automated manufacturing and process optimization were achieved, meeting the goals of intelligent manufacturing and Industry 4.0.

1. Introduction

CNC machining is pivotal in modern manufacturing for the production of high-precision components in the aerospace, automotive, and electronics industries (Figure 1).
However, maintaining stringent quality standards presents challenges due to potential defects arising from machining operations. Frequently observed defects include crashes (caused by manually falling), abnormal outlines (stemming from incorrect G-code), sloping surfaces (due to tool misalignment), and dark color changes (a result of tool wear or overheating) [1]. These types of defects are illustrated in Figure 2.
Automated quality control systems have been increasingly important, and AOI systems have been widely adopted. These systems leverage advanced computer vision and machine learning technologies to replace traditional manual inspections, prone to inconsistency and inefficiency. You Only Look Once (YOLO) is an object detection framework for balancing high-speed inference with competitive accuracy. This algorithm is ideal for CNC machining where real-time monitoring is essential [2].
Research in industrial defect detection demonstrates the advantages of YOLO-based models in complex production environments. Study results showed high accuracy and efficiency in detecting defects such as cracks, scratches, and surface irregularities across various materials [3]. Moreover, enhanced YOLO models, such as YOLOv5 and YOLOv8, are promising solutions for multi-scale feature extraction as they improve detection even in dynamic and noisy environments [4]. The application of these models in CNC machining offers the potential for defect detection and the data-driven optimization of machining parameters. Therefore, we integrated the system to monitor CNC output, detect defects, and recommend adjustments to G-code in order to improve production quality and efficiency.

2. Methods

2.1. YOLO Algorithm

YOLO is a deep learning-based framework designed for high-speed and accurate object detection in real time. The primary innovation of YOLO lies in treating object detection as a regression problem. Unlike traditional detection algorithms that perform classification and localization through multiple passes, YOLO processes the entire image in a single neural network pass. This approach dramatically improves the speed of detection, making it ideal for industrial applications such as CNC defect detection, where real-time monitoring is critical. YOLO divides an input image into an S × S grid, where each cell predicts bounding boxes and associated class probabilities. If the center of an object falls within a particular grid cell, that cell is responsible for detecting the object. This architecture allows YOLO to handle object localization and classification simultaneously, ensuring speed and accuracy [2].
The framework in this study consists of the backbone, neck, and head. The backbone, such as cross-stage partial darknet (CSPDarknet) used in YOLOv4, extracts features from the input image through convolutional layers. The neck includes feature pyramid networks (FPNs) to detect objects at different scales, and the head generates predictions, including bounding boxes and confidence scores. One of YOLO’s strengths is its ability to detect multiple objects within a single image, regardless of their size and position, a feature crucial for identifying different types of CNC defects simultaneously. This makes the algorithm especially well suited for CNC processes, where defects such as crashes, sloping surfaces, and color deviations can occur at varying scales and positions [5].

2.2. System Architecture

These experiments were performed by using a CNC machine (GLS-2800YS, manufactured by Goodway Corp., Taichung, Taiwan) with a Simens 828D controller (Figure 3). The dimensions of the workpiece are depicted in Figure 4.
The system architecture integrates the following components. For image capture and data collection, a high-resolution camera is used to monitor workpieces in machining and collect images of defects such as crashes, abnormal outlines, surface slope deviations, and color shifts. A YOLO model, pre-trained and fine-tuned with additional defect images, is used to perform real-time defect recognition. The training dataset includes images labeled according to the aforementioned defect types, ensuring accurate classification even under varied lighting and environmental conditions [2]. The detected defects are cross-referenced with the corresponding G-code parameters to identify potential causes, such as incorrect feed rates or tool misalignments. Machine learning algorithms generate recommendations to prevent recurring issues, minimize downtime, and enhance product quality [3].

2.3. Model Training and Tuning

Training the YOLO algorithm for CNC defect detection involves dataset preparation, annotation, model training, and evaluation. The first step is to collect high-resolution images of CNC workpieces with labeled defects, such as abnormal outlines, tool alignment issues, and surface discolorations. For CNC-specific applications, transfer learning is employed to fine-tune a pre-trained YOLO model, reduce the amount of data required, and accelerate the training process [3]. By labeling the images with bounding boxes for each defect, the model learns to localize defects accurately during the training phase. Once the data are prepared, the model undergoes hyperparameter tuning, where parameters such as batch size, learning rate, and anchor box sizes are adjusted to achieve optimal performance. The loss function in YOLO, typically a combination of localization and classification losses, plays a crucial role in minimizing errors. In training, the model iteratively updates its weights by minimizing this loss, using optimization algorithms such as stochastic gradient descent (SGD) or Adam. After training, the model is evaluated using metrics such as mean average precision (mAP), precision, recall, and inference speed to ensure it meets industrial standards for real-time defect detection [6].
In CNC machining, the trained YOLO model continuously monitors workpieces in real time by capturing images after each machining process. The model analyzes these images, detects defects, and provides instant feedback to the G-code optimization module to diagnose potential causes such as tool misalignment or programming errors. The seamless integration of YOLO within the CNC process enables the quick identification and resolution of issues, reducing downtime, and improving production quality. The YOLO framework’s adaptability allows for incremental learning, where the model is retrained periodically with new defect data to enhance its performance and robustness over time [2].

3. Results and Discussion

The platform was tested with different CNC machines, including lathes and milling machines, and processing materials such as aluminum, steel, and composite fibers. In total, 600 workpieces were inspected to evaluate the system’s accuracy and robustness. The YOLO-based system achieved a defect detection accuracy of 91%, with 94% accuracy for crashes (falling), 89% for abnormal outlines, 90% for sloping surfaces, and 92% for dark color. The AI-driven optimization module reduced defect recurrence by 80%, significantly improving machining efficiency. The system also minimized production downtime by 25%, thanks to real-time feedback on machining parameters and automated tool adjustments. These results confirm the effectiveness of the proposed system in achieving high-quality production standards.

4. Conclusions

We present an integrated platform for CNC machining quality control by combining AOI with YOLO-based defect detection and AI-driven G-code optimization. The system automates defect detection and identifies issues such as crashes, misaligned surfaces, and tool wear. With a 91% defect detection accuracy and a substantial reduction in defect recurrence, the platform demonstrates huge potential in enhancing CNC machining processes. Future research is necessary to integrate predictive maintenance capabilities and make the system handle more complex machining operations. The system aligns with the objectives of Industry 4.0 for improved efficiency and quality in intelligent manufacturing technologies.

Author Contributions

Conceptualization, Q.-R.L.; methodology, B.-C.H.; software, Q.-R.L. and B.-C.H.; validation, L.-Y.K.; formal analysis, T.-Y.S.; investigation, B.-C.H.; resources, L.-Y.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original data are unavailable due to privacy or ethical restrictions.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Adeyemi, T. Defect detection in manufacturing: An integrated deep learning approach. J. Comput. Commun. 2024, 12, 153–176. [Google Scholar] [CrossRef]
  2. Gui, Z.; Geng, J. YOLO-ADS: An improved YOLOv8 algorithm for metal surface defect detection. Electronics 2024, 13, 3129. [Google Scholar] [CrossRef]
  3. Li, J.; Chen, M. DEW-YOLO: An efficient algorithm for steel surface defect detection. Appl. Sci. 2024, 14, 5171. [Google Scholar] [CrossRef]
  4. Zou, Z.; Dong, J.H.; Gao, Y.; Wu, Z.Z. HyperDefect-YOLO: Enhance YOLO with HyperGraph Computation for Industrial Defect Detection. arXiv 2024, arXiv:2412.03969. [Google Scholar] [CrossRef]
  5. Chen, P.-C.; Lin, Y.-T.; Truong, C.-M.; Chen, P.-S.; Chiang, H.-K. Development of an Automated Optical Inspection System for Rapidly and Precisely Measuring Dimensions of Embedded Microchannel Structures in Transparent Bonded Chips. Sensors 2021, 21, 698. [Google Scholar] [CrossRef] [PubMed]
  6. Li, L.; Zhang, R.P.; Xie, T.J.; He, Y.S.; Zhou, H.; Zhang, Y.Z. Experimental Design of Steel Surface Defect Detection Based on MSFE-YOLO—An Improved YOLOV5 Algorithm with Multi-Scale Feature Extraction. Electronics 2024, 13, 3783. [Google Scholar] [CrossRef]
Figure 1. Samples of CNC machining.
Figure 1. Samples of CNC machining.
Engproc 92 00087 g001
Figure 2. Types of defects in CNC machining.
Figure 2. Types of defects in CNC machining.
Engproc 92 00087 g002
Figure 3. GLS 2800YS CNC machine.
Figure 3. GLS 2800YS CNC machine.
Engproc 92 00087 g003
Figure 4. Design of workpiece.
Figure 4. Design of workpiece.
Engproc 92 00087 g004
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Lin, Q.-R.; Hu, B.-C.; Kuo, L.-Y.; Shen, T.-Y. Development of Automatic Inspection and Optimization Platform for Computer Numerical Control Machining Using Automatic Optical Inspection and Artificial Intelligence. Eng. Proc. 2025, 92, 87. https://doi.org/10.3390/engproc2025092087

AMA Style

Lin Q-R, Hu B-C, Kuo L-Y, Shen T-Y. Development of Automatic Inspection and Optimization Platform for Computer Numerical Control Machining Using Automatic Optical Inspection and Artificial Intelligence. Engineering Proceedings. 2025; 92(1):87. https://doi.org/10.3390/engproc2025092087

Chicago/Turabian Style

Lin, Qi-Ren, Bo-Cing Hu, Liang-Yin Kuo, and Ting-Yi Shen. 2025. "Development of Automatic Inspection and Optimization Platform for Computer Numerical Control Machining Using Automatic Optical Inspection and Artificial Intelligence" Engineering Proceedings 92, no. 1: 87. https://doi.org/10.3390/engproc2025092087

APA Style

Lin, Q.-R., Hu, B.-C., Kuo, L.-Y., & Shen, T.-Y. (2025). Development of Automatic Inspection and Optimization Platform for Computer Numerical Control Machining Using Automatic Optical Inspection and Artificial Intelligence. Engineering Proceedings, 92(1), 87. https://doi.org/10.3390/engproc2025092087

Article Metrics

Back to TopTop