MLCC multi-scale defect automatic detection method and system based on deep learning

By building an EHL-DETR model, combining efficient gated module, HiLo attention mechanism and lightweight multi-scale feature pyramid network, the problems of low efficiency and high error detection rate in MLCC defect detection are solved, and high-precision and fast automated detection are achieved.

CN120471869APending Publication Date: 2025-08-12GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510564884.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing MLCC defect detection methods rely on manual visual inspection inefficient efficiency and are prone to missed detection and false detection. Traditional visual object detection methods such as Viola-Jones are not enough to capture the diversity and complexity of MLCC, while the existing Transformer-based RT-DETR model does not meet expectations when detecting MLCC defects.

Method used

A EHL-DETR defect detection model based on RT-DETR was designed. By building an image defect detection system, an MLCC defect data set was generated, and an efficient gated module, HiLo attention mechanism and lightweight multi-scale feature pyramid network enhancement model is used to optimize the network structure and improve detection accuracy and speed.

Benefits of technology

It significantly improves the accuracy and speed of MLCC defect detection, reduces computational complexity and feature redundancy, enhances the detection ability of subtle defects, reduces false detection, and realizes efficient automated detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471869A_ABST
    Figure CN120471869A_ABST
Patent Text Reader

Abstract

The invention relates to the field of computer vision image processing, in particular to an MLCC multi-scale defect automatic detection method and system based on deep learning. According to the technical scheme, the method is characterized by comprising the following steps that S1, an image defect detection system is constructed and used for collecting and screening images and generating an MLCC defect data set; s2, constructing an EHL-DETR defect detection model based on an RT-DETR model, inputting the MLCC defect data set into the EHL-DETR defect detection model for training, evaluating and storing an optimal weight, and taking the optimal weight which is kept unchanged in a continuous training period as a final weight; and S3, performing target detection on the MLCC test set by using the EHL-DETR defect detection model stored with the final weight, and outputting a detection result. By designing the MLCC multi-scale defect detection model EHL-DETR based on deep learning, the method has the advantages that the detection precision and the detection speed of a target detection algorithm are improved, and the network structure is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision image processing, and more specifically, to a method and system for automatic detection of multi-scale defects of MLCCs based on deep learning. Background Art

[0002] With the rapid development of the global electronics industry, multilayer ceramic capacitors (MLCCs) have become an indispensable component in electronic systems due to their high capacitance, compact size, and excellent stability. However, defects such as end cracking, delamination, and bottom cracking can occur during the MLCC manufacturing process, seriously affecting the performance and reliability of MLCCs. Traditional MLCC inspection methods rely on manual visual inspection, which is not only inefficient but also prone to missed detections and false detections. With the advancement of science and technology, computer vision-based object detection methods have emerged, greatly improving the speed and accuracy of MLCC defect detection.

[0003] Traditional visual object detection methods, such as the Viola-Jones algorithm, are insufficient to capture the diversity and complexity of real-world scenes. Convolutional neural networks, however, have transformed the field of object detection by performing feature extraction and detection through end-to-end learning. These convolutional neural network-based models are generally classified into two categories: two-stage detectors and single-stage detectors. Two-stage detectors offer significant improvements in accuracy, but their high computational cost limits their application in real-time scenarios. In contrast, single-stage detectors, such as the YOLO family of models, directly generate probability scores and location coordinates in a single detection, significantly improving detection speed. In recent years, Transformer-based detectors have garnered widespread attention due to their powerful modeling capabilities and self-attention mechanisms. RT-DETR is a Transformer-based real-time, end-to-end object detection model designed to deliver more efficient and faster real-time detection performance than YOLO. However, due to the diverse shapes, sizes, and subtle defects found on the two end faces of MLCCs, RT-DETR's performance in detecting these defects has fallen short of expectations. Summary of the Invention

[0004] In view of the shortcomings of the existing technology, the purpose of the present invention is to provide a method and system for automatic detection of multi-scale defects of MLCC based on deep learning to solve the above problems.

[0005] The above technical objectives of the present invention are achieved through the following technical solutions: a method for automatic detection of multi-scale defects of MLCC based on deep learning, comprising the following steps:

[0006] S1. Build an image defect detection system to collect and filter images and generate MLCC defect datasets.

[0007] S2. Build an EHL-DETR defect detection model based on the RT-DETR model, input the MLCC defect data set into the EHL-DETR defect detection model for training, evaluate and save the optimal weight, and use the optimal weight that remains unchanged in consecutive training cycles as the final weight;

[0008] S3. Use the EHL-DETR defect detection model with the final weights to perform target detection on the MLCC test set and output the detection results.

[0009] In one embodiment, in step S1, building an image defect detection system specifically includes the following steps:

[0010] A fixing fixture is provided on which a camera and a light source are set. The camera is connected with a lens and is referred to as an image acquisition unit. A computer is installed and electrically connected to the camera and is referred to as a control imaging unit.

[0011] In one embodiment, in step S1, generating the MLCC defect dataset specifically includes the following steps:

[0012] S11, using the image defect inspection system to collect images of two end faces of the MLCC to generate an image data set;

[0013] S12, screening out images with defects in the image dataset to generate a defect dataset;

[0014] S13. Label the defect areas and defect categories of the images in the defect dataset to generate the MLCC defect dataset.

[0015] In one embodiment, step S2 includes the following steps:

[0016] S21, inputting the MLCC defect data set into an efficient gating module to reduce computational complexity and feature redundancy, and outputting a processing result;

[0017] S22: Input the processing result into the HiLo attention mechanism module, process and connect the high-frequency information and the low-frequency information, and output the connection result;

[0018] S23: Input the processing result and the connection result into a lightweight multi-scale feature pyramid network enhancement model to perform multi-scale recognition.

[0019] In one embodiment, in step S21, the operation steps of the high-efficiency gate control module are:

[0020] Input feature map x to 3*3 convolution C 3×3(·) extracts low-level local features and then inputs them into BN(·) function and ReLU(·) activation function for processing. The processing results are input into the partial gated convolution module, which is connected to the average pooling AP(·), 1*1 convolution C through the element-wise skip connection. 1×1 The feature map x of (·) and BN(·) is fused and input into the ReLU(·) activation function to obtain the output EGB(x), which is expressed as:

[0021] EGB(x)=ReLU(PGCB(ReLU(BN(C 3×3 (x))))+BN(C 1×1 (AP(x))))

[0022] PGCB(x)=BN(x+CGLU(PConv 3×3 (x)))

[0023] Among them, EGB represents efficient gating block, PGCB represents partially gated convolution block, and CGLU represents convolutional gated linear unit.

[0024] In one embodiment, the S22 includes the following steps:

[0025] S221, input feature map To the HiLo attention mechanism module, where N represents the length of the input sequence and D represents the hidden layer dimension;

[0026] S222: Under the high frequency path, the feature map Local self-attention is used to capture high-frequency features and is assigned (1-α)N h Attention head, obtains high-frequency features;

[0027] S223, in the low frequency path, the characteristic map Average pooling is used to obtain low-resolution features and assigned αN h Attention head, obtains low-frequency features;

[0028] S224: The HiLo attention mechanism module applies standard query Q, key K, and value V calculation to the high-frequency path and the low-frequency path, expressed as:

[0029] Q=XW q ,K=XW k ,V=XW v

[0030] in, represents the learnable parameters, Dh represents the hidden layer dimension of the attention head;

[0031] The scaled dot product attention of the high-frequency feature and the low-frequency feature is calculated. On this basis, the outputs of the high-frequency path and the low-frequency path are connected through Concat to obtain the final output HiLo(X), which is expressed as:

[0032] HiLo(X)=[Hi-Fi(X)·Lo-Fi(X)]

[0033] Among them, [·] is the Concat operation, Hi-Fi represents high-frequency attention, Lo-Fi represents low-frequency attention, and X represents the feature map

[0034] In one embodiment, the lightweight multi-scale feature pyramid network enhancement model structurally introduces a P2 layer and adopts the weighted fusion technology of BiFPN as a fusion method;

[0035] An efficient upsampling convolution block is introduced on the module, and a cross-stage multi-scale convolution block is constructed based on the multi-scale convolution block and the cross-stage structure to enhance the features generated by the cascade expansion path and better capture features of different scales.

[0036] In one embodiment, the multi-scale convolution block operates as follows:

[0037] Apply point convolution C to the input x) 1×1 (·) expands the number of channels, and then inputs them into the BN(·) function and the ReLU6 activation layer for processing. The processing results are input into the multi-scale depth convolution to capture the features of multiple scales and resolutions, and then use the point convolution C 1×1 (·) and BN(·) functions, converting the channels back to the original number, whose equation is expressed as:

[0038] MSCB(x)=BN(C 1×1 (MSDC(R6(BN(C 1×1 (x))))))

[0039] MSDC(x)=∑ ks∈KS DWCB ks (x)

[0040] DWCB ks (x) = R6(BN(DWConv ks (x)))

[0041] Finally, the input (x) is recursively updated through the residual connection to achieve better regularization, which is expressed as follows:

[0042] x=x+MSCB(x)

[0043] In the formula, MSCB represents multi-scale convolution block, MSDC(·) represents multi-scale depth convolution, and DWConv ks (·) represents depthwise convolution, ks represents the convolution kernel size, and R6(·) represents the ReLU6 activation layer.

[0044] In one embodiment, the cross-stage multi-scale convolution block operates as follows:

[0045] The input is divided into two parts for processing. The first part is processed twice by MSCB(·) to extract features of different scales, and the second part remains unchanged. Finally, the outputs of the two parts are connected in series through Concat, which effectively integrates multi-scale feature information and enhances the feature representation ability of the model. The equation is expressed as:

[0046] CSCB(x)=[Split1(x)·MSCB(MSCB(Split2(x)))]

[0047] Among them, CSCB(·) represents the cross-stage multi-scale convolution block, and [·] represents the Concat operation.

[0048] A deep learning-based MLCC multi-scale defect automatic detection system, applied to the above-mentioned deep learning-based MLCC multi-scale defect automatic detection method, includes: a feeding device for transporting MLCC in a specified direction;

[0049] Optical imaging system, used to photograph MLCC and transmit the photographic results;

[0050] Sorting device for classifying MLCCs;

[0051] A control and detection device is connected to the unloading device, the optical imaging system and the sorting device, and is used to control the unloading device and the optical imaging system, detect the shooting results of the optical imaging system, and control the sorting device based on the detection content.

[0052] The above-mentioned MLCC multi-scale defect automatic detection method and system based on deep learning has the following beneficial effects:

[0053] First, based on the RT-DETR model, a deep learning detection network EHL-DETR defect detection model for MLCC was designed. This model has the advantages of improving the detection accuracy and speed of the target detection algorithm and optimizing the network structure.

[0054] Secondly, in MLCC processing, we designed an efficient gating module to reduce computational complexity and feature redundancy, significantly enhancing channel feature extraction capabilities. We also designed a HiLo attention mechanism module to improve the model's ability to capture detailed features by processing high-frequency and low-frequency information separately. We also designed a lightweight multi-scale feature pyramid network enhancement model to detect subtle defects and reduce false detections.

[0055] Third, an image defect detection system was designed, and a large number of MLCC images were collected for training and testing to ensure the efficiency and scientificity of data collection and the richness of experimental data. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 Schematic diagram of the steps of the detection method in this embodiment;

[0057] Figure 2 Schematic diagram of the steps of the EHL-DETR defect detection model in this embodiment;

[0058] Figure 3 This is a schematic diagram of the steps of the efficient gating module in this embodiment;

[0059] Figure 4 This is a schematic diagram of the steps of the HiLo attention mechanism module in this embodiment;

[0060] Figure 5 Schematic diagram of the steps of the lightweight multi-scale feature pyramid network enhancement model in this embodiment;

[0061] Figure 6 Schematic diagram of the structural layers of the lightweight multi-scale feature pyramid network enhancement model in this embodiment;

[0062] Figure 7 It is a schematic diagram of the detection system in this embodiment;

[0063] Figure 8 Schematic diagram of a sample of capacitor defect types in this embodiment. DETAILED DESCRIPTION

[0064] The present invention is described in detail below with reference to the accompanying drawings and embodiments.

[0065] The hardware configuration for the experiments conducted in this paper included an Intel Core i5-14400 CPU, an NVIDIA GeForce RTX 4080 SUPER graphics card with 16GB of video memory, and 32GB of RAM. The software environment included Python 3.9.21, PyTorch 2.5.1, and CUDA 11.8. When training the detection model, the input image size was set to 640×640 pixels, the training process was 500 epochs, and the early stopping value was 50. The batch size was set to 16, and the optimizer was AdamW with a weight decay of 0.0001. In addition, the initial learning rate of the model was set to 0.0001.

[0066] Based on the above configuration, this embodiment provides a method for automatic detection of MLCC multi-scale defects based on deep learning, such as Figure 1-6 As shown, the following steps are included:

[0067] S1. Build an image defect detection system to collect and filter images and generate MLCC defect datasets.

[0068] In step S1, building an image defect detection system specifically includes the following steps:

[0069] A fixed fixture is provided, and a camera and a light source are set on the fixture. The camera is connected with a lens, which is recorded as an image acquisition unit; a computer is installed, and the computer is electrically connected to the camera, which is recorded as a control imaging unit.

[0070] In this embodiment, the optical imaging system consists of a CMOS camera, a lens, and a light source, and is used to capture images of the two end faces of the MLCC.

[0071] In step S1, generating an MLCC defect dataset specifically includes the following steps:

[0072] S11, using an image defect inspection system to collect images of two end faces of the MLCC to generate an image data set;

[0073] S12, filtering out images with defects in the image dataset to generate a defect dataset;

[0074] S13. Label the defect areas and defect categories of the images in the defect dataset to generate an MLCC defect dataset.

[0075] In this embodiment, the defect dataset is annotated by manual selection.

[0076] like Figure 1As shown, S2: Build an EHL-DETR defect detection model based on the RT-DETR model, input the MLCC defect dataset into the EHL-DETR defect detection model for training, evaluate and save the optimal weight, and use the optimal weight that remains unchanged in consecutive training cycles as the final weight;

[0077] In the present invention, the MLCC defect detection method based on the EHL-DETR model mainly includes data preprocessing, model training and verification stages. First, an automatic optical detection system (i.e., an image defect detection system) is used to collect images of the two end faces of the MLCC, and then images containing defects are manually selected from the collected data set. These images are then labeled with defect areas and defect category information to form an MLCC data set. Subsequently, the data set is used to train the EHL-DETR model. During the training process, the model is verified at the end of each epoch. If the verification result is better than the previous epoch, the model weight is updated and saved as the optimal weight; otherwise, the current optimal weight remains unchanged for subsequent training. When the optimal weight remains unchanged for k consecutive epochs, it is considered that the training process has converged, and the final stable weight is used as the optimal parameter of the model to detect defects. Wherein k is the early stopping value.

[0078] like Figure 2 As shown, the overall architecture of EHL-DETR consists of three main components: an efficient backbone network for multi-scale feature extraction; an enhanced hybrid encoder for feature integration and context aggregation; and a Transformer decoder for outputting detection results. First, to balance performance and efficiency, this model uses the shallow ResNet-18 backbone. Its top-down architecture, combined with our proposed efficient gating block (EGB), effectively reduces redundant computation and features, enhances channel feature extraction, and improves recognition of features of various sizes and shapes, enabling multi-scale recognition. Next, the deepest feature maps extracted by the backbone network are passed to the AIFI module for deep enhancement. The AIFI module utilizes a self-attention mechanism to process high-level features and capture the relationships between semantic concepts in the image. In this module, the traditional multi-head attention mechanism is replaced by the HiLo attention mechanism. HiLo attention processes local details with high-frequency branches and global contextual information with low-frequency branches, significantly enhancing the model's ability to recognize subtle objects. Subsequently, the feature maps of each layer are enhanced by our proposed lightweight multi-scale feature pyramid network (LMSFPN). The network utilizes multi-scale weighted fusion and an efficient upsampling mechanism to fully fuse features, thereby enhancing the model's ability to effectively process multi-scale features while reducing computational overhead. Finally, the feature maps output by the encoder are passed to the decoder and prediction module for object classification, localization, and confidence prediction.

[0079] like Figure 3 As shown, step S2 includes the following steps:

[0080] S21, input the MLCC defect data set into the efficient gating module to reduce the computational complexity and feature redundancy, and output the processing results;

[0081] In step S21, the operation steps of the high-efficiency gate control module are:

[0082] Input feature map x to 3*3 convolution C 3×3 (·) extracts low-level local features and then inputs them into BN(·) function and ReLU(·) activation function for processing. The processing results are input into the partial gated convolution module. The partial gated convolution module is connected with the average pooling AP(·), 1*1 convolution C through the element-wise skip connection. 1×1 The feature map x of (·) and BN(·) is fused and input into the ReLU(·) activation function to obtain the output EGB(x), which is expressed as:

[0083] EGB(x)=ReLU(PGCB(ReLU(BN(C 3×3 (x))))+BN(C 1×1 (AP(x))))

[0084] PGCB(x)=BN(x+CGLU(PConv 3×3 (x)))

[0085] Among them, EGB represents efficient gating block, PGCB represents partially gated convolution block, and CGLU represents convolutional gated linear unit.

[0086] In RT-DETR, the BasicBlock in the original ResNet18 consists of two consecutive convolutional layers, each followed by batch normalization (BN) and ReLU activation. The output of the second convolutional layer is then added to the input element-by-element via a skip connection. This design enhances feature learning and model expressiveness, but results in redundant processing of low-level features and frequent memory access, which ultimately leads to performance degradation.

[0087] EGB replaces BasicBlock, reducing computational complexity and feature redundancy while significantly enhancing channel feature extraction capabilities.

[0088] In EGB, we first use a 3×3 convolution C 3×3(·) to extract low-level local features, followed by a BN(·) and ReLU(·) activation function. We then use our designed partial-gated convolution block (PGCB) to reduce feature redundancy and enhance the model's channel attention mechanism. The output of PGCB(·) is connected to the average pooling AP(·), 1×1 convolution C through element-wise skip connections. 1×1 The input x of (·) and BN(·) is fused, where the latter achieves dimensionality reduction and channel alignment. Finally, the output is activated by ReLU(·).

[0089] like Figure 3 As shown in the PGCB module, the input feature map x first undergoes a 3*3 partial convolution (PConv 3×3 (·)) selectively filters the input channels while leaving the remaining channels unchanged, thereby reducing redundant computation, optimizing memory access, and accelerating inference. Next, the output is processed by the convolutional gated linear unit (CGLU) proposed in TransNeXt. CGLU(·) uses depthwise convolution to generate gating signals based on the local context of each token, thereby reducing feature redundancy while allowing the model to capture more accurate local context. This helps the model better identify defects of various sizes and shapes. Finally, the output is element-wise added to the input and processed with the BN(·) function to avoid gradient vanishing and exploding, thereby improving performance.

[0090] S22: Input the processing result to the HiLo attention mechanism module, process and connect the high-frequency information and the low-frequency information, and output the connection result;

[0091] like Figure 4 As shown, S22 includes the following steps:

[0092] S221, input feature map To the HiLo attention mechanism module, where N is the length of the input sequence and D is the hidden layer dimension;

[0093] S222, in the high frequency path, the feature map Local self-attention is used to capture high-frequency features and is assigned (1-α)N h Attention head, obtains high-frequency features;

[0094] S223, in the low frequency path, the feature map Average pooling is used to obtain low-resolution features and assigned αN h Attention head, obtains low-frequency features;

[0095] S224, HiLo attention mechanism module applies standard query Q, key K and value V calculation to high-frequency paths and low-frequency paths, expressed as:

[0096] Q=XW q ,K=XW k ,V=XW v

[0097] in, represents the learnable parameters, D h represents the hidden layer dimension of the attention head;

[0098] Calculate the scaled dot product attention of high-frequency features and low-frequency features. On this basis, connect the outputs of the high-frequency path and the low-frequency path through Concat to obtain the final output HiLo(X), which is expressed as:

[0099] HiLo(X)=[Hi-Fi(X)·Lo-Fi(X)]

[0100] Among them, [·] is the Concat operation, Hi-Fi represents high-frequency attention, Lo-Fi represents low-frequency attention, and X represents the feature map

[0101] In this paper, when performing MLCC defect detection tasks, the defect features on the two end faces of the sintered MLCC are typically weak, and details are easily lost. In the hybrid encoder design of RT-DETR, the S5-level feature maps are used for intra-scale feature interaction through the AIFI module. The traditional multi-head self-attention mechanism in the AIFI module cannot effectively distinguish high-frequency details from low-frequency content in the image, making it difficult for the model to capture subtle defect features and slowing down the inference speed.

[0102] To overcome these limitations, the HiLo attention mechanism (module) is used to replace the traditional multi-head self-attention mechanism. The HiLo attention module improves the ability to capture detailed features by processing high-frequency and low-frequency information separately, thereby enhancing the model's ability to identify subtle defects (such as slender objects) while also improving inference speed to meet the requirements of real-time defect detection.

[0103] S23. Input the processing results and the connection results into the lightweight multi-scale feature pyramid network enhancement model for multi-scale recognition.

[0104] like Figure 5-6 As shown in the figure, the lightweight multi-scale feature pyramid network enhancement model introduces the P2 layer in the structure and adopts the weighted fusion technology of BiFPN as the fusion method;

[0105] An efficient upsampling convolution block is introduced on the module, and a cross-stage multi-scale convolution block is constructed based on the multi-scale convolution block and the cross-stage structure to enhance the features generated by the cascade expansion path and better capture features of different scales.

[0106] To enhance the capture of spatial and semantic information of complex and subtle defects, improve detection accuracy and fusion efficiency, this paper proposes LMSFPN (Lightweight Multi-scale Feature Pyramid Network Enhancement Model). Structurally, compared to CCFF in RT-DETR, LMSFPN introduces an additional P2 layer, which can more effectively detect small target defects. During the feature fusion process, LMSFPN makes full use of information from the same layer and adjacent layers (upper or lower layers). Its fusion method adopts the weighted fusion technology of BiFPN, enabling the model to better capture multi-scale features.

[0107] To improve the efficiency and quality of feature fusion, LMSFPN introduces an efficient up-convolution block (EUCB) and proposes a cross-scale convolution block (CSCB) based on the multi-scale convolution block (MSCB) and cross-stage structure to enhance the multi-scale recognition capability of this network model, enabling it to detect subtle defects and reduce false detections. Among them, MSCB enhances the features generated by the cascade expansion path, which can better capture features at different scales. In order to reduce the overall computational load without affecting key feature information, the number of feature channels will be reduced from 256 to 128.

[0108] like Figure 5 As shown in Figure 2, the operating steps of the multi-scale convolution block are:

[0109] Apply point convolution C to the input (x) 1×1 (·) expands the number of channels, and then inputs them into the BN(·) function and the ReLU6 activation layer for processing. The processing results are input into the multi-scale depth convolution to capture the features of multiple scales and resolutions, and then use the point convolution C 1×1 (·) and BN(·) functions, converting the channels back to the original number, whose equation is expressed as:

[0110] MSCB(x)=BN(C 1×1 (MSDC(R6(BN(C 1×1 (x))))))

[0111] MSDC(x)=∑ ks∈KS DWCB ks (x)

[0112] DWCB ks (x) = R6(BN(DWConv ks (x)))

[0113] Finally, the input (x) is recursively updated through the residual connection to achieve better regularization, which is expressed as follows:

[0114] x=x+MSCB(x)

[0115] In the formula, MSCB represents multi-scale convolution block, MSDC(·) represents multi-scale depth convolution, and DWConv ks (·) represents depthwise convolution, ks represents the convolution kernel size, and R6(·) represents the ReLU6 activation layer.

[0116] Note that the "(x)" on the right side of the equal sign in the formula "x=x+MSCB(x)" has the same reference as the input x) mentioned above.

[0117] The operation steps of the cross-stage multi-scale convolution block are:

[0118] The input is divided into two parts for processing. The first part is processed twice by MSCB(·) to extract features of different scales, and the second part remains unchanged. Finally, the outputs of the two parts are connected in series through Concat, which effectively integrates multi-scale feature information and enhances the feature representation ability of the model. The equation is expressed as:

[0119] CSCB(x)=[Split1(x)·MSCB(MSCB(Split2(x)))]

[0120] Among them, CSCB(·) represents the cross-stage multi-scale convolution block, and [·] represents the Concat operation.

[0121] like Figure 1 As shown, S3: Use the EHL-DETR defect detection model with the final weight saved to perform target detection on the MLCC test set and output the detection results.

[0122] like Figure 7 As shown, a deep learning-based MLCC multi-scale defect automatic detection system is applied to the above-mentioned deep learning-based MLCC multi-scale defect automatic detection method, including:

[0123] Unloading device, used to transport MLCC in a specified direction;

[0124] Optical imaging system, used to photograph MLCC and transmit the photographic results;

[0125] Sorting device for classifying MLCCs;

[0126] The control and detection device is connected to the unloading device, the optical imaging system, and the sorting device. It is used to control the unloading device and the optical imaging system, detect the imaging results of the optical imaging system, and control the sorting device based on the detection results. During actual operation of the detection system, the control and detection device judges the imaging results of the optical imaging system, forms a judgment result, and controls the sorting device to classify the MLCCs based on the judgment result.

[0127] The detection system mainly consists of four parts: a feeding device, an optical imaging system, a control and detection device, and a sorting device. In this embodiment, the feeding device consists of a hopper, a vibrating plate, a linear feeder, and a photoelectric sensor. Its function is to transport the MLCC to the glass turntable in a certain direction, and then pass through the photoelectric sensor to know the position change of the MLCC; the optical imaging system mainly consists of a CMOS camera, a lens, and a light source. Its function is to shoot the MLCC when it reaches the shooting position, collect high-quality pictures and transmit them to the detection model for detection; the control and detection device mainly consists of a programmable logic controller (PLC) and a computer (PC). The PLC mainly controls the camera shooting and the air valve switch, and the computer deploys the detection model to detect defects in the MLCC image; the sorting device consists of an air valve and a sorting box for MLCC classification.

[0128] like Figure 7 As shown in the figure, the inspection system works as follows: First, MLCCs fall from a hopper onto a vibrating plate. A linear feeder then transports the MLCCs to a transparent, circular glass plate, which is continuously rotated by a DD direct-drive motor. When an MLCC passes a photoelectric sensor, the sensor immediately sends a signal to the PLC. When the MLCC reaches the CMOS camera's capture position, the PLC controls the camera to capture a high-resolution image of the MLCC and then transmits the image to a PC. The PC processes these images using an inspection model to identify defects in the MLCC and generate inspection results. The inspection results are sent to the PLC via the PC, which controls the air jet valve to sort the MLCCs. Acceptable and defective MLCCs are then blown into different sorting bins, completing the automated sorting process.

[0129] In the above content, the connection relationship and components are common knowledge, so they will not be elaborated on.

[0130] To evaluate the performance of the model (EHL-DETR), we use precision (P), recall (R), mean average precision (mAP), and F1 score for quantitative analysis, and use frames per second (FPS) to evaluate the detection speed. The calculation formulas for P, R, and F1 are as follows:

[0131]

[0132] Where TP, FP, TN and FN represent true positive, false positive, true negative and false negative, respectively.

[0133] mAP is an important indicator in target detection and is often used in defect detection research. It calculates the average precision of all categories and the formula is as follows:

[0134]

[0135] Where N represents the number of target categories, AP i Represents the average precision of the category. Specifically, mAP 50 It is calculated with an IoU threshold of 0.5, and mAP 50-95 It refers to the average precision calculated over 10 IoU thresholds from 0.5 to 0.95 (with a step size of 0.05), which is the precision used in this study.

[0136] In addition, floating-point operations per second (FLOPs) and the number of model parameters are also included in the evaluation to reflect the complexity of the model, while FPS is used to evaluate the real-time performance.

[0137] like Figure 8 As shown, in this embodiment, the MLCC used for detection is an MLCC that has undergone a sintering process, not a finished MLCC. A total of five types of defects to be detected were collected: (a) end cracks (Core_Crack), (b) knife marks (Core_Scratch), (c) bottom cracks (Core_Body_Crack), (d) fly-out (Core_Expansion), and (e) delamination (Body_Delamination). Among them, the sizes and shapes of end cracks vary, and some are not obvious when observed; the shape of the knife marks is elongated; fly-out is a small target defect. The dataset contains a total of 1059 images, which are divided into training set, validation set, and test set in a ratio of 7:1:2. The image resolution is 1440×1080 pixels. Since a single MLCC product may have multiple appearance defects, the dataset contains a total of 2300 defects. Figure 8 The detailed information of the dataset is listed, and the table statistics show the number of occurrences of each defect rather than the number of images.

[0138] In order to verify the effectiveness of the EHL-DETR model on the MLCC dataset, we tested it using the test set. The detailed results are shown in Table 1. According to the experimental results, the EHL-DETR model showed excellent overall performance on the MLCC dataset, with an accuracy of 93.5%, an F1 score of 91.8%, and a mAP of 91.8%. 50 The model performs well in detecting high-difficulty defects such as Core_Crack and Core_Scratch, showing high accuracy and mAP. 50 In addition, the detection performance of the other three defects is also very good, further demonstrating the powerful ability of the model in defect detection.

[0139] The detection results of the EHL-DETR model are shown in Table 1:

[0140]

[0141]

[0142] Table 1

[0143] In addition, in order to better understand the impact of different improvement techniques on model performance, we conducted an ablation experiment under the same experimental conditions, as shown in Table 2. The ablation experiment uses the standard RT-DETR as the baseline model and considers different combinations of the three modules. As can be seen from Table 2, adding EGB, Hi lo attention, and LMSFPN modules to RT-DETR can improve mAP. 50 The accuracy and recall rates are increased by 0.5%, 0.3% and 1.3% respectively. The accuracy and recall rates are also improved. Adding all three modules to RT-DETR results in our EHL-DETR model. Its accuracy and mAP are 50 and mAP 50-95 Removing any module from EHL-DETR will lead to a decrease in detection performance, mAP 50 These results clearly demonstrate the necessity of each module in improving detection performance, as the absence of any module will lead to a decrease in detection performance.

[0144] The ablation experiment results are shown in Table 2:

[0145]

[0146] Table 2

[0147] This paper improves the EHL-DETR defect detection model's ability to detect defects of various shapes and sizes, as well as subtle defects, through an efficient gating module (Efficient Gate Block, EGB), a HiLo attention mechanism module, and a lightweight multi-scale feature pyramid network enhancement model (Lightweight Multi-scale FPN, LMSFPN). This significantly reduces parameters and computational load, increases detection speed, and enhances local detail extraction and global context modeling, improving the model's ability to detect subtle defects. Test results show that the EHL-DETR proposed in this paper effectively suppresses missed detections, false detections, and repeated detection of a single defect, significantly improving detection performance.

[0148] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.

Claims

1. A deep learning-based MLCC multi-scale defect automatic detection method, characterized in that: The following steps are involved: S1. Build an image defect detection system to collect and filter images and generate MLCC defect datasets. S2. Build an EHL-DETR defect detection model based on the RT-DETR model, input the MLCC defect data set into the EHL-DETR defect detection model for training, evaluate and save the optimal weight, and use the optimal weight that remains unchanged in consecutive training cycles as the final weight; S3. Use the EHL-DETR defect detection model with the final weights to perform target detection on the MLCC test set and output the detection results.

2. The method for automatic detection of MLCC multi-scale defects based on deep learning according to claim 1, characterized in that: In step S1, building an image defect detection system specifically includes the following steps: A fixing fixture is provided, and a camera and a light source are set on the fixture. The camera is connected to a lens and is referred to as an image acquisition unit; A computer is installed and electrically connected to the camera, which is referred to as a control imaging unit.

3. The method for automatic detection of MLCC multi-scale defects based on deep learning according to claim 1, characterized in that: In step S1, generating the MLCC defect data set specifically includes the following steps: S11, using the image defect detection system to collect images of two end faces of the MLCC to generate an image data set; S12, screening out images with defects in the image dataset to generate a defect dataset; S13. Label the defect areas and defect categories of the images in the defect dataset to generate the MLCC defect dataset.

4. The method for automatic detection of MLCC multi-scale defects based on deep learning according to claim 1, characterized in that: The step S2 comprises the following steps: S21, inputting the MLCC defect data set into an efficient gating module to reduce computational complexity and feature redundancy, and outputting a processing result; S22: Input the processing result into the HiLo attention mechanism module, process and connect the high-frequency information and the low-frequency information, and output the connection result; S23: Input the processing result and the connection result into a lightweight multi-scale feature pyramid network enhancement model to perform multi-scale recognition.

5. The method for automatic detection of MLCC multi-scale defects based on deep learning according to claim 4 is characterized in that: In step S21, the operation steps of the high-efficiency gate control module are: Input feature map x to 3*3 convolution C 3×3 (·) extracts low-level local features and then inputs them into BN(·) function and ReLU(·) activation function for processing. The processing results are input into the partial gated convolution module, which is connected to the average pooling AP(·), 1*1 convolution C through the element-wise skip connection. 1×1 The feature map x of (·) and BN(·) is fused and input into the ReLU(·) activation function to obtain the output EGB(x), which is expressed as: EGB(x)=ReLU(PGCB(ReLU(BN(C 3×3 (x))))+BN(C 1×1 (AP(x)))) PGCB(x)=BN(x+CGLU(PConv 3×3 (x))) Among them, EGB represents efficient gating block, PGCB represents partially gated convolution block, and CGLU represents convolutional gated linear unit.

6. The method for automatic detection of MLCC multi-scale defects based on deep learning according to claim 4, characterized in that: The S22 includes the following steps: S221, input feature map To the HiLo attention mechanism module, where N represents the length of the input sequence and D represents the hidden layer dimension; S222: Under the high frequency path, the feature map Local self-attention is used to capture high-frequency features and is assigned (1-α)N h Attention head, obtains high-frequency features; S223, in the low frequency path, the characteristic map Average pooling is used to obtain low-resolution features and assigned αN h Attention head, obtains low-frequency features; S224: The HiLo attention mechanism module applies standard query Q, key K, and value V calculation to the high-frequency path and the low-frequency path, expressed as: Q=XW q ,K=XW k ,V=XW v in, represents the learnable parameters, D h represents the hidden layer dimension of the attention head; The scaled dot product attention of the high-frequency feature and the low-frequency feature is calculated. On this basis, the outputs of the high-frequency path and the low-frequency path are connected through Concat to obtain the final output HiLo(X), which is expressed as: HiLo(X)=[Hi-Fi(X)·Lo-Fi(X)] Among them, [·] is the Concat operation, Hi-Fi (represents high-frequency attention, Lo-Fi (low-frequency attention, X represents the feature map 7. The method for automatic detection of multi-scale defects of MLCC based on deep learning according to claim 4, characterized in that: The lightweight multi-scale feature pyramid network enhancement model introduces the P2 layer in its structure and adopts the weighted fusion technology of BiFPN as the fusion method; An efficient upsampling convolution block is introduced on the module, and a cross-stage multi-scale convolution block is constructed based on the multi-scale convolution block and the cross-stage structure to enhance the features generated by the cascade expansion path and better capture features of different scales.

8. The method for automatic detection of multi-scale defects of MLCC based on deep learning according to claim 7, characterized in that: The operation steps of the multi-scale convolution block are: Apply point convolution C to the input (x) 1×1 (·) expands the number of channels, and then inputs them into the BN(·) function and the ReLU6 activation layer for processing. The processing results are input into the multi-scale depth convolution to capture the features of multiple scales and resolutions, and then use the point convolution C 1×1 (·) and BN(·) functions, converting the channels back to the original number, whose equation is expressed as: MSCB(x)=BN(C 1×1 (MSDC(R6(BN(C 1×1 (x)))))) MSDC(x)=∑ ks∈KS DWCB ks (x) DWCB ks (x)=R6(BN(DWConv ks (x))) Finally, the input x) is recursively updated through the residual connection to achieve better regularization, which is expressed as follows: x=x+MSCB(x) In the formula, MSCB represents multi-scale convolution block, MSDC(·) represents multi-scale depth convolution, and DWConv ks (·) represents depthwise convolution, ks represents the convolution kernel size, and R6(·) represents the ReLU6 activation layer.

9. The method for automatic detection of multi-scale defects of MLCC based on deep learning according to claim 7, characterized in that: The operation steps of the cross-stage multi-scale convolution block are: The input is divided into two parts for processing. The first part is processed twice by MSCB(·) to extract features of different scales, and the second part remains unchanged. Finally, the outputs of the two parts are connected in series through Concat, which effectively integrates multi-scale feature information and enhances the feature representation ability of the model. The equation is expressed as: CSCB(x)=[Split1(x)·MSCB(MSCB(Split2(x)))] Among them, CSCB(·) represents the cross-stage multi-scale convolution block, and [·] represents the Concat operation.

10. A deep learning-based MLCC multi-scale defect automatic detection system, applied to a deep learning-based MLCC multi-scale defect automatic detection method according to any one of claims 1 to 9, characterized in that: include: Unloading device, used to transport MLCC in a specified direction; Optical imaging system, used to photograph MLCC and transmit the photographic results; Sorting device for classifying MLCCs; A control and detection device is connected to the unloading device, the optical imaging system and the sorting device, and is used to control the unloading device and the optical imaging system, detect the shooting results of the optical imaging system, and control the sorting device based on the detection content.