Aluminum surface defect detection method, storage medium and computer system

Through the combination of deep residual learning and feature pyramid network, the method of aluminum surface defect detection is improved, which solves the problems of difficulty in extracting small targets and easy loss of information in aluminum surface defect detection, and achieves efficient identification of aluminum surface defects. and classification.

CN114663380BActive Publication Date: 2024-09-17HEFEI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210265481.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2024-09-17
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

In the detection of aluminum surface defects, there are problems such as training overfitting and poor accuracy caused by a large proportion of small targets, sparse samples, and larger sample types. It is difficult for existing technologies to effectively identify and classify aluminum surface defects.

Method used

A deep residual learning strategy is used to obtain defect feature maps from noisy images, combined with feature pyramid network and pyramid segmentation attention mechanism, improved ordinary convolution to extract multi-scale features, and perform classification and regression through region proposal network and target detection network , forming the FDA-FRCNN model.

Benefits of technology

It achieves efficient detection of defects of various sizes, improves detection accuracy and robustness, and reduces the rate of false detection and missed detection of aluminum surface defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663380B
    Figure CN114663380B
Patent Text Reader

Abstract

The present invention discloses a method for detecting surface defects of aluminum materials, a storage medium and a computer system, wherein the method comprises the following steps: S1, using a deep residual network to obtain a defect feature map; S2, a feature extraction network FDA extracts deep features; S3, generating multiple preset positioning frames for each position of the defect feature map, applying a region proposal network RPN to the defect feature map, and returning a refined region proposal frame and a score of an object of interest contained therein; S4, retaining a set of region proposal frames closest to the true frame; S5, a target detection network R‑CNN Predictor classifies objects in the region proposal frame set and regresses the region proposal frame; S6, training the FDA‑FRCNN model obtained in step S5 to obtain a final FDA‑FRCNN model. The FDA‑FRCNN model realizes efficient detection of defects of various scales.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection, and in particular to an aluminum surface defect detection method, a storage medium and a computer system. Background Art

[0002] With the continuous improvement of the manufacturing industry level and people's consumption level in my country, the manufacturing industry has higher and higher requirements for the quality of industrial products. At the same time, the surface quality of products has an important impact on the direct use and reprocessing of products. Surface defect detection has become an indispensable part of the industrial production process. At present, the aluminum industry has realized the automation of production links, but the surface defect detection of products generally adopts the method of manual visual inspection. This method not only has low detection efficiency, high false detection rate and missed detection rate, high labor intensity, but also high manual detection cost and is easily affected by workers' experience and subjective factors.

[0003] With the development of image processing technology, machine vision defect detection methods have gradually replaced manual detection methods and have been proven to be feasible in actual industrial production inspection environments. Machine vision inspection technology is a non-contact automatic inspection technology with the advantages of safety, reliability, high detection accuracy, and the ability to operate in complex production environments for a long time. It is an effective method to achieve automation and intelligence in the production of metal materials and the steel industry, and has certain advantages in actual application scenarios.

[0004] In the past few years, many traditional computer vision methods have been applied to defect detection tasks. Typical machine vision-based defect detection methods include light sources, charge-coupled device cameras, and image processing algorithms. Threshold method and edge detection method are proposed, which extract edges through some filtering operators and then use thresholds for judgment, but this method cannot clearly identify defects and pseudo-defects. Some scholars use wavelet-based detection technology for defect detection, which can detect multiple typical defects using selected wavelet bases and multi-resolution levels, but the accuracy of defect detection for each category is not high. Although traditional machine vision methods have achieved automatic detection of surface defects and achieved good results in some cases, they still have some problems. Changes in image light, brightness, and image quality will have a huge impact on the results, and the hand-designed functions used in defect detection need to be carefully designed by programmers familiar with the task field, lack of robustness, and are not conducive to the recognition, classification, and detection of surface defects.

[0005] Convolutional Neural Networks (CNN) is an efficient recognition method developed in recent years. It is inspired by the electrophysiology of animal vision and simulates the local sensitivity and direction selection characteristics of the biological cerebral cortex. Compared with traditional computer vision methods, deep learning networks can learn richer and more representative features through a series of convolution operations. Generally speaking, industrial production defect detection tasks based on deep learning usually include segmentation, classification and detection. Detection is to locate and classify defects in images, which is usually difficult. Based on the target detection framework Faster RCNN (Faster Region with Convolutional Neural Network), defect detection of industrial CT (Computed Tomography) images is realized. The prior art also studies railway surface defect detection based on CNN, puts the track image into a fine-tuned CNN model, and extracts key features to classify and locate defect targets. The prior art also uses the AdamOptimizer algorithm to improve the classic Lenet-5 convolutional neural network model to realize defect detection of dispensing in industrial production. Although the above existing studies have achieved defect detection algorithms with high accuracy, there are relatively few studies on aluminum surface defect detection. The task of industrial aluminum surface defect detection has problems such as training overfitting and poor accuracy caused by a large proportion of tiny targets, sparse samples and larger sample types. Therefore, aluminum surface defect detection is a challenging task. Summary of the invention

[0006] In order to solve the existing problems, the present invention provides an aluminum surface defect detection method, a storage medium and a computer system. The specific scheme is as follows:

[0007] A method for detecting surface defects of aluminum materials comprises the following steps:

[0008] S1, obtains defect feature maps from noisy images using a deep residual learning strategy;

[0009] S2, feature extraction network FDA extracts deep features from the defect feature map;

[0010] S3, generating multiple preset positioning boxes for each position of the defect feature map, and for each of the positioning boxes, applying the region proposal network RPN to the corresponding area in the defect feature map, and returning a refined region proposal box and a score of the object of interest contained therein;

[0011] S4, retaining the set of region proposal frames that are closest to the true frame according to the scores in step S3;

[0012] S5, the target detection network R-CNN Predictor classifies the objects in the set of region proposal boxes retained in step S4 according to the defect feature map extracted by the feature extraction network FDA in step S2, and regresses the region proposal boxes.

[0013] S6, training the FDA-FRCNN model obtained in step S5 to obtain a final FDA-FRCNN model.

[0014] Preferably, a pyramid split attention mechanism is added to layer1, layer2, layer3, and layer4 of the deep residual network ResNet50 in step S1, and a PSA-Pyramid Split Attention module is used to replace the 3×3 convolution in the original deep residual network, thereby obtaining a new block.

[0015] Preferably, in step S2, a feature pyramid network FPN is used to extract deep features, and the steps include:

[0016] S21, upsample the feature map of the deepest feature layer output by DCN by 8 times, 4 times, 2 times and 1 times respectively;

[0017] S22, concatenate and fuse the sampling results in step S21 with block1, block2, block3 and DCN layer respectively to obtain feature maps of multiple scales, which are respectively recorded as FDA1, FDA2, FDA 3 and FDA4.

[0018] Preferably, the last layer in the feature extraction network FDA uses a convolution technique of variable convolution to change the inherent geometric shape of ordinary convolution to obtain a DCN layer.

[0019] Preferably, the target detection network R-CNN Predictor in step S5 uses RoIAlign to extract features and context information of the object candidate region according to the position of the candidate region generated by the region proposal network RPN and the feature map of the feature extraction network FDA. By fusing these features, the detection network can perform object classification and region proposal box regression.

[0020] Preferably, the training step in step S6 includes:

[0021] S61, collecting data, and performing data enhancement on the collected data to form a data set;

[0022] S62, according to the data set, the region proposal network RPN is trained by calculating the loss function to obtain the final FDA-FRCNN model.

[0023] Preferably, the steps of collecting the data set and processing the collected data set in step S61 include:

[0024] S611, collecting a data set, wherein the data set is an image of surface defects of an aluminum profile;

[0025] S612, labeling the defect image using labeling software Labelimg;

[0026] S613, adding Gaussian blur to the defect image, changing the background color, and increasing light and dark changes to achieve the purpose of enhancing the data set;

[0027] S614, scaling the defect images to the same size;

[0028] S615, randomly flipping the uniformly scaled defect image according to different angles;

[0029] S616, balancing the processed data set, expanding the category with a small number of defective images, and the expansion method is to randomly crop in proportion to obtain more images of the same category to increase the richness of the data.

[0030] Preferably, the step of calculating the loss function in step S62 includes:

[0031] S621, assigning a binary class label to each positioning box;

[0032] S622, when the preset anchor box and the real box have the highest IoU or the IoU exceeds 0.7, it is determined as a positive sample; when the IoU between the preset anchor box and the real box is less than 0.3, it is determined as a negative sample, and the rest are discarded, wherein the preset anchor box is the selected one of the positioning boxes;

[0033] S623, according to the conquered sample definition, the multi-task loss objective function is minimized in the model. The loss function of the RPN part is defined as follows:

[0034]

[0035] Among them, L cls is the binary cross entropy loss we use for classification and is defined as follows:

[0036]

[0037] For border regression we use To calculate the loss, it is defined as follows:

[0038]

[0039] In the above three formulas, i represents the index of the preset anchor box in the training batch, P i Indicates the predicted probability that the i-th preset anchor box is the target. When the preset anchor box is a positive sample, The value is 1, otherwise it is 0; for each sample i, four position values ​​(x, y, w, h) need to be predicted, where (x, y) is the coordinate of the center point, and (w, h) is the width and height of the region proposal box; t i is the predicted position and anchor point (x a ,y a ,h a ,w a ), is the offset vector between the ground-truth box and the anchor point.

[0040] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. After the computer program is run, the above-mentioned aluminum material surface defect detection method is executed.

[0041] The present invention also discloses a computer system, including a processor and a storage medium, wherein a computer program is stored on the storage medium, and the processor reads and runs the computer program from the storage medium to execute the above-mentioned aluminum surface defect detection method.

[0042] The beneficial effects of the present invention are:

[0043] The FDA-FRCNN model, an aluminum surface defect detection model, improves the Faster R-CNN network. It integrates the pyramid segmentation attention mechanism and the feature pyramid network to address the problems of difficult feature extraction of small targets and easy information loss. It improves ordinary convolution to solve the problems of large deformation and irregularity of defective targets, and achieves efficient detection of defects of various scales. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 This is a performance comparison table of different backbone networks on the aluminum surface defect dataset;

[0046] Figure 2 This is a performance comparison table of mainstream object detection models on defect datasets;

[0047] Figure 3 is a flow chart of the method of the present invention;

[0048] Figure 4 This is the overall framework diagram of FDA-FRCNN of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The related work of defect image object detection can be divided into machine learning based methods and deep learning based methods.

[0051] With the development of classification and image feature extraction based on machine learning, target detection is now usually expressed as a classification problem. The method steps of defect image target detection based on machine learning include: 1. Region proposal, which refers to generating candidate regions where targets exist from defect images, and the methods include sliding window search and region of interest ROI; 2. Extracting features from the generated candidate regions; 3. Object classification, which refers to inputting the feature information of all candidate regions into the classifier for classification. Commonly used classifiers include K-nearest neighbor KNN, Adaboost and support vector machine SVM.

[0052] The defects of machine learning-based methods: Sliding window search uses a sliding window with a fixed step size and size to slide the input image. This method can completely traverse the entire image. However, aluminum surface defect images usually have large size differences, contain multiple types of objects, and have complex backgrounds. The use of a fixed-size sliding window traversal is not flexible enough and is very inefficient. RoI selection is designed to generate region proposals that do not cover the entire image, greatly reducing the time spent on generating proposed regions. However, this method relies too much on the design of significant features of the target object type itself and has poor generalization ability. Although these methods have achieved certain success, they essentially only focus on low-level features of the image and cannot accurately detect the target. This feature extraction method can only obtain low-level features and does not have high-level semantic information, making it difficult to accurately express the characteristics of the target object.

[0053] In recent years, the field of computer vision has developed rapidly. With its powerful feature learning and feature expression capabilities, convolutional neural networks have achieved better results than traditional methods in many applications. Region-based Convolutional Networks, R-CNN, first uses selective search to generate candidate regions, then uses R-CNN to extract region proposals, and finally uses SVM classification, achieving a qualitative leap in target detection performance. This work pioneered the use of deep learning to handle target detection tasks and its accuracy far exceeds that of traditional methods. Since then, a large number of detection models based on deep learning have emerged. According to the implementation steps, the current mainstream models can be divided into one-stage methods and two-stage methods.

[0054] The two-stage object detection algorithm inherits the idea of ​​R-CNN, but from the perspective of actual application scenarios, the idea of ​​R-CNN has many problems. On the one hand, the selective search algorithm is very complex. In the feature proposal extraction stage, CNN will extract features for each candidate area, and overlapping areas will be repeatedly calculated many times, which greatly increases the computational overhead and consumes a lot of time on the candidate areas. On the other hand, the candidate bounding boxes generated by the selective search algorithm of R-CNN cannot be adjusted, which leads to inaccurate positioning of objects and affects detection accuracy.

[0055] Fast R-CNN first embeds the entire image into the CNN model, and then maps the generated candidate regions to the corresponding regions of the feature map through the RoI pooling operation. It solves the problems of inaccurate candidate bounding box positioning and repeated feature extraction, and reduces time consumption.

[0056] Faster R-CNN introduced the Region Proposal Network (RPN) to replace the selective search algorithm, which not only achieved higher accuracy than R-CNN and Fast R-CNN, but also greatly reduced the calculation time.

[0057] YOLO is a representative algorithm for single-stage target detection. It removes the step of generating region candidate boxes. The steps of the algorithm are: 1. Define target detection as a regression problem. YOLO uses a single neural network to divide the input image into a specified number of region blocks; 2. Set corresponding anchor boxes of different scales for each region block; 3. Select the appropriate anchor box for bounding box regression and category prediction according to the target scale. Its advantages are: the single-stage target detection algorithm is much faster than the two-stage algorithm without generating candidate regions. Its disadvantages are: the blind gridding of the image also leads to low detection accuracy, especially the detection accuracy of small targets is far behind the two-stage algorithm.

[0058] With the development of deep learning algorithms, deep learning-based methods have achieved success in many natural scenarios.

[0059] Unlike objects in general natural scene images, defect targets in surface defect images are easily obscured and are also small relative to the overall image size, making them difficult to locate accurately. In the process of extracting features using the CNN network, a traditional convolutional neural network, the input image goes through multiple layers, and the resolution of the feature map gradually decreases with the depth of the network. The decrease in resolution makes it difficult for smaller defect targets to receive sufficient responses, making it impossible to classify and regress boundary coordinates, making them difficult to identify.

[0060] There are objects of different sizes in defect images, and different objects have different features. Simple objects can be distinguished by shallow features, and complex objects can be distinguished by deep features. In addition, the semantics of feature maps are lost in deep networks. Therefore, we proposed the FDA-FRCNN model. The feature pyramid network FPN is used to improve the basic feature extraction network. The feature pyramid network uses multi-scale feature fusion to fuse high-level and low-level semantic information, balance speed and accuracy, and obtain more robust semantic information. At the same time, in order to enhance the feature extraction network's ability to extract small objects, we use a pyramid segmentation attention mechanism in the feature extraction stage, which helps to reduce unnecessary shallow feature information in the background.

[0061] The FDA-FRCNN model consists of three parts: the feature extraction network FDA, the region proposal network RPN, and the object detection network R-CNN Predictor. The whole process is as follows: FDA extracts deep features from the defect image. For each positioning box, RPN is applied to the corresponding area in the feature map and returns a refined bounding box, namely the refined region proposal box and the probability score that the refined box contains the object of interest. These scores are used to retain the set of bounding boxes that are closest to the true box. Finally, R-CNN Predictor is applied to the region proposal box retained by RPN and the feature map extracted by FDA, classifies the object in the region, and returns a further refined region proposal box.

[0062] The specific embodiment is: a method for detecting surface defects of aluminum materials, comprising the following steps:

[0063] S1, Obtaining defect feature maps from noisy images using a learning strategy of deep residual networks.

[0064] Among them, the pyramid split attention mechanism is added to layer1, layer2, layer3, and layer4 of the deep residual network ResNet50, and the PSA-Pyramid Split Attention module is used to replace the 3×3 convolution in the original deep residual network, thereby obtaining a new block to improve the feature extraction capability of the network. The PSA module can integrate multi-scale spatial information and cross-channel attention into the block of each segmented feature group, so the PSA module can better realize the information interaction between local and global channel attention.

[0065] S2, the feature extraction network FDA extracts deep features from the defect feature map.

[0066] To solve the problem that the features of aluminum defect images are easily lost after deep network extraction, we use feature pyramid network FPN to extract deep features in the feature extraction stage. The steps include:

[0067] S21, upsample the feature map of the deepest feature layer output by DCN by 8 times, 4 times, 2 times and 1 times respectively;

[0068] S22, concatenate and fuse the sampling results in step S21 with block1, block2, block3 and DCN layer respectively to obtain feature maps of multiple scales, which are respectively recorded as FDA1, FDA2, FDA 3 and FDA4.

[0069] Due to the fusion of feature layers with different sampling rates, the feature map at each scale can not only retain the underlying feature information obtained by convolution, but also fuse the high-level feature information, thus realizing feature fusion at multiple scales, enriching the information of the feature layer, and effectively avoiding the problem of feature information loss caused by downsampling.

[0070] Ordinary convolutional neural network models mainly rely on the diversity of the data itself to overcome the geometric shape changes of feature maps. The model itself does not have a mechanism to adapt to geometric changes, and there are limitations in modeling complex unknown transformations. The limitations come from the fixed geometric structure of the CNN model. The convolution unit samples the input feature map at a fixed position, and the pooling layer reduces the spatial resolution at a fixed ratio. According to the analysis of surface defects of aluminum profiles, most of the various defects are horizontal and elongated defects, and the lengths are inconsistent. Severe defects such as scratches are longer in length, and minor defects such as jets are shorter in length. The basic convolutional layers are all fixed square shapes, and the ability to extract features of such strip defects is not strong enough.

[0071] In order to enhance the ability to locate defect targets, we use deformable convolution technology in the last layer of the model's vital signs extraction network to change the inherent geometric shape of ordinary convolution to obtain the DCN layer.

[0072] From the formula level: general convolution can be defined as follows:

[0073]

[0074] Deformable convolution adds a 2D offset to each grid sampling point based on the standard convolution, allowing the sampling grid to deform freely. The definition is as follows:

[0075]

[0076] The offset is part of the network structure and is calculated by another parallel standard convolution unit, which can also be learned end-to-end through gradient back propagation. After learning the offset, the size and position of the deformable convolution kernel can be dynamically adjusted according to the image content that needs to be recognized. The positions of the convolution kernel sampling points at different positions will change adaptively according to the image content, thereby adapting to the geometric deformations of different objects such as shape and size. Using bilinear interpolation to convert the output of any position into an interpolation operation for the feature map solves the problem of needing to derive discontinuous position variables.

[0077] S3, generating multiple preset positioning boxes for each position of the defect feature map, and for each of the positioning boxes, applying the region proposal network RPN to the defect feature map, and returning a refined region proposal box and a score of the object of interest contained therein.

[0078] S4, according to the true label of each target, all candidate region proposal boxes on the defect feature map are screened, that is, the intersection over union (IOU) operation is performed, and those with low scores are discarded, and those with high scores are retained as region proposal boxes, that is, the set of region proposal boxes closest to the true box is retained according to the score in step S3;

[0079] S5, the target detection network R-CNN Predictor classifies the objects in the set of region proposal boxes retained in step S4 according to the defect feature map extracted by the feature extraction network FDA in step S2, and regresses the region proposal boxes.

[0080] The target detection network R-CNN Predictor uses RoI Align to extract the features and context information of the object candidate region according to the position of the candidate region generated by the region proposal network RPN and the feature map of the feature extraction network FDA. By fusing these features, the detection network can perform object classification and region proposal box regression. RoI Align is used to replace the original RoI pooling in order to enhance the network's ability to detect small targets. In the operation of mapping the region proposal to the feature map, RoI Align discards the rounding operation of RoI pooling and retains the original floating point number. After determining the number of sampling points, each small area is divided into two halves, and the center point position of each part is taken. The pixels at the center point position are calculated using bilinear interpolation.

[0081] S6, training the FDA-FRCNN model obtained in step S5 to obtain a final FDA-FRCNN model. The training step includes:

[0082] S61, collecting data, and performing data enhancement on the collected data to form a data set;

[0083] The steps of collecting the data set and processing the collected data set include:

[0084] S611, collecting a data set, wherein the data set is an image of surface defects of an aluminum profile;

[0085] S612, labeling the defect image using labeling software Labelimg;

[0086] S613, adding Gaussian blur to the defect image, changing the background color, and increasing light and dark changes to achieve the purpose of enhancing the data set;

[0087] S614, scaling the defect images to the same size;

[0088] S615, randomly flipping the uniformly scaled defect image according to different angles;

[0089] S616, balancing the processed data set, expanding the category with a small number of defective images, and the expansion method is to randomly crop in proportion to obtain more images of the same category to increase the richness of the data.

[0090] S62, according to the data set, the region proposal network RPN is trained by calculating the loss function to obtain the final FDA-FRCNN model.

[0091] The calculation step of the loss function includes:

[0092] S621, assigning a binary class label to each positioning box;

[0093] S622, when the preset anchor box and the real box have the highest IoU or the IoU exceeds 0.7, it is determined as a positive sample; when the IoU between the preset anchor box and the real box is less than 0.3, it is determined as a negative sample, and the rest are discarded, wherein the preset anchor box is the selected one of the positioning boxes;

[0094] S623, according to the conquered sample definition, the multi-task loss objective function is minimized in the model. The loss function of the RPN part is defined as follows:

[0095]

[0096] Among them, L cls is the binary cross entropy loss we use for classification and is defined as follows:

[0097]

[0098] For border regression we use To calculate the loss, it is defined as follows:

[0099]

[0100] In the above three formulas, i represents the index of the preset anchor box in the training batch, P i Indicates the predicted probability that the i-th preset anchor box is the target. When the preset anchor box is a positive sample, The value is 1, otherwise it is 0; for each sample i, four position values ​​(x, y, w, h) need to be predicted, where (x, y) is the coordinate of the center point, and (w, h) is the width and height of the region proposal box; t i is the predicted position and anchor point (x a ,y a ,h a ,w a ), is the offset vector between the ground-truth box and the anchor point.

[0101] In object detection, the model pre-sets a large number of prior boxes for each image. During the training process, the network will update the weight parameters based on the overlap between the predicted area and the actual area, that is, the size of the intersection of the two areas. In order to evaluate the prediction results and compare with other methods, we use the intersection of the two areas IOU to quantitatively evaluate the performance of the detection model. IOU is defined as:

[0102]

[0103] Among them, G Tis the annotated ground-truth box, P M is the prediction result. As an evaluation indicator, the value of IOU can be set to different sizes, and this paper sets it to 0.5. When the IOU between the predicted area and the true area is greater than 0.5, the predicted box is considered to be a true prediction, called a positive sample, otherwise it is a negative sample.

[0104] In the evaluation phase of this study, precision is defined as the ratio between the number of positive samples and the number of recognized samples. Recall is for all objects of a class, and it is defined as the ratio of correctly recognized objects to the total number of such objects in the test dataset. They are defined as follows:

[0105]

[0106] The true positive sample TP indicates that the positive sample is detected correctly, the false negative sample FN indicates that the negative sample is detected incorrectly, and the false positive sample FP indicates that the positive sample is detected incorrectly.

[0107] AP is introduced to intuitively represent the performance of the predictor. It represents the performance of the model on a specific category of objects. The value is equal to the area enclosed by the precision-recall PR curve and the coordinate axis. Specifically, AP represents the accuracy of a certain category and cannot measure the overall performance of the entire model. The average value of each category (mAP) represents the average accuracy of each category of the model in the dataset, which can well reflect the overall performance of the model. The above definition formula is as follows:

[0108]

[0109] This paper tests the mAP under different IOU (0.5, 0.5: 0.95) standards, compares the parameter quantities of different models, and uses the model's detection ability for large, medium and small scale targets as evaluation indicators.

[0110] Performance comparison of different backbone networks on the aluminum surface defect dataset Figure 1 sheet.

[0111] In order to verify the feature extraction capability of the FDA network, we tested the performance of the Faster R-CNN model of different backbone networks on the aluminum defect dataset. The tested feature extraction networks mainly include VGG16, MobileNetV2, MobileNetV3, EfficientNetV2, ResNet50+FPN and FDA. It can be seen that the FDA-FRCNN model achieved the best results regardless of the evaluation index IOU of 0.5 or 0.75, which is also combined with the Faster R-CNN model. When the evaluation standard is IOU=0.5, FDA achieved the best mAP value of 89.6%, which is 4.3% higher than ResNet50+FPN. For the more stringent standard of IOU=0.75, FDA is far ahead of other models, which shows that FDA has a huge advantage over other feature extraction networks. By comparing the parameter amount of the model, it can be seen that although the lightweight networks MobileNetV2 and MobileNetV3 have a small number of parameters, the detection accuracy is too low. The main reason is that the feature extraction ability is poor and key information cannot be extracted for defect targets. As a backbone network, EfficientV2 outperforms MobileNet and VGG, but its mAP is still far behind FDA. This shows that the search method that balances network depth, width, and input size can improve performance to a certain extent, but the use of deep separable convolution consumes a lot of video memory, and the improvement in accuracy is not obvious. In addition, from the performance of ResNet50+FPN, it can be inferred that the model that integrates the feature pyramid network FPN can extract feature information of different scales, and has certain advantages in defect data set detection. FDA adds a split space attention mechanism and deformable convolution, which enables the network to extract more global information. Compared with other feature extraction networks, it has stronger performance, not only reduces the number of parameters but also improves detection accuracy, and has achieved certain breakthroughs in the field of aluminum defect detection.

[0112] The performance of FDA-FRCNN is compared with mainstream object detection models including YOLOV3+SPP, SSD, YOLOV4, and YOLOV5 on defect datasets. The experimental results are as follows: Figure 2As shown. From the results, we can see that FDA-FRCNN has the best performance in terms of accuracy. Under the standard of IOU=0.5, the mAP value of 89.6% is 10.5% higher than that of the second YOLOV4, and the number of parameters is reduced by 41%. Although the inference speed is slower than that of YOLOV4, the reduction in inference speed is within an acceptable range compared to the significant improvement in accuracy. The overall performance of YOLOV5 reflects the advantages of the one-stage model with fast speed and few parameters. It has a fast detection speed for defective targets but sacrifices a certain degree of accuracy. The accuracy gap relative to FDA-RCNN is more than 10%. It is worth noting that as a one-stage detection model, SSD is faster than YOLOV3+SPP on the basis of accuracy not lower than that of YOLOV3+SPP, and its performance is better than YOLOV3, but the accuracy is 14% lower than that of FDA-FRCNN. Under the standard of IOU=0.5:0.95, the mAP value of FDA-FRCNN is 20% higher than that of YOLOV3+SPP, YOLOV5s and SSD models, which reflects that the bounding box obtained by model regression is closer to the real bounding box, greatly reducing the probability of missed detection and false detection.

[0113] Comprehensive experiments show that FDA-FRCNN has greatly improved the detection accuracy without increasing the number of parameters, especially in the detection of small targets compared with other models. Its comprehensive performance has great advantages over other models in the field of aluminum defect detection.

[0114] The FDA-FRCNN model, an aluminum surface defect detection model, improves the Faster R-CNN network. It integrates the pyramid segmentation attention mechanism and the feature pyramid network to address the problems of difficult feature extraction of small targets and easy information loss. It improves ordinary convolution to solve the problems of large deformation and irregularity of defective targets, and achieves efficient detection of defects of various scales.

[0115] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. After the computer program is run, the above-mentioned aluminum material surface defect detection method is executed.

[0116] The present invention also discloses a computer system, including a processor and a storage medium, wherein a computer program is stored on the storage medium, and the processor reads and runs the computer program from the storage medium to execute the above-mentioned aluminum surface defect detection method.

[0117] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. The technician may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.

[0118] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in cooperation with a DSP core, or any other such configuration.

[0119] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, a storage medium may be integrated into a processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and the storage medium may reside in a user terminal as discrete components.

[0120] In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented as a computer program product in software, each function may be stored on or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include both computer storage media and communication media, including any medium that facilitates the transfer of a computer program from one place to another. Storage media may be any available medium that can be accessed by a computer. As an example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer. Any connection is also properly referred to as a computer-readable medium. For example, if the software is transmitted from a website, a server, or other remote source using a coaxial cable, a fiber optic cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wherein disk often reproduces data magnetically, while disc reproduces data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0121] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.

[0122] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting surface defects of aluminum materials, It is characterized in that The following steps are involved: S1, uses the learning strategy of the deep residual network to obtain the defect feature map from the noisy image; the pyramid split attention mechanism is added to layer1, layer2, layer3, and layer4 of the deep residual network ResNet50, and the PSA-Pyramid SplitAttention module is used to replace the 3×3 convolution in the original deep residual network, thereby obtaining a new block; S2, the feature extraction network FDA uses the feature pyramid network FPN to extract deep features from the defect feature map, the steps include: S21, upsample the feature map of the deepest feature layer output by DCN by 8 times, 4 times, 2 times and 1 times respectively; S22, concatenating and fusing the sampling results in step S21 with block1, block2, block3 and DCN layers respectively to obtain feature maps of multiple scales, which are respectively recorded as FDA1, FDA2, FDA 3 and FDA4; S3, generating multiple preset positioning boxes for each position of the defect feature map, applying a region proposal network RPN to the defect feature map for each positioning box, and returning a refined region proposal box and a score of the object of interest contained therein; S4, retaining the set of region proposal frames that are closest to the true frame according to the scores in step S3; S5, the target detection network R-CNN Predictor classifies the objects in the set of region proposal boxes retained in step S4 according to the defect feature map extracted by the feature extraction network FDA in step S2, and regresses the region proposal boxes; S6, training the FDA-FRCNN model obtained in step S5 to obtain a final FDA-FRCNN model.

2. The method according to claim 1, Features: The last layer in the feature extraction network FDA uses a convolution technique called variable convolution to change the inherent geometric shape of ordinary convolution to obtain a DCN layer.

3. The method according to claim 1, Features: The target detection network R-CNNPredictor in step S5 uses RoIAlign to extract features and context information of the object candidate region according to the position of the candidate region generated by the region proposal network RPN and the feature map of the feature extraction network FDA. By fusing these features, the detection network can perform object classification and region proposal box regression.

4. The method according to claim 1, It is characterized in that The training step in step S6 includes: S61, collecting data, and performing data enhancement on the collected data to form a data set; S62, according to the data set, the region proposal network RPN is trained by calculating the loss function to obtain the final FDA-FRCNN model.

5. The method according to claim 4, It is characterized in that The steps of collecting the data set and processing the collected data set in step S61 include: S611, collecting a data set, wherein the data set is an image of surface defects of an aluminum profile; S612, labeling the defect image using labeling software Labelimg; S613, adding Gaussian blur to the defect image, changing the background color, and increasing light and dark changes to achieve the purpose of enhancing the data set; S614, scaling the defect images to the same size; S615, randomly flipping the uniformly scaled defect image according to different angles; S616, balancing the processed data set, expanding the category with a small number of defective images, and the expansion method is to randomly crop in proportion to obtain more images of the same category to increase the richness of the data.

6. The method according to claim 5, It is characterized in that The calculation step of the loss function in step S62 includes: S621, assigning a binary class label to each positioning box; S622, when the preset anchor box and the real box have the highest IoU or the IoU exceeds 0.7, it is determined as a positive sample; when the IoU between the preset anchor box and the real box is less than 0.3, it is determined as a negative sample, and the rest are discarded, wherein the preset anchor box is the selected one of the positioning boxes; S623, according to the conquered sample definition, the multi-task loss objective function is minimized in the model. The loss function of the RPN part is defined as follows: Among them, L cls is the binary cross entropy loss we use for classification and is defined as follows: For border regression we use Smooth l1 To calculate the loss, it is defined as follows: In the above three formulas, i represents the index of the preset anchor box in the training batch, P i Indicates the predicted probability that the i-th preset anchor box is the target. When the preset anchor box is a positive sample, The value is 1, otherwise it is 0; for each sample i, four position values ​​(x, y, w, h) need to be predicted, where (x, y) is the coordinate of the center point, and (w, h) is the width and height of the region proposal box; t i is the predicted position and anchor point (x a ,y a ,h a ,w a ), is the offset vector between the ground-truth box and the anchor point.

7. A computer-readable storage medium, Features: A computer program is stored on the medium, and after the computer program is run, the aluminum surface defect detection method as described in any one of claims 1 to 6 is executed.

8. A computer system, Features: It comprises a processor and a storage medium, wherein a computer program is stored on the storage medium, and the processor reads and runs the computer program from the storage medium to execute the aluminum surface defect detection method as described in any one of claims 1 to 6.