Scrap iron winding detection and identification method based on YOLOv8-IFW algorithm
By integrating deformable convolution and CBAM modules into the YOLOv8-IFW algorithm, combined with telescopic diamond connecting rod transmission mechanism and visual inspection control system, the problem of poor timeliness of traditional iron chip winding detection is solved, and efficient and accurate iron chips are achieved Winding detection improves detection accuracy and system performance.
Patent Information
- Application Number
- CN202411020564.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-12
AI Technical Summary
The traditional iron chip winding detection method has poor timeliness and cannot form closed-loop control with the CNC system, resulting in limited production automation process and processing efficiency improvement.
Using the iron chip winding detection and identification method based on the YOLOv8-IFW algorithm, the deformable convolution module and CBAM attention module are integrated into the YOLOv8s backbone network, combined with the telescopic diamond connecting rod transmission mechanism and visual detection control system, contactless and non-contact Fast reaction of iron chip wrapping detection.
The high efficiency, accuracy and real-time performance of iron chip winding detection is achieved, with a detection accuracy of more than 95%. Through improved algorithms and hardware design, the detection efficiency and ease of use and scalability of the system are significantly improved.
Smart Images

Figure CN118941775A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine vision, and in particular, relates to a method for detecting and identifying iron filings winding based on a YOLOv8-IFW algorithm. Background Art
[0002] In today's global manufacturing industry, which is transforming towards intelligence and efficiency, the integration of advanced manufacturing technology and automation systems has become a key driving force for improving production efficiency and quality. As one of the basic processes of mechanical processing, the accuracy of metal cutting process control is directly related to product accuracy, production efficiency and processing costs. However, the management of iron chips generated during the cutting process has always been a difficult problem that has plagued the industry. In particular, improper handling of cutting iron chips can easily lead to serious consequences such as damage to the workpiece surface, tool failure, and even equipment jamming, which seriously restricts the production automation process and the improvement of processing efficiency.
[0003] Many scholars are committed to studying chip breaking technology to deal with the problem of chip entanglement. Feng Huayao from Shanghai University of Technology used the finite element method to explore the influence of the boss in the three-dimensional chip breaker on the chip, in order to improve the service life of carbide tools and optimize their chip breaking effect when turning titanium alloys. Zhou Qiang started from the aspects of CNC programs, tool grooves and chip breaking devices to achieve automatic chip breaking. Wu Maochao from Ningbo University designed a PCD tool with an adjustable chip breaker block at the front end, which can effectively control the regular chip breakage and ensure smooth production and safe operation. Feng Gaotou et al. summarized five commonly used chip breaking methods: chip breaker; chip breaker; chip breaking device; pre-grooving on the workpiece surface; changing tool geometric parameters and adjusting cutting parameters. Zheng Minli et al. analyzed the chip breaking effect of the combination of concave and convex surfaces. The results show that the combination of concave and convex surfaces can make the chips easy to break.
[0004] Although domestic and foreign scholars have conducted a lot of research on visual inspection technology, few have combined visual inspection technology with chip winding detection and identification. The traditional chip winding treatment method has poor timeliness and cannot form a closed-loop control with the CNC system. Summary of the invention
[0005] The purpose of the present invention is to provide a method for detecting and identifying iron chip winding based on machine vision technology, which has the advantages of non-contact, fast response and easy integration with a numerical control system, and comprises:
[0006] Requirements analysis of iron chip winding detection and identification system;
[0007] Design of telescopic on-machine vision inspection solution;
[0008] Visual inspection control system design. The control system module includes PLC module, network switch, industrial computer, four-channel digital light source regulator, photoelectric sensor switch, solenoid valve switch, servo motor and driver. The system connects different devices through the switch to achieve network communication; the digital light source regulator communicates directly with the industrial computer through the USB serial interface to adjust the light source intensity and control the operation of the motor and cylinder;
[0009] The YOLOv8-IFW algorithm for cutting chip entanglement detection integrates the deformable convolution module into the YOLOv8s backbone network, and replaces the two C2f modules adjacent to the output in the backbone network with deformable convolution modules, that is, the P3 and P4 detection layers are transformed; the CBAM attention module is introduced in the Neck layer of the YOLOv8s network.
[0010] This also includes the process of mechanism operation and collecting iron chip images:
[0011] The visual inspection device is installed at the end of the connecting rod mechanism, follows the movement of the telescopic diamond connecting rod transmission mechanism, and extends under the main shaft of the machine tool to collect images;
[0012] The rembg framework is used for background removal;
[0013] Use the Python library imgaug to perform data augmentation, random rotation, flipping, scaling, and brightness / contrast adjustment;
[0014] The labelImg labeling tool is used to complete the labeling and classification of the data set.
[0015] Among them, Mitsubishi FX5U-32MT PLC is used as the core of the control system.
[0016] The chip winding detection and identification method based on the YOLOv8-IFW algorithm in the embodiment of the present application has the following features:
[0017] Beneficial effects:
[0018] Compared with the existing technology, the technical solution proposed in this invention demonstrates the specific results of the chip winding detection algorithm through a series of detailed data. This demonstration is not limited to the achievements in a single aspect, but through multi-dimensional performance comparison with the original algorithm model, other variants in the improvement process, and even the current mainstream algorithms in the industry, the superiority of the proposed algorithm is fully and three-dimensionally verified. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flow chart of a method for detecting and identifying iron filings winding based on the YOLOv8-IFW algorithm according to an embodiment of the present application;
[0020] Figure 2It is a simplified model diagram of the telescopic diamond connecting rod transmission mechanism;
[0021] Figure 3 This is a schematic diagram of the control system hardware connection;
[0022] Figure 4 It is a schematic diagram of C2f module and C3 module;
[0023] Figure 5 It is the YOLOv8 network structure;
[0024] Figure 6 It is the YOLOv8s+DCN network structure;
[0025] Figure 7 This is the YOLOv8s+DCN+CBAM network structure diagram;
[0026] Figure 8 It is a schematic diagram of IOU;
[0027] Fig. 9 This is the labelImg working interface picture. DETAILED DESCRIPTION
[0028] The present application is further described below in conjunction with the accompanying drawings and embodiments.
[0029] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present invention, and different embodiments can be replaced or combined, so this application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then this application should also be considered to include embodiments containing one or more of all other possible combinations of features A, B, C, and D, even though the embodiment may not be clearly recorded in the following text.
[0030] Figure 1 It is the main flow chart of the technical solution of the present invention. Figure 1 As shown, the method for detecting and identifying iron filings winding proposed by the present invention comprises the following steps:
[0031] (1) Requirements analysis of iron chip winding detection and identification system
[0032] In the present invention, the system integrates image acquisition, real-time processing, chip winding detection and automatic control functions, and is designed for CNC machine operators and maintenance personnel with basic computer operation skills and mechanical processing knowledge. The system needs to be compatible with mainstream CNC machine tools and operating systems, and strictly comply with relevant data protection regulations. Functionally, the system should be able to obtain high-definition video streams of the processing area in real time through industrial cameras, and use deep learning algorithms to diagnose chip winding in real time, and then automatically adjust processing parameters or start cleaning mechanisms to reduce the impact.
[0033] In addition, the system needs to provide an intuitive real-time monitoring interface to display the processing status and test results, and have the functions of operation log query and chip winding event data record management. In terms of performance, the system must complete the detection within milliseconds to ensure that the accuracy of chip winding detection exceeds 95%, while paying attention to data security and facilitating future upgrades and maintenance. The effectiveness of the requirements will be verified through prototype testing and user feedback, and potential technical difficulties and implementation risks will be analyzed to formulate response strategies in advance.
[0034] (2) The design of telescopic type in machine vision inspection scheme.
[0035] Based on the actual measurement of the space dimensions of the CNC lathe T360 (length: 160cm, width: 100cm, height: 160cm), it is proposed to use a telescopic diamond linkage as the transmission mechanism, and realize the extension and contraction movement through the linear transmission method of the diamond linkage. The principle of its structure to perform telescopic movement in the internal space of the machine tool is as follows Figure 2 As shown, it includes an image acquisition device 1, a telescopic diamond-shaped connecting rod transmission mechanism 2, a supporting panel 3, a transmission component 4, and a protective device 5.
[0036] according to Figure 2 As shown, suppose the total number of connecting rod sections is n, the connecting rod length is l, the length of a single connecting rod is d, the angle between two adjacent connecting rods in a single section is θ, the total telescopic length of the connecting rod mechanism is L, and the total stroke is L C , the initial length of the entire detection device when it is contracted is L0. The relationship between the travel ratio of the transmission mechanism and the connecting rod parameters is derived as follows:
[0037]
[0038] When the adjacent maximum angle is 90°, the connecting rod reaches the maximum stroke L max When the entire detection device is contracted, the initial length L0 is approximately:
[0039] L0≈1.5d max =3l·sin45° (2.5)
[0040] L max=L-L0=2nl·45°-3l·sin45°=(2n-3)l·sin45° (2.6)
[0041] The stroke ratio is:
[0042]
[0043] From the above, it can be seen that the telescopic diamond connecting rod transmission method used in this project can increase or decrease the value of the connecting rod joint number n according to the specific machine tool model. It has strong scalability and can adapt to various types of CNC machine tools. In the undetected state, the connecting rod mechanism can be retracted back into the protection device, so that the visual inspection device is separated from the internal space of the machine tool, effectively solving the problems of lens contamination, processing interference and machine tool vibration. Compared with the XY platform solution and the rotary solution, it has the advantages of strong adaptability and good scalability.
[0044] For the machine tool model T360, the required stroke is y = 550mm, x = 300mm. Considering the length of the mechanism itself, in order to ensure that the detection device can extend under the machine tool spindle, the maximum stroke L is selected. max The design is 1200mm, the connecting rod length l is 125mm, and by substituting into formula (2.6) and formula (2.7), it is calculated that the number of joints n=9 and the transmission ratio i=5, that is, more than 9 joints are needed to meet the requirements.
[0045] (3) Visual inspection control system design.
[0046] The control system module consists of multiple parts, including PLC module, network switch, industrial computer, four-channel digital light regulator, photoelectric sensor switch, solenoid valve switch, and servo motor and driver. The system connects different devices, such as PLC and CNC system, through the switch to achieve network communication. In addition, the digital light regulator communicates directly with the industrial computer through the USB serial interface. The main functions include adjusting the intensity of the light source, controlling the operation of hardware such as motors and cylinders, and communicating with the CNC system to read and transmit data. Control the adjustment of the three-color light intensity of the bowl-shaped light source, and the soft trigger camera to collect tool images;
[0047] 1) Control PLC input / output and command the start and stop of motors and cylinders;
[0048] 2) Communicate with the CNC system to read and send processing and inspection data.
[0049] The control system structure is distributed as follows Figure 3 shown.
[0050] In order to improve data transmission speed and response efficiency and enhance detection performance, Mitsubishi FX5U-32MT PLC with network communication capability was selected as the core of the control system. The main parameters are shown in Table 2.1 below.
[0051] Table 2.1 Main parameters of Mitsubishi FX5U-32MT
[0052]
[0053]
[0054] Hardware devices are connected to the PLC controller by assigning specific I / O ports. The I / O address assignment of the FX5U PLC is shown in Table 2.2.
[0055] Table 2.2FX5U PLC I / O allocation
[0056]
[0057] (4) YOLOv8-IFW algorithm for cutting chip entanglement detection.
[0058] The YOLOv8 algorithm was proposed by Glenn-Jocher. The network structure is as follows Figure 5 As shown in Figure 1, as a continuation of YOLOv3 and YOLOv5, its main improvements are reflected in the following aspects:
[0059] (1) Data preprocessing: YOLOv8 follows the preprocessing strategy of YOLOv5 and uses four methods during the training phase: mosaic enhancement, mixup, spatial perturbation (random perspective) and color perturbation (HSV augment).
[0060] (2) Backbone network structure: The backbone network of YOLOv8 is similar to that of YOLOv5, following the rule of using a 3×3 convolution with a step size of 2 to downsample the feature map followed by a C module to enhance the features. The C3 module in YOLOv5 is replaced by the C2f module in YOLOv8, and the C2f module adds more branches to enrich the gradient return path. The comparison between the C2f module of YOLOv8 and the C3 module of YOLOv5 is shown in Figure 6 .
[0061] The present invention decides to integrate the deformable convolution module into the YOLOv8s backbone network. As shown in the figure, the network structure is adjusted as follows: the two C2f modules adjacent to the output in the backbone network are replaced with deformable convolution modules, that is, the P3 and P4 detection layers are modified.
[0062] Introduce the CBAM attention module in the Neck layer of the YOLOv8s network. Figure 7 shown.
[0063] (3) FPN-PAN structure. YOLOv8 uses FPN+PAN to construct a feature pyramid to fuse multi-scale information. It only replaces the C3 module inside FPN-PAN with the C2f module. The rest of the structure is basically consistent with the FPN-PAN architecture of YOLOv5.
[0064] (4) Detection head structure. The YOLOv8 detection head adopts a decoupled structure, which is consistent with YOLOX. It extracts category and position features through two parallel branches, and uses 1×1 convolution for classification and positioning tasks respectively. Previously, from YOLOv3 to YOLOv5, their detection heads were all "coupled" designs, that is, a single-layer convolution was used to simultaneously process classification and positioning.
[0065] The anchor box is B = [xy wh], the target box is Bgt = [xgt ygt wgt hgt], and IoU (Intersection over Union) can be defined as follows:
[0066]
[0067] IOU diagram Figure 8 shown.
[0068] Wise-IoU improves the accuracy and efficiency of target detection by dynamically adjusting the IoU calculation in the category prediction loss and optimizing the overlap evaluation based on object features. It is defined as follows:
[0069]
[0070] Based on the dynamics of WloU, this paper innovatively proposes the HIoU loss function, which is defined as:
[0071]
[0072] where v describes the aspect ratio consistency,
[0073]
[0074] In formula (2.11), Wg and Hg are as follows Figure 8 shown.
[0075] (5) Construction and data enhancement of iron chip winding dataset.
[0076] The process of mechanism operation and collecting iron chip images:
[0077] Step 1: The visual inspection device is installed at the end of the connecting rod mechanism, follows the movement of the telescopic diamond connecting rod transmission mechanism, and extends under the machine tool spindle to collect images;
[0078] Step 2: Use the rembg framework to remove the background;
[0079] Step 3: Use the Python library imgaug to implement data enhancement. Through random rotation, flipping, scaling, and brightness / contrast adjustment, the diversity of training data is effectively expanded, and the winding forms of iron filings under different viewing angles, scales, and lighting conditions are simulated. The model's ability to recognize winding positions, directions, and environmental changes is enhanced, and the learning effect and generalization performance of the model under limited sample conditions are significantly improved.
[0080] Step 4: Use labelImg labeling tool to complete the labeling and classification of the data set;
[0081] (6) Dataset annotation.
[0082] This study used the labelImg annotation tool to complete the annotation and classification of the dataset.
[0083] The specific operation steps are as follows: Drag the mouse to draw a label box covering the area of iron filings (long iron filings) in labelImg, and then assign the corresponding category label to the framed area. Fig. 9 Take the image with iron chips as an example, which is marked as "Y". In order to ensure the consistency and accuracy of image annotation in the dataset, we set a unified standard before annotation, that is, the annotation box should surround the iron chips as compactly as possible to form the smallest rectangular area containing the defect location.
[0084] The present invention analyzes the requirements of the iron chip winding detection system, designs a telescopic on-machine detection scheme, designs a visual detection control system scheme, and realizes the overall design of the detection scheme.
[0085] Combined with the characteristics of switch data: when data changes, it is either insertion, deletion, or modification of a small number of local fields. In view of this situation, there is a modification item in the data change type. This change avoids the situation where each record has to be transmitted in its entirety, reducing the entire transmission load.
[0086] The present invention integrates the CBAM attention mechanism network into the YOLOv8 backbone network to enhance the ability to capture features in key areas; at the same time, the deformable convolutional network (DCN) module is introduced to improve the model's adaptability to complex-shaped objects. These improvements are intended to overcome the detection bottleneck of the original model in complex scenes.
[0087] By setting up rigorous comparative experiments, we compared the comprehensive performance of the optimized algorithm with the original YOLOv8 and other traditional target detection algorithms. The experimental results clearly show that the improved YOLOv8 algorithm proposed in this study has achieved significant improvements in key evaluation indicators such as loss function (Loss) and mean average precision (mAP). It not only performs well in convergence speed, but also surpasses in final detection accuracy.
[0088] Compared with the existing technology, the technical solution proposed in this invention demonstrates the specific results of the chip winding detection algorithm through a series of detailed data. This demonstration is not limited to the achievements in a single aspect, but through multi-dimensional performance comparison with the original algorithm model, other variants in the improvement process, and even the current mainstream algorithms in the industry, the superiority of the proposed algorithm is fully and three-dimensionally verified.
[0089] The analysis shows that although the CBAM or DCN module integrated into the YOLOv8s model alone can improve the precision and recall rate, the effect on improving the overall detection performance is limited and the performance is similar to that of the original YOLOv8s model.
[0090] However, when the DCN and CBAM modules were added to the YOLOv8s model, the experimental data revealed a positive trend: under the premise of almost unchanged recall rate, the precision rate was significantly improved, and mAP@0.5 and mAP@[0.5:0.95] jumped by 4.3% and 0.6% respectively, confirming the positive role of the dual modules in promoting network performance. Furthermore, the newly designed IoU loss criterion was applied to the YOLOv8-DCN-CBAM model that combines DCN and CBAM, giving birth to the YOLOv8s-improved version. This version not only stabilized the recall rate, but also greatly improved the precision rate by 4.8%, and mAP@0.5 and mAP@[0.5:0.95] also increased by 0.8% respectively, significantly alleviating the problem of target omission, demonstrating the powerful improvement of detection accuracy and comprehensive optimization of the model's comprehensive performance by the new IoU criterion.
[0091] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting and identifying iron filings based on the YOLOv8-IFW algorithm, characterized in that: include: Requirements analysis of iron chip winding detection and identification system; Design of telescopic on-machine vision inspection solution; Visual inspection control system design. The control system module includes PLC module, network switch, industrial computer, four-channel digital light source regulator, photoelectric sensor switch, solenoid valve switch, servo motor and driver. The system connects different devices through the switch to achieve network communication; the digital light source regulator communicates directly with the industrial computer through the USB serial interface to adjust the light source intensity and control the operation of the motor and cylinder; The YOLOv8-IFW algorithm for cutting chip entanglement detection integrates the deformable convolution module into the YOLOv8s backbone network, and replaces the two C2f modules adjacent to the output in the backbone network with deformable convolution modules, that is, the P3 and P4 detection layers are transformed; the CBAM attention module is introduced in the Neck layer of the YOLOv8s network.
2. According to the method for detecting and identifying iron filings based on the YOLOv8-IFW algorithm in claim 1, it is characterized in that: It also includes the process of mechanism operation and collecting iron chip images: The visual inspection device is installed at the end of the connecting rod mechanism, follows the movement of the telescopic diamond connecting rod transmission mechanism, and extends under the main shaft of the machine tool to collect images; The rembg framework is used for background removal; Use the Python library imgaug to perform data augmentation, random rotation, flipping, scaling, and brightness / contrast adjustment; The labelImg labeling tool is used to complete the labeling and classification of the data set.
3. The method for detecting and identifying iron filings winding based on the YOLOv8-IFW algorithm according to claim 1 or 2, characterized in that: Mitsubishi FX5U-32MT PLC is used as the core of the control system.
