A method for detecting surface defects of metallized ceramic rings
By combining the Transformer framework object detection network, classification network and traditional image processing algorithm, pinhole defect detection branches and other defect detection branches are designed, which solves the problems of many defect categories, small areas and unbalanced samples in surface defect detection of metallized ceramic rings, and achieves high-precision and efficient defect detection.
Patent Information
- Application Number
- CN202411803445.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The surface defect detection of metallized ceramic rings has problems such as many defect categories and small gaps between classes, small defect area, small number of defect samples and uneven samples, resulting in low efficiency and poor accuracy of existing methods.
Using the Transformer framework object detection network, classification network and traditional image processing algorithm, pinhole defect detection branches and other defect detection branches are designed. Through the improved DETR object detection network and ViT image classification network, combined with the connected component analysis method, effective detection of surface defects of metalized ceramic rings is achieved.
Accurate detection of surface defects of metallized ceramic rings is achieved, the detection accuracy is significantly better than the existing mainstream defect detection methods, the real-time performance meets the online detection requirements, and can be applied to on-site conditions.
Smart Images

Figure CN119295436B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of metallized ceramic ring detection, and in particular to a method for detecting surface defects of a metallized ceramic ring. Background Art
[0002] Defect detection is an important means of ensuring product quality and improving production efficiency in the modern era. As an important new electronic device, metallized ceramic rings are widely used in communications, new energy, aerospace and other fields. The production process of metallized ceramic rings is complex, and defect detection is required to ensure the quality of the finished product. The defects of metallized ceramic rings mainly appear on the surface, with many types of defects and complex characteristics. Although automatic defect detection methods have developed rapidly in recent years, it is still difficult to find reliable solutions for complex occasions such as surface defect detection of metallized ceramic rings. Surface defects of metallized ceramic rings still rely mainly on manual detection, which is inefficient, labor-intensive and the effect cannot be guaranteed.
[0003] In recent years, defect detection technology based on machine vision has gradually become the mainstream method for surface defect detection. Machine vision surface defect detection can be divided into two categories: traditional methods and methods based on deep learning. Traditional methods use feature extraction methods and defect location and classification criteria designed manually for defect characteristics to complete defect detection, which can be divided into statistical methods, filtering methods, model methods, etc. Statistical methods achieve defect detection by performing statistical analysis on pixels or features in the image.
[0004] The effectiveness of traditional methods depends on the fit between the designed feature extraction method and the defect location and classification criteria and the application scenario. Compared with traditional methods, deep learning-based methods do not require artificially designed features and have stronger generalization capabilities. At present, although traditional methods still have advantages in certain specific occasions, deep learning-based methods have far surpassed traditional methods in most applications. Deep learning-based methods are currently the most studied type of methods in the field of defect detection.
[0005] Deep learning can achieve good results when used for defect detection with rich feature information, but performs poorly when used for small defect identification. Visual defect detection technology is developing rapidly, but for metallized ceramic rings, in order to achieve accurate and reliable visual defect detection, there are several common problems in industrial defect detection that need to be overcome:
[0006] First, there are many types of defects and the gap between them is small. There are many types of defects on the metal layer. Generally speaking, each defect has its own characteristics, but some defects belonging to different categories are not very different from each other, and the gap between them is small, which makes it difficult to distinguish in practical applications.
[0007] Second, the defect area is small. The size of the acquired defect image is 2448×2048 pixels, while the size of most defects is less than 32×32 pixels, especially the pinhole defect, which is only 8×8 pixels. The small defect area will result in less effective feature information available, further increasing the difficulty of defect detection.
[0008] Third, the number of defect samples is small and the samples are unbalanced. Although a lot of resources have been invested in collecting defect samples, there are still only 2,235 metallized ceramic ring samples collected on site, with only 3,399 defects. The size of the data set is much smaller than the large-scale public data set whose detection objects are general targets. At the same time, among the collected samples, detachment defects are the most common, accounting for 79.1% of the total defects, while pinholes, slurry spots, black spots, and defects account for only 10.7%, 6.9%, 1.7%, and 1.6%, respectively. The small size of the data set and the imbalance of samples will lead to insufficient model training, and it is difficult for deep learning methods to give full play to their advantages. Summary of the invention
[0009] In response to the above-mentioned technical problems to be solved, the present invention provides a method for detecting surface defects of metallized ceramic rings, which realizes the complementary advantages of the Transformer framework target detection network, classification network and traditional image processing algorithm, and realizes the effective detection of surface defects of metallized ceramic rings with the characteristics of many defect categories with small gaps between categories, small defect area, small number of defect samples and unbalanced samples.
[0010] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0011] A method for detecting surface defects of a metallized ceramic ring, wherein the method first designs other defect detection branches and pinhole defect detection branches; then in the other defect detection branches, two modules, a defect positioning module and a defect classification module, are designed to respectively handle positioning problems and classification problems, wherein in the defect classification module, the module input is pre-processed by bilinear interpolation super-resolution; in the pinhole defect detection branch, firstly, a deep learning method and a connected component analysis method are respectively used to perform pinhole defect detection, and then the detection results are fused;
[0012] Among them, the defect localization module improves the backbone network used in the module and the loss function during training.
[0013] As a further improvement of the above technical solution:
[0014] Preferably, the detection method specifically comprises the following steps:
[0015] Step S1, according to the pinhole defect area and appearance of the metallized ceramic ring, the surface defects are divided into pinhole defects and defects other than pinholes, and other defect detection branches and pinhole defect detection branches are designed; in the other defect detection branch, a defect localization module based on the DETR target detection network and a defect classification module based on the ViT image classification network are designed; in the pinhole defect detection branch, the DETR target detection network and the connected component analysis method are used to detect pinholes;
[0016] Step S2, improve the DETR target detection network, based on the lightweight EfficientNet-B2, use the 3-D weighted attention module SimAM; and adopt the linear combination of Smooth L1 function and DIoU function;
[0017] Step S3, constructing other defect detection branches, the defect localization module uses the DETR target detection network to locate the defect area; the defect classification module uses the ViT image classification network to determine the specific type of defects in the area located by the defect localization module;
[0018] Step S4, constructing a pinhole defect detection branch, first using a mask image to obtain a metal layer image without other defects, and then using a pinhole defect detection module based on connected component analysis and a pinhole defect detection module based on deep learning to perform pinhole defect detection, and integrating the detection results of the two pinhole defect detection modules.
[0019] Preferably, in step S2, the linear combination of the Smooth L1 function and the DIoU function is:
[0020] (1)
[0021] In the formula, , is a hyperparameter; For Smooth Loss function; is the DIoU loss function; For Smooth The bounding box regression loss function is a linear combination of the function and the DIoU function; The real bounding box of the target, including the center point coordinates (x, y) and four parameters: height (h) and width (w); The bounding box predicted by the model contains four parameters: the center point coordinates (x1, y1), height (h1) and width (w1); is the set of real numbers; Assign index function.
[0022] Preferably, the defect classification module in step S3 first extracts the area obtained by the defect positioning module as a sub-image; then, uses bilinear interpolation to enlarge the sub-image by K times; finally, uses a ViT image classification network based on the Transformer architecture to classify defect categories other than pinholes.
[0023] Preferably, the step S4 specifically includes the following steps:
[0024] S4-1, construction of mask image:
[0025] First, the defect image is preprocessed, and the CLAHE method is used to enhance the contrast between the metal layer and the ceramic layer and eliminate the noise in the image. Then, the Otsu method is used to perform threshold segmentation of the image and suppress the influence of noise and interference to obtain the complete metal layer area. Finally, the results of the defect localization module are used to suppress the information of other defect areas on the metal layer to obtain the mask image.
[0026] S4-2, two pinhole defect detection modules:
[0027] Firstly, the Otsu method is used to realize the binarization of the inspection image, and the binarization result is inverted; then, the connected domains with an area larger than the set threshold are removed through connected component analysis, and the remaining connected domains are the areas where the pinhole defects are located; finally, the morphological dilation operation is performed on the inspection image to expand the area of the connected domain where the pinhole defects are located to cover the pinhole defects;
[0028] S4-3, fusion of pinhole defect detection results:
[0029] The detection results of the pinhole defect detection module based on connected component analysis and the pinhole defect detection module based on deep learning are fused to obtain the final pinhole defect detection result. If there are overlapping areas in the bounding boxes obtained by different modules, the overlapping bounding boxes are merged and regarded as responses to the same pinhole.
[0030] Preferably, when the deep learning-based pinhole defect detection module detects defects, the training data set is firstly trained through sample category balancing and data expansion; and then the defect location module, defect classification module and pinhole defect detection module are trained.
[0031] Compared with the prior art, the surface defect detection method of the metallized ceramic ring provided by the present invention has the following advantages:
[0032] The metallized ceramic ring surface defect detection method of the present invention is a metallized ceramic ring surface defect detection method based on the integration of Transformer hybrid model and connected component analysis, which realizes the complementary advantages of Transformer framework target detection network, classification network and traditional image processing algorithm, and realizes the effective detection of metallized ceramic ring surface defects with many defect categories and small gaps between categories, small defect area, small number of defect samples and unbalanced samples. The detection method of the present invention has significantly better detection accuracy than the existing mainstream defect detection methods, and its real-time performance meets the requirements of online detection, and can be applied to metallized ceramic surface ring defect detection under field conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a flow chart of metallized ceramic ring defect detection of the present invention.
[0034] Figure 2 It is the improved DETR target detection network of the present invention.
[0035] Figure 3 It is a schematic diagram of the types of defects in metallized ceramic rings used in experimental verification.
[0036] Figure 4 This is a comparison chart of the results of different detection methods in experimental verification. DETAILED DESCRIPTION
[0037] The specific embodiments of the present invention are described in detail below. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0038] The surface defect detection method of the metallized ceramic ring of the present invention designs two main branches of other defect detection and pinhole defect detection in view of the large difference between pinhole defects and other defects, and processes pinhole defects and other defects other than pinholes separately. In view of the small gap between defect classes, two modules of defect positioning based on the DETR target detection network and defect classification based on the ViT image classification network are designed in the other defect detection branch to process the positioning problem and the classification problem separately. In the pinhole defect detection branch, the DETR target detection network and the connected component analysis method are used to detect pinholes respectively, and the detection results of the two methods are fused to make the detection of pinhole defects with extremely small area more accurate. In view of the characteristics of the surface defects of the metallized ceramic ring, the DETR target detection network is improved, and the ResNet-50 backbone network of the standard DETR target detection network is replaced with EfficientNet-B2; the SE attention mechanism in EfficientNet-B2 is replaced with the SimAM 3-D weight attention mechanism; and the regression loss function for training DETR is replaced with the linear combination loss function of Smooth L1 and DIoU. It can realize the complementary advantages of deep learning and traditional image processing algorithms.
[0039] The method for detecting surface defects of a metallized ceramic ring of the present invention specifically comprises the following steps:
[0040] Step S1, principle design of detection method.
[0041] like Figure 1 As shown in the figure, the pinhole defect area, appearance and other characteristics of the metallized ceramic ring are quite different from other defects. Therefore, two branches, other defect detection and pinhole defect detection, are designed to process pinhole defects and defects other than pinholes separately.
[0042] Furthermore, in other defect detection branches, two modules, defect localization and defect classification, are designed. The defect localization module uses the improved DETR target detection network to find the area where defects other than pinholes may be located in the detection image. The defect classification module uses the ViT image classification network to judge the specific category of defects contained in the area and obtain the detection results of defects other than pinholes.
[0043] Furthermore, the pinhole defect detection branch includes two modules: a pinhole defect detection module based on connected component analysis and a pinhole defect detection module based on deep learning. First, the mask image is constructed using the information of other defect areas obtained by the defect location module of other defect detection branches to obtain the area without other defects in the metal layer in the detection image; then, the processed image is input into the pinhole defect detection module based on connected component analysis and the pinhole defect detection module based on deep learning respectively, and two pinhole defect detection results are obtained independently; finally, the two pinhole defect detection results are fused to obtain a more final pinhole defect detection result.
[0044] Step S2, improvement of DETR target detection network.
[0045] The localization modules of other defects and the pinhole defect detection module based on deep learning all rely on efficient and accurate target detection networks. Therefore, choosing a suitable target detection network is crucial to improving the performance of the entire detection process. The DERT target detection network is an end-to-end target detection method based on the Transformer architecture. It uses the convolutional neural network ResNet as the backbone network (Backbone) to extract the features of the input image. The extracted features are sent to the encoder-decoder module of the Transformer architecture, encoded and decoded, and the detection results are output through the Prediction module. DETR uses a global attention mechanism, which allows the model to focus on multiple locations on the entire image at the same time, which helps solve the problems of overlapping targets and uncertain number of targets. Although the DETR target detection network performs well in large-scale public dataset target detection, its performance still needs to be improved when the number of samples is small and the samples are unbalanced, and the size of the target to be detected is small.
[0046] In this embodiment, the DETR target detection network is improved to address the difficulty of metallized ceramic ring defect detection. The structure of the improved DETR target detection network is as follows: Figure 2 shown.
[0047] In order to improve the DETR target detection network's ability to extract defect features of metallized ceramic rings, the ResNet-50 backbone network of the standard DETR target detection network was replaced. The replaced backbone network of this embodiment is based on the lightweight EfficientNet-B2, and uses the 3-D weighted attention module SimAM to replace the SE attention module in the MBconv module in the original network, further enhancing the ability to capture subtle features.
[0048] The selection of loss function during network training is an important factor affecting the performance of deep learning algorithms. The loss function of the standard DETR target detection network consists of prediction box classification loss and prediction box regression loss. In order to further improve the accuracy of prediction box regression and improve the problems of unstable model solution and slow convergence speed, this paper adopts a linear combination of Smooth L1 function and DIoU function ( ) replaces the prediction box regression loss in the standard DETR target detection network loss function:
[0049] (1)
[0050] In the formula, , is a hyperparameter; For Smooth Loss function; is the DIoU loss function; For Smooth The bounding box regression loss function is a linear combination of the function and the DIoU function; The real bounding box of the target, including the center point coordinates (x, y) and four parameters: height (h) and width (w); The bounding box predicted by the model contains four parameters: center point coordinates (x1, y1), height (h1) and width (w1); is the set of real numbers; Assign index function.
[0051] Step S3, other defect detection branches.
[0052] Two modules are designed: defect localization based on DETR target detection network and defect classification based on ViT image classification network, so as to deal with localization problem and classification problem separately. Specifically:
[0053] S3-1, defect location module.
[0054] The function of the defect localization module is to use the defect localization network to accurately locate the defect area. There are many types of metallized ceramic ring defects and the gap between categories is small. Therefore, when training the defect localization module, this embodiment combines defects other than pinholes (detachment, slurry spots, black spots, defects) into one category (other defects), allowing the defect localization module to focus on finding the location of the defect and handing over the task of identifying the specific type of defect to the defect classification module. The backbone network of the defect localization module is the target detection network improved for the metallized ceramic ring defect detection characteristics in step S2.
[0055] In the prediction results output by the defect location module, there is a situation where the prediction box fails to completely cover the defect area. Therefore, in the result output stage, the defect area obtained by the network is enlarged by R times to ensure that the obtained area can completely cover the defect. In addition to the information of the possible defect area, the network output detection result also includes the confidence of each defect area. In this embodiment, a confidence threshold H is set, and the area with a confidence lower than H is not considered as the defect area.
[0056] S3-2, defect classification module.
[0057] The defect classification module uses a classification network to determine the specific type of regional defects located by the defect location module.
[0058] Firstly, the area obtained by the defect localization module is extracted as a sub-image. Then, in order to utilize the information association between adjacent pixels of the image and increase the available information, bilinear interpolation is used to enlarge each sub-image by K times. Finally, the ViT-B / 16 image classification network based on the Transformer architecture is used to realize the classification of defect categories other than pinholes.
[0059] There are many types of defects in metallized ceramic rings, and their appearance is complex and varied. The ViT image classification network uses a self-attention mechanism to achieve the localization of key focus areas under a global perspective; it uses a high-performance Transformer architecture feature extraction module, which has good robustness when processing objects of different shapes, sizes, and colors, and is suitable for metallized ceramic ring defect classification applications.
[0060] Step S4, pinhole defect detection branch.
[0061] The DETR target detection network and connected component analysis method are used to detect pinholes respectively, and the detection results of the two methods are fused to make the detection of pinhole defects with extremely small area more accurate.
[0062] S4-1, construction of mask image.
[0063] The pinhole defect detection branch first uses a mask image to obtain a metal layer image without other defects, eliminating the interference of other defects on pinhole defect detection.
[0064] First, the defect image is preprocessed, and the contrast between the metal layer and the ceramic layer is enhanced by the CLAHE (Contrast-Limited Adaptive Histogram Equalization) method, and the noise in the image is eliminated by the median filter; then, the threshold segmentation of the image is realized by the Otsu method (the gray value of the metal layer is 1, and the gray value of other areas is 0), and the influence of noise and interference is further suppressed by connected component analysis and morphological closing operations to obtain the complete metal layer area. Finally, the results of the defect localization module in other defect detection branches are used to suppress the information of other defect areas on the metal layer to obtain the mask image.
[0065] The grayscale value of the metal layer area that does not contain other defects in the mask image is 1, and the grayscale values of other areas are all 0. The mask image and the original image are logically ANDed to obtain the input image of the two detection modules in the pinhole defect detection branch. The input image only contains the metal layer and does not contain defects other than pinholes, which can suppress the interference of other defects on pinhole defect detection.
[0066] S4-2, two pinhole defect detection modules.
[0067] In order to achieve the complementarity of traditional image processing methods and deep learning methods and improve the performance of pinhole defect detection, this embodiment uses two pinhole defect detection modules: a pinhole defect detection module based on connected component analysis and a pinhole defect detection module based on deep learning.
[0068] The working process of the pinhole defect detection module based on connected component analysis is as follows: first, the Otsu method is used to realize the binarization of the detection image, and the binarization result is inverted, so that the pinhole defect area exists in the form of a small white connected domain; then, the connected component analysis is used to remove the pinhole defect area with an area larger than the set threshold. The remaining connected domain with a smaller area is the area where the pinhole defect is located. Finally, a rectangular structure element with a size of 9×9 pixels and an anchor point at the geometric center is used to perform a morphological dilation operation on the detection image (the center point of the structure element is the geometric center of the rectangle) to expand the area of the above connected domain to ensure that the pinhole defect can be completely covered.
[0069] The backbone network of the deep learning-based pinhole defect detection module is also a target detection network improved according to the characteristics of metallized ceramic ring defect detection.
[0070] S4-3, fusion of pinhole defect detection results.
[0071] In the present invention, the detection results of the pinhole defect detection module based on connected component analysis and the pinhole defect detection module based on deep learning are fused to obtain the final pinhole defect detection result. The detection results of different modules may contain multiple responses to the same defect. In this process, if there are overlapping areas in the bounding boxes obtained by different modules, these overlapping bounding boxes are merged and regarded as responses to the same pinhole.
[0072] The overlap criterion of the defect area is used to judge whether the defect detection results of different networks and modules come from the same defect of the detection object. The detection results of the two pinhole defect detection modules and the defect localization module are checked for overlap respectively, and the pinhole defect detection results that have no overlap with the defect localization module are retained. The detection results of the two pinhole defect detection modules after verification with the defect localization module are then fused to obtain the final pinhole defect detection result.
[0073] Step S5: data enhancement and model training.
[0074] When the pinhole defect detection module based on deep learning detects defects, high-quality training data sets have an important impact on model performance. There are problems with the uneven distribution of samples and the small number of samples in the metallized ceramic ring defect data set. In order to ensure the effectiveness of the deep learning model, the quality of the training data set is improved by balancing the sample categories and expanding the data.
[0075] Data augmentation uses random horizontal flipping to increase the diversity and quantity of the original image; oversampling is used to increase the number of small defect samples of four types: black spot, pinhole, pulp point, and defect, and undersampling is used to reduce the number of fall off defect samples; finally, Generative Adversarial Networks (GAN) is used to generate pseudo defect areas and synthesize new pseudo sample images.
[0076] The GAN network extracts and combines the features of the original data set to generate a pseudo sample that is as similar as possible to the original sample distribution. If the GAN network is used to directly generate the entire metallized ceramic ring defect image, not only will the amount of calculation be too large, but the number and quality of defects contained in the generated image will also be difficult to guarantee; therefore, the detection method of the present invention only uses the GAN network to generate various pseudo defect areas, pastes the pseudo defect areas onto the defect-free metallized ceramic ring image, and synthesizes new pseudo samples.
[0077] The offline training process of the defect localization module, defect classification module, and pinhole defect detection module is as follows: 1235 frames of pictures are randomly selected from 2235 frames of original samples for the training stage, and the other original samples are used to evaluate the performance of the method and do not participate in the training process. Before network training, the number of samples used for training is expanded to 4000 frames through data enhancement, and the training set and validation set are divided into a ratio of 8:2. Since the number of training samples is still not comparable to large-scale public datasets even after data enhancement, the weights obtained by pre-training of the large-scale dataset ImageNet are loaded before the above network starts training.
[0078] Experimental verification
[0079] Reasonable selection of evaluation indicators is the key to measuring model performance. The purpose of this invention is to accurately detect defects. Therefore, this experiment selects the two indicators of precision (P) and recall (R) to verify each detection module and the overall method. For the defect classification model, the accuracy indicator is also added for evaluation, which can intuitively show the overall performance of the model on a given data set. The higher the accuracy, the stronger the model classification ability. The mean average precision (mAP) of each category is used to verify the impact of data enhancement on the performance of the target detection model.
[0080] Precision is the ratio of the number of correctly predicted positive samples to the number of samples predicted as positive samples. The formula is as follows:
[0081]
[0082] The recall rate represents the ratio of correctly predicted positive samples to the number of positive samples. The formula is as follows:
[0083]
[0084] Among them, TP represents the number of correctly classified positive samples, FP represents the number of misclassified negative samples, and FN represents the number of misclassified positive samples. According to the calculated precision and recall, the PR curve is drawn, and the area under the curve is the average precision (AP). mAP reflects the global detection performance of the model, which is obtained by summing and averaging the average precision of a single class. The formula is as follows:
[0085]
[0086]
[0087] Where P(R) represents the PR curve; N represents the total number of defect categories. The accuracy is obtained by calculating the proportion of correctly classified results in the classification model to all classification results. The formula is as follows:
[0088]
[0089] Among them, TN represents the number of correctly classified negative samples.
[0090] The metallized ceramic ring is composed of a metal layer and a ceramic layer. A total of 2235 frames of sample images were collected on site. Each frame of the sample image contained more than one defect, totaling 3399 defects. Figure 3 As shown in the figure, there are four types of defects on the surface of the metal layer: pinhole, pulp point, fall off and defect, while the only defect on the surface of the ceramic layer is black spot.
[0091] In order to verify the effectiveness of the method of the present invention in the task of surface defect detection of metallized ceramic rings, under the same experimental environment and data set, six defect detection methods, including Faster-RCNN w FPN, YOLOV8, original DETR, Deformable-detr, YoloFD and the detection method of the present invention, are selected to compare and analyze the methods using the original samples mentioned in step S5 for evaluating the performance of the methods as the test set. All models also use transfer learning to pre-train the network, and select the duplication rate and precision rate as evaluation indicators. The detection performance and detection results of different methods are shown in Tables 1 and 2, respectively. Figure 4 shown.
[0092] Table 1 shows the detection performance of the six detection methods on the defect test data set. The overall detection performance of the method of the present invention for the five types of defects is the best. The total recall rate for the five types of defects is 92.1%, and the precision rate is 89.2%, both of which are optimal. From the perspective of the detection effect of a single type of defect, the method of the present invention also has the best detection effect for the four types of defects, namely, pulp spots, detachment, defects and pinholes; the detection effect for black spot defects is slightly inferior to YoloFD (precision rate 100%, recall rate 99.5%) and Deformable-detr (precision rate 100%, recall rate 96.9%), but the precision rate of the method of the present invention for black spot defects can also reach more than 95%, which can meet the requirements of most applications.
[0093] Table 1 Performance comparison of different detection methods:
[0094]
[0095] Figure 4 The detection results of different detection methods for three frames of metallized ceramic ring defect images with a large number and type of defects are shown. There are 10 defects in the three frames of images, namely: 4 detachments, 3 pinholes, 1 slurry point, 1 black spot and 1 defect. The detection method of the present invention only missed the detachment defect once and accurately detected all other defects. The only detachment defect missed by the detection method of the present invention is located in the lower right corner of the second frame image. The defect area is small and the texture is close to the surface texture of the metal layer. All other methods failed to successfully detect this defect that the detection method of the present invention could not successfully detect. There are pinhole defects with very small area and high detection difficulty in all three frames of images. The detection method of the present invention achieves accurate detection of all pinhole defects in the three frames of images; other methods have poor detection effects on pinhole defects. Only the Faster-RCNN w FPN network successfully detects a pinhole defect in the upper right corner of the first frame. Faster-RCNN w FPN network has two false detections: the defect-free area in the first frame is falsely detected as falling off; the pulp point in the second frame is falsely detected as falling off; YOLO v8 misses the pulp point in the second frame. The detection accuracy of the detection method of the present invention is significantly better than all other methods.
[0096] The above implementation cases are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Although the present invention has been disclosed as above with preferred embodiments, they are not intended to limit the present invention. Therefore, any simple modification, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A method for detecting surface defects of a metallized ceramic ring, characterized in that: The detection method specifically comprises the following steps: Step S1, according to the pinhole defect area and appearance of the metallized ceramic ring, the surface defects are divided into pinhole defects and defects other than pinholes, and other defect detection branches and pinhole defect detection branches are designed; in the other defect detection branch, a defect localization module based on the DETR target detection network and a defect classification module based on the ViT image classification network are designed; in the pinhole defect detection branch, the DETR target detection network and the connected component analysis method are used to detect pinholes; Step S2, improve the DETR target detection network, based on the lightweight EfficientNet-B2, use the 3-D weighted attention module SimAM; and adopt the linear combination of Smooth L1 function and DIoU function; Step S3, constructing other defect detection branches, the defect localization module uses the DETR target detection network to locate the defect area; the defect classification module uses the ViT image classification network to determine the specific type of defects in the area located by the defect localization module; Step S4, constructing a pinhole defect detection branch, first using a mask image to obtain a metal layer image without other defects, then using a pinhole defect detection module based on connected component analysis and a pinhole defect detection module based on deep learning to perform pinhole defect detection, and fusing the detection results of the two pinhole defect detection modules; The step S4 specifically includes the following steps: S4-1, construction of mask image: First, the defect image is preprocessed, and the CLAHE method is used to enhance the contrast between the metal layer and the ceramic layer and eliminate the noise in the image. Then, the Otsu method is used to perform threshold segmentation of the image and suppress the influence of noise and interference to obtain the complete metal layer area. Finally, the results of the defect localization module are used to suppress the information of other defect areas on the metal layer to obtain the mask image. S4-2, two pinhole defect detection modules: Firstly, the Otsu method is used to realize the binarization of the inspection image, and the binarization result is inverted; then, the connected domains with an area larger than the set threshold are removed through connected component analysis, and the remaining connected domains are the areas where the pinhole defects are located; finally, the morphological dilation operation is performed on the inspection image to expand the area of the connected domain where the pinhole defects are located to cover the pinhole defects; S4-3, fusion of pinhole defect detection results: The detection results of the pinhole defect detection module based on connected component analysis and the pinhole defect detection module based on deep learning are fused to obtain the final pinhole defect detection result. If there are overlapping areas in the bounding boxes obtained by different modules, the overlapping bounding boxes are merged and regarded as responses to the same pinhole.
2. The method for detecting surface defects of a metallized ceramic ring according to claim 1, characterized in that: In step S2, the linear combination of the Smooth L1 function and the DIoU function is: (1) In the formula, ∈ is a hyperparameter; is the Smooth L1 loss function; is the DIoU loss function; The bounding box regression loss function is a linear combination of the Smooth L1 function and the DIoU function; is the real bounding box of the target, including the center point coordinates (x, y) and height and width 4 parameters; The bounding box predicted by the model, including the center point coordinates (x1, y1) and height and width 4 parameters; is the set of real numbers; Assign index function.
3. The method for detecting surface defects of metallized ceramic rings according to claim 1, characterized in that: The defect classification module in step S3 first extracts the area obtained by the defect positioning module as a sub-image; then, the sub-image is enlarged K times by bilinear interpolation; finally, the ViT image classification network based on the Transformer architecture is used to classify defect categories other than pinholes.
4. The method for detecting surface defects of a metallized ceramic ring according to claim 1, characterized in that: When the pinhole defect detection module based on deep learning detects defects, the training data set is firstly trained through sample category balancing and data expansion; and then the defect location module, defect classification module and pinhole defect detection module are trained.
Citation Information
Patent Citations
MLCC appearance defect detection method and device and storage medium
CN115439410A
Chip inductor surface defect detection method and system based on token fusion
CN116309451A