Metal surface recess identification method and system based on machine learning

By combining the image enhancement method with filtering and multi-angle light source fusion and integrating the BP subnet model, the problem of location and type identification in metal surface depression recognition is solved, the detection accuracy and data quality are improved, and the depression characteristic reaction caused by reflective characteristics is solved. Inadequacy problem.

CN118644735APending Publication Date: 2024-09-13CHINA CRIMINAL POLICE UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410876264.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Existing metal surface depression identification methods are difficult to identify the location and type of depressions at the same time, and because the reflective characteristics require multi-angle light source adaptation, a single light source strategy cannot effectively reflect the depression characteristics, resulting in a decrease in detection accuracy and precision.

Method used

An image enhancement method that combines filtering and multi-angle light source fusion is used, and an improved target detection model integrated with the BP subnet is used to detect, locate and classify metal surface depressions, using multi-scale feature fusion, residual structure and loss function optimization. Improve detection and classification accuracy.

Benefits of technology

It improves the automatic performance and data availability of metal surface depression identification, provides a high-quality data foundation, and improves the accuracy and reliability of detection and classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_4
    Figure FT_4
Patent Text Reader

Abstract

The invention discloses a metal surface recess recognition method and system based on machine learning. The method comprises the steps of data acquisition, basic preprocessing, metal surface recess image enhancement, improved recess detection and recognition and metal surface recess recognition. The invention relates to the technical field of recess recognition, in particular to a metal surface recess recognition method and system based on machine learning, according to the scheme, detection positioning and type classification of metal surface recesses are carried out, and the automatic performance and data availability of metal surface recess recognition are improved by detecting, positioning and marking the specific types of the recesses; by combining an image enhancement method of filtering and multi-angle light source fusion, the data quality of recess detection and identification is improved by fusing metal surface images of four different angles; an improved target detection model integrated with a BP subnet is adopted to carry out metal surface depression recognition, and model improvement is carried out by using multi-scale feature fusion, residual structure integration and loss function optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of dent recognition, and in particular to a method and system for metal surface dent recognition based on machine learning. Background Art

[0002] The machine learning-based metal surface dent recognition method and system uses computer vision and deep learning technology to automatically detect and identify dent defects on the metal surface. The system collects metal surface images and uses machine learning algorithms to extract and classify features to identify the location and extent of the dents. This method can replace manual inspection, improve inspection speed and accuracy, and reduce human errors. It is widely used in quality control and production line inspection to ensure the surface quality and consistency of products.

[0003] However, in the existing methods for identifying metal surface depressions, there is a problem that metal surface depression identification not only needs to identify the location of the depression, but also needs to detect the type of depression in actual production life, so as to provide more useful information for metal quality detection. The current technical solutions are mostly designed for the location of the depression, ignoring the technical problem of the classification of the depression type itself; in the existing methods for identifying metal surface depressions, there is a technical problem that due to the reflective characteristics of the metal surface, image enhancement and fusion adapted to different light source angles are required to effectively carry out subsequent processing, and a single light source or a simple enhancement strategy cannot effectively reflect the effective characteristics of the metal surface depression; in the existing methods for identifying metal surface depressions, there is a technical problem that the existing metal detection model has unsatisfactory performance when performing multi-classification of metal depressions, mainly because information loss is prone to occur after the multi-layer model is constructed, so that the fused image data cannot provide effective information in many aspects, thereby reducing the accuracy and precision of detection and classification. Summary of the invention

[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a method and system for identifying metal surface depressions based on machine learning. In the existing methods for identifying metal surface depressions, the identification of metal surface depressions requires not only the identification of the location of the depression, but also the detection of the type of depression in actual production life, so as to provide more useful information for metal quality detection. The current technical solutions are mostly designed for the location of the depression, ignoring the technical problem of the classification of the depression type itself. The present solution creatively performs detection, positioning and type classification of metal surface depressions, and improves the automatic performance and data availability of metal surface depression recognition by detecting, locating and marking the specific type of the depression. In the existing methods for identifying metal surface depressions, due to the reflective characteristics of the metal surface, image enhancement and fusion adapted to different light source angles are required to effectively carry out subsequent processing. A single light source or a simple enhancement strategy cannot effectively reflect the effectiveness of the metal surface depressions. In order to solve the technical problem of effective features, this scheme creatively adopts an image enhancement method combining filtering and multi-angle light source fusion. By fusing metal surface images at four different angles, the data quality of dent detection and recognition is improved, providing a high-quality data foundation for subsequent model training; in the existing metal surface dent recognition methods, there is a technical problem that the existing metal detection model has unsatisfactory performance in multi-classification of metal dents, mainly because information loss is prone to occur after the construction of the multi-layer model, which makes the fused image data unable to provide effective information in many aspects, thereby reducing the accuracy and precision of detection and classification. This scheme creatively adopts an improved target detection model integrating BP subnet for metal surface dent recognition, extracts features from the pre-trained model, and further uses multi-scale feature fusion, residual structure integration and loss function optimization to improve the model. In the final classification stage, the BP neural network is integrated to improve the reliability and accuracy of metal surface dent recognition.

[0005] The technical solution adopted by the present invention is as follows: The present invention provides a method for identifying metal surface depressions based on machine learning, the method comprising the following steps:

[0006] Step S1: data collection;

[0007] Step S2: basic preprocessing;

[0008] Step S3: metal surface depression image enhancement;

[0009] Step S4: improving dent detection and recognition;

[0010] Step S5: Identifying metal surface depressions.

[0011] Furthermore, in step S1, the data acquisition is used to acquire the original image data set required for metal surface depression recognition, specifically by online or offline acquisition, using a high-resolution industrial camera, obtaining metal surface images through data acquisition, and manually pre-marking the metal surface portraits with corresponding labels to obtain the original data set for metal surface depression recognition.

[0012] Further, in step S2, the basic preprocessing is used to filter and remove noise and enhance basic properties of the original image, specifically, normalizing the metal surface image in the metal surface depression recognition original data set to obtain an optimized metal surface image data set;

[0013] The normalization operation specifically refers to normalizing and standardizing the image brightness, contrast and image size of the metal surface image.

[0014] Further, in step S3, the metal surface concave image enhancement is used to enhance the concave visibility for the optimized image data, specifically by using median filtering for denoising, adjusting the image size by linear interpolation, separating and fusing the concave area and the background area of ​​the image, and obtaining the heterogeneous fusion enhanced metal concave image data, specifically comprising the following steps:

[0015] Step S31: image reduction, specifically using a linear interpolation algorithm to reduce the image in the optimized metal surface image data set to obtain reduced metal surface image data;

[0016] Step S32: image filtering, specifically using a median filtering algorithm to perform blur processing on the image in the reduced metal surface image data, eliminate surface depressions and obtain reduced approximate background image data;

[0017] Step S33: generating the original background, specifically, again using the linear interpolation algorithm to enlarge the reduced approximate background image data to obtain the original background image data, and the calculation formula is:

[0018] ;

[0019] In the formula, I B (i, j) is the original background image data, Scale(·, n) is the linear interpolation algorithm function, where n is the magnification, MB(·) is the median filter function, I(i, j) is the image data in the optimized metal surface image dataset, i is the image horizontal pixel index, and j is the image vertical pixel index;

[0020] Step S34: Background separation, specifically, performing pixel subtraction between the image data in the optimized metal surface image data set and the corresponding original background image data to obtain separated background metal depression grayscale data, and the calculation formula is:

[0021] ;

[0022] In the formula, I E (i, j) is the grayscale data of the metal depression separated from the background, 128 is the specific value of the image reference grayscale value, I(i, j) is the image data in the optimized metal surface image data set, I B (i, j) is the original background image data;

[0023] Step S35: image fusion enhancement, specifically, calculating the difference between the grayscale data of the metal depression separated from the background under different light source angles of the metal surface image, and performing grayscale fusion to obtain the heterogeneous fusion enhanced metal depression image data. The calculation formula is:

[0024] ;

[0025] In the formula, is the image pixel difference between the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees and the light source angle is 180 degrees. abs(·) is the absolute value function. It is the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 180 degrees. It is the image pixel difference between the grayscale data of the metal depression separated from the background collected at a light source angle of 90 degrees and a light source angle of 270 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 90 degrees. is the grayscale data of the metal depression separated from the background collected at a light source angle of 270 degrees. F (i, j) is the metal depression image data enhanced by heterogeneous fusion.

[0026] Further, in step S4, the improved dent detection and recognition is used to perform metal surface dent detection and recognition using an improved target detection model, specifically, based on the heterogeneous fusion enhanced metal dent image data, an improved target detection model combined with a BP classifier is used to perform dent detection and recognition to obtain metal surface dent data;

[0027] The improved target detection model combined with the BP classifier specifically includes a pre-training model layer, an improved target detection layer and a BP neural subnet layer;

[0028] The pre-trained model layer is used to extract high-level features of metal surface images;

[0029] The improved target detection layer is used to generate a candidate depression region and mark the detected depression position;

[0030] The BP neural subnet layer is used to refine the classification of the specific depression type to which the depression position belongs;

[0031] The step of using the improved target detection model combined with the BP classifier to perform dent detection and recognition to obtain metal surface dent data includes:

[0032] Step S41: pre-training a feature extraction model, specifically receiving the heterogeneous fusion enhanced metal depression image data as an original data input sample, and using the intervention trained ResNet50 model to extract image features to obtain image feature mapping data;

[0033] Step S42: constructing an improved target detection layer, specifically using the Yolov8n model as the basic target detection subnet, and using a method combining multi-scale feature fusion and residual modules to improve and optimize the target detection layer, and constructing the improved target detection layer, specifically including the following steps:

[0034] Step S421: constructing a basic target detection subnet, specifically using the Yolov8n model as the basic subnet for target detection, and performing initial marking of the concave bounding box by constructing the basic target detection subnet;

[0035] Step S422: construct a multi-scale feature fusion layer for fusing deep and shallow information, specifically performing multi-scale feature extraction and bottom-up feature fusion, including the following steps:

[0036] Step S4221: multi-scale feature extraction, specifically, extracting multi-scale feature map data from the basic target detection subnet, specifically including low-level features, mid-level features and high-level features;

[0037] Step S4222: bottom-up feature fusion, specifically, upsampling each high-level feature map in turn, then upsampling each mid-level feature map, and then performing feature fusion on the upsampled feature maps by adding principal elements to obtain multi-scale fused feature data;

[0038] Step S4223: adding detection heads, specifically adding detection heads to the low-level features, mid-level features and high-level features according to the multi-scale fusion feature data, to optimize the prediction effect of the basic target detection subnet;

[0039] Step S423: construct a residual module to reduce the information loss caused by the multi-layer model. Specifically, a residual module is introduced, and the feature map is output and integrated through residual module integration. The calculation formula is:

[0040] ;

[0041] In the formula, y s is the integrated output of the feature map after the residual module is introduced, s is the residual layer index, where when s takes the value of 1, it means that the initial feature without the residual is introduced, x s is the original feature map, K s (·) is the convolution operation function. When s is 2, the convolution operation is used to transform the original feature map. S is the total number of residual layers. It is the integrated output of the feature map of the previous residual layer;

[0042] Step S424: construct a loss function group, specifically, construct a dynamic programming detection loss function based on the traditional confidence loss, classification loss and coordinate loss, and construct an overall loss function. The calculation formula is:

[0043] ;

[0044] Where, L VE is a dynamic programming detection loss function, which is used to asymmetric weight positive and negative samples, where q is the predicted sample label and p is the true sample label. When q is positive, q is a positive label, which indicates that a metal concave area is detected. When q is negative, q is a negative label, which indicates that a metal concave area is not detected. At this time, p is set to 0. is the asymmetric weighting parameter, L ALL is the overall loss function, is the confidence loss weight, L OBJ is the confidence loss function, is the classification loss weight, L CLS is the classification loss function, is the coordinate loss weight, L LOC is the coordinate loss function, is the dynamic programming detection loss weight;

[0045] Step S425: improving the construction of the target detection layer, specifically, constructing the improved target detection layer by constructing the basic target detection subnet, constructing the multi-scale feature fusion layer, constructing the residual module and constructing the loss function group, specifically, improving the depth and shallow features by the multi-scale feature fusion layer, optimizing the information loss by the residual module, and finally reconstructing by the loss function group, optimizing the model training, and constructing the improved target detection layer;

[0046] Step S43: constructing a BP neural subnet layer, specifically by flattening the feature map, constructing a BP basic structure and constructing a BP classifier, constructing a BP neural subnet layer, and classifying the depression types;

[0047] Step S44: Model integration training, specifically, performing subnet integration through the feature extraction model pre-training, the construction of the improved target detection layer and the construction of the BP neural subnet layer, and performing model training based on the heterogeneous fusion enhanced metal concave image data to obtain the concave detection and recognition model Model ADR ;

[0048] Step S45: improving the sag detection and recognition, specifically using the sag detection and recognition model Model ADR , based on the metal surface depression recognition original data set, metal surface depression detection and recognition are performed to obtain metal surface depression data.

[0049] Further, in step S5, the metal surface depression recognition is used to detect the position of the metal surface depression and identify the type of the metal surface depression, specifically by obtaining the metal surface depression data, combining the metal surface depression recognition original data set, marking the metal surface depression position, and classifying and identifying the metal surface depression type by marking the metal surface depression position, so as to obtain the metal surface depression recognition reference data;

[0050] The metal surface depression recognition reference data specifically includes the depression mark position and the depression mark type.

[0051] The present invention provides a metal surface dent recognition system based on machine learning, comprising a data acquisition module, a basic preprocessing module, a metal surface dent image enhancement module, an improved dent detection and recognition module, and a metal surface dent recognition module;

[0052] The data acquisition module is used for data acquisition, and obtains a raw data set for metal surface depression recognition through data acquisition, and sends the raw data set for metal surface depression recognition to the basic preprocessing module and the metal surface depression recognition module;

[0053] The basic preprocessing module is used for basic preprocessing, and obtains an optimized metal surface image data set through basic preprocessing, and sends the optimized metal surface image data set to the metal surface depression image enhancement module;

[0054] The metal surface concave image enhancement module is used for metal surface concave image enhancement, obtains heterogeneous fusion enhanced metal concave image data through metal surface concave image enhancement, and sends the heterogeneous fusion enhanced metal concave image data to the improved concave detection and recognition module;

[0055] The improved dent detection and recognition module is used to improve dent detection and recognition, obtain metal surface dent data through improved dent detection and recognition, and send the metal surface dent data to the metal surface dent recognition module;

[0056] The metal surface depression recognition module is used for metal surface depression recognition, and obtains metal surface depression recognition reference data through metal surface depression recognition.

[0057] The beneficial effects achieved by the present invention using the above scheme are as follows:

[0058] (1) In the existing methods for identifying metal surface dents, the identification of metal surface dents requires not only identifying the location of the dents, but also detecting the type of the dents in actual production life, so as to provide more useful information for metal quality detection. The current technical solutions are mostly designed for locating the dents, ignoring the technical problem of the classification of the dent types themselves. This solution creatively detects and locates the dents on the metal surface and classifies their types. By detecting and locating and marking the specific types of the dents, the automatic performance and data availability of metal surface dent identification are improved.

[0059] (2) In the existing methods for identifying metal surface depressions, there is a technical problem that due to the reflective characteristics of the metal surface, image enhancement and fusion must be performed for different light source angles in order to effectively carry out subsequent processing. A single light source or simple enhancement strategy cannot effectively reflect the effective characteristics of metal surface depressions. This solution creatively adopts an image enhancement method that combines filtering and multi-angle light source fusion. By fusing metal surface images at four different angles, the data quality of depression detection and identification is improved, providing a high-quality data foundation for subsequent model training.

[0060] (3) In the existing methods for identifying metal surface dents, there is a technical problem that the existing metal detection models have unsatisfactory performance when performing multi-classification of metal dents. The main reason is that information loss is prone to occur after the construction of the multi-layer model, which makes the fused image data unable to provide effective information in many aspects, thereby reducing the accuracy and precision of detection and classification. This scheme creatively adopts an improved target detection model integrating BP subnet for metal surface dent identification. By extracting features from the pre-trained model and further using multi-scale feature fusion, residual structure integration and loss function optimization to improve the model, the BP neural network is integrated in the final classification stage to improve the reliability and accuracy of metal surface dent identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 A schematic diagram of a process flow of a metal surface depression recognition method based on machine learning provided by the present invention;

[0062] Figure 2 A schematic diagram of a metal surface depression recognition system based on machine learning provided by the present invention;

[0063] Figure 3 It is a schematic diagram of the process of enhancing the metal surface depression image in step S3;

[0064] Figure 4 A schematic diagram of the process of improving the dent detection and recognition in step S4;

[0065] Figure 5 A schematic diagram of a process for constructing an improved target detection layer for step S42.

[0066] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION

[0067] The technical solutions 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 only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0068] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.

[0069] Example 1, see Figure 1 The present invention provides a method for identifying metal surface depressions based on machine learning, the method comprising the following steps:

[0070] Step S1: data collection;

[0071] Step S2: basic preprocessing;

[0072] Step S3: metal surface depression image enhancement;

[0073] Step S4: improving dent detection and recognition;

[0074] Step S5: Identifying metal surface depressions.

[0075] By performing the above operations, in the existing metal surface dent recognition methods, the metal surface dent recognition needs to identify the location of the dent, and in actual production life, it is also necessary to detect the type of the dent, so as to provide more useful information for metal quality detection. The current technical solutions are mostly designed for locating the dent position, ignoring the technical problem of the classification of the dent type itself. The present solution creatively performs detection, positioning and type classification of metal surface dents, and improves the automatic performance and data availability of metal surface dent recognition by detecting, locating and marking the specific type of the dent.

[0076] Example 2, see Figure 1 and Figure 2 In step S1, the data acquisition is used to acquire the original image data set required for metal surface depression recognition, specifically, by online or offline acquisition, using a high-resolution industrial camera, obtaining a metal surface image through data acquisition, and manually pre-marking the metal surface head image with a corresponding label to obtain a metal surface depression recognition original data set;

[0077] The metal surface image includes an image without depression and an image with depression;

[0078] The metal surface image is captured by photographing at different light source angles, and the angles between the light source and the metal surface specifically include 0°, 90°, 180° and 270°.

[0079] The label markings include marks without depressions, marks with depressions, and marks in depression areas;

[0080] The depressions specifically include scratch-type depressions, pit-type depressions, indentation-type depressions, dent-type depressions, wear-type depressions and crack-type depressions.

[0081] Example 3, see Figure 1 and Figure 2 , this embodiment is based on the above embodiment, in step S2, the basic preprocessing is used to filter and denoise the original image and enhance the basic attributes, specifically, normalizing the metal surface image in the metal surface depression recognition original data set to obtain an optimized metal surface image data set;

[0082] The normalization operation specifically refers to normalizing and standardizing the image brightness, contrast and image size of the metal surface image.

[0083] Example 4, see Figure 1 , Figure 2 and Figure 3This embodiment is based on the above embodiment. In step S3, the metal surface concave image enhancement is used to enhance the visibility of the concave for the optimized image data. Specifically, median filtering is used for denoising, and the image size is adjusted by linear interpolation to separate and fuse the concave area and the background area of ​​the image to obtain the heterogeneous fusion enhanced metal concave image data. Specifically, the following steps are included:

[0084] Step S31: image reduction, specifically using a linear interpolation algorithm to reduce the image in the optimized metal surface image data set to obtain reduced metal surface image data;

[0085] Step S32: image filtering, specifically using a median filtering algorithm to perform blur processing on the image in the reduced metal surface image data, eliminate surface depressions and obtain reduced approximate background image data;

[0086] Step S33: generating the original background, specifically, again using the linear interpolation algorithm to enlarge the reduced approximate background image data to obtain the original background image data, and the calculation formula is:

[0087] ;

[0088] In the formula, I B (i, j) is the original background image data, Scale(·, n) is the linear interpolation algorithm function, where n is the magnification, MB(·) is the median filter function, I(i, j) is the image data in the optimized metal surface image dataset, i is the image horizontal pixel index, and j is the image vertical pixel index;

[0089] Step S34: Background separation, specifically, performing pixel subtraction between the image data in the optimized metal surface image data set and the corresponding original background image data to obtain separated background metal depression grayscale data, and the calculation formula is:

[0090] ;

[0091] In the formula, I E (i, j) is the grayscale data of the metal depression separated from the background, 128 is the specific value of the image reference grayscale value, I(i, j) is the image data in the optimized metal surface image data set, I B (i, j) is the original background image data;

[0092] Step S35: image fusion enhancement, specifically, calculating the difference between the grayscale data of the metal depression separated from the background under different light source angles of the metal surface image, and performing grayscale fusion to obtain the heterogeneous fusion enhanced metal depression image data. The calculation formula is:

[0093] ;

[0094] In the formula, is the image pixel difference between the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees and the light source angle is 180 degrees. abs(·) is the absolute value function. It is the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 180 degrees. It is the image pixel difference between the grayscale data of the metal depression separated from the background collected at a light source angle of 90 degrees and a light source angle of 270 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 90 degrees. is the grayscale data of the metal depression separated from the background collected at a light source angle of 270 degrees. F (i, j) is the metal depression image data enhanced by heterogeneous fusion.

[0095] By performing the above operations, in order to effectively carry out subsequent processing, the existing metal surface dent recognition methods have the problem that due to the reflective characteristics of the metal surface, image enhancement and fusion adapted to different light source angles are required, and a single light source or simple enhancement strategy cannot effectively reflect the effective characteristics of the metal surface dents. This solution creatively adopts an image enhancement method that combines filtering and multi-angle light source fusion. By fusing metal surface images at four different angles, the data quality of dent detection and recognition is improved, providing a high-quality data foundation for subsequent model training.

[0096] Example 5, see Figure 1 , Figure 2 , Figure 4 and Figure 5 This embodiment is based on the above embodiment. In step S4, the improved dent detection and recognition is used to detect metal surface dents using an improved target detection model and perform dent recognition. Specifically, based on the heterogeneous fusion enhanced metal dent image data, an improved target detection model combined with a BP classifier is used to perform dent detection and recognition to obtain metal surface dent data.

[0097] The improved target detection model combined with the BP classifier specifically includes a pre-training model layer, an improved target detection layer and a BP neural subnet layer;

[0098] The pre-trained model layer is used to extract high-level features of metal surface images;

[0099] The improved target detection layer is used to generate a candidate depression region and mark the detected depression position;

[0100] The BP neural subnet layer is used to refine the classification of the specific depression type to which the depression position belongs;

[0101] The step of using the improved target detection model combined with the BP classifier to perform dent detection and recognition to obtain metal surface dent data includes:

[0102] Step S41: pre-training a feature extraction model, specifically receiving the heterogeneous fusion enhanced metal depression image data as an original data input sample, and using the intervention trained ResNet50 model to extract image features to obtain image feature mapping data;

[0103] The image feature mapping data includes image edge, texture and shape feature information;

[0104] Step S42: constructing an improved target detection layer, specifically using the Yolov8n model as the basic target detection subnet, and using a method combining multi-scale feature fusion and residual modules to improve and optimize the target detection layer, and constructing the improved target detection layer, specifically including the following steps:

[0105] Step S421: constructing a basic target detection subnet, specifically using the Yolov8n model as the basic subnet for target detection, and performing initial marking of the concave bounding box by constructing the basic target detection subnet;

[0106] Step S422: construct a multi-scale feature fusion layer for fusing deep and shallow information, specifically performing multi-scale feature extraction and bottom-up feature fusion, including the following steps:

[0107] Step S4221: multi-scale feature extraction, specifically, extracting multi-scale feature map data from the basic target detection subnet, specifically including low-level features, mid-level features and high-level features;

[0108] Step S4222: bottom-up feature fusion, specifically, upsampling each high-level feature map in turn, then upsampling each mid-level feature map, and then performing feature fusion on the upsampled feature maps by adding principal elements to obtain multi-scale fused feature data;

[0109] Step S4223: adding detection heads, specifically adding detection heads to the low-level features, mid-level features and high-level features according to the multi-scale fusion feature data, to optimize the prediction effect of the basic target detection subnet;

[0110] Step S423: construct a residual module to reduce the information loss caused by the multi-layer model. Specifically, a residual module is introduced, and the feature map is output and integrated through residual module integration. The calculation formula is:

[0111] ;

[0112] In the formula, y s is the integrated output of the feature map after the residual module is introduced, s is the residual layer index, where when s takes the value of 1, it means that the initial feature without the residual is introduced, x s is the original feature map, K s (·) is the convolution operation function. When s is 2, the convolution operation is used to transform the original feature map. S is the total number of residual layers. It is the integrated output of the feature map of the previous residual layer;

[0113] The residual module is specifically integrated by using a CSPLayer module, a Res2Attention module and a Bottleneck module;

[0114] Step S424: construct a loss function group, specifically, construct a dynamic programming detection loss function based on the traditional confidence loss, classification loss and coordinate loss, and construct an overall loss function. The calculation formula is:

[0115] ;

[0116] Where, L VE is a dynamic programming detection loss function, which is used to asymmetric weight positive and negative samples, where q is the predicted sample label and p is the true sample label. When q is positive, q is a positive label, which indicates that a metal concave area is detected. When q is negative, q is a negative label, which indicates that a metal concave area is not detected. At this time, p is set to 0. is the asymmetric weighting parameter, L ALL is the overall loss function, is the confidence loss weight, L OBJ is the confidence loss function, is the classification loss weight, L CLS is the classification loss function, is the coordinate loss weight, L LOC is the coordinate loss function, is the dynamic programming detection loss weight;

[0117] Step S425: improving the construction of the target detection layer, specifically, constructing the improved target detection layer by constructing the basic target detection subnet, constructing the multi-scale feature fusion layer, constructing the residual module and constructing the loss function group, specifically, improving the depth and shallow features by the multi-scale feature fusion layer, optimizing the information loss by the residual module, and finally reconstructing by the loss function group, optimizing the model training, and constructing the improved target detection layer;

[0118] Step S43: constructing a BP neural subnet layer, specifically by flattening the feature map, constructing a BP basic structure and constructing a BP classifier, constructing a BP neural subnet layer, and classifying the depression types, specifically including the following steps:

[0119] Step S431: flattening the feature map, specifically flattening the output features of the improved target detection layer into a one-dimensional vector to obtain one-dimensional feature data;

[0120] Step S432: constructing a BP basic structure for extracting high-level features, specifically constructing a hidden layer, and using linear transformation and nonlinear activation function to extract high-level feature data from the one-dimensional feature data;

[0121] Step S433: constructing a BP classifier, specifically using a Softmax classifier for classification, and constructing an output layer to output classification categories;

[0122] Step S44: Model integration training, specifically, performing subnet integration through the feature extraction model pre-training, the construction of the improved target detection layer and the construction of the BP neural subnet layer, and performing model training based on the heterogeneous fusion enhanced metal concave image data to obtain the concave detection and recognition model Model ADR ;

[0123] Step S45: improving the sag detection and recognition, specifically using the sag detection and recognition model Model ADR , based on the metal surface depression recognition original data set, metal surface depression detection and recognition are performed to obtain metal surface depression data.

[0124] By performing the above operations, in view of the fact that in the existing metal surface dent recognition methods, the existing metal detection model has unsatisfactory performance when performing metal dent multi-classification, mainly because information loss is prone to occur after the multi-layer model is constructed, so that the fused image data cannot provide effective information in many aspects, thereby reducing the accuracy and precision of detection and classification. This solution creatively adopts an improved target detection model integrating BP subnet for metal surface dent recognition, extracts features from the pre-trained model, and further uses multi-scale feature fusion, residual structure integration and loss function optimization to improve the model, and integrates BP neural network in the final classification stage, thereby improving the reliability and accuracy of metal surface dent recognition.

[0125] Example 6, see Figure 1 and Figure 2This embodiment is based on the above embodiment. In step S5, the metal surface depression recognition is used to detect the position of the metal surface depression and identify the type of the metal surface depression. Specifically, the metal surface depression position is marked by combining the metal surface depression recognition original data set with the metal surface depression recognition data, and the metal surface depression type is classified and identified by marking the metal surface depression position to obtain the metal surface depression recognition reference data.

[0126] The metal surface depression recognition reference data specifically includes the depression mark position and the depression mark type.

[0127] Embodiment 7, see Figure 1 and Figure 2 , this embodiment is based on the above embodiment, and the present invention provides a metal surface dent recognition system based on machine learning, including a data acquisition module, a basic preprocessing module, a metal surface dent image enhancement module, an improved dent detection and recognition module and a metal surface dent recognition module;

[0128] The data acquisition module is used for data acquisition, and obtains a raw data set for metal surface depression recognition through data acquisition, and sends the raw data set for metal surface depression recognition to the basic preprocessing module and the metal surface depression recognition module;

[0129] The basic preprocessing module is used for basic preprocessing, and obtains an optimized metal surface image data set through basic preprocessing, and sends the optimized metal surface image data set to the metal surface depression image enhancement module;

[0130] The metal surface concave image enhancement module is used for metal surface concave image enhancement, obtains heterogeneous fusion enhanced metal concave image data through metal surface concave image enhancement, and sends the heterogeneous fusion enhanced metal concave image data to the improved concave detection and recognition module;

[0131] The improved dent detection and recognition module is used to improve dent detection and recognition, obtain metal surface dent data through improved dent detection and recognition, and send the metal surface dent data to the metal surface dent recognition module;

[0132] The metal surface depression recognition module is used for metal surface depression recognition, and obtains metal surface depression recognition reference data through metal surface depression recognition.

[0133] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0134] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.

[0135] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.

Claims

1. A method for identifying metal surface depressions based on machine learning, characterized in that: The method comprises the following steps: Step S1: data collection, obtaining the original data set for metal surface depression recognition; Step S2: basic preprocessing to obtain an optimized metal surface image data set; Step S3: metal surface concave image enhancement, specifically using median filtering to remove noise, and adjusting the image size by linear interpolation, separating and fusing the concave area and the background area of ​​the image, and obtaining heterogeneous fusion enhanced metal concave image data, specifically including the following steps: Step S31: image reduction; Step S32: image filtering; Step S33: original background generation; Step S34: background separation; Step S35: image fusion enhancement; Step S4: improving dent detection and recognition, for using an improved target detection model to perform metal surface dent detection and dent recognition, specifically, based on the heterogeneous fusion enhanced metal dent image data, using an improved target detection model combined with a BP classifier to perform dent detection and recognition, to obtain metal surface dent data, specifically including the following steps: Step S41: feature extraction model pre-training; Step S42: constructing an improved target detection layer; Step S43: constructing a BP neural subnet layer; Step S44: model integration training; Step S45: improving sag detection and recognition; In step S42, the construction of the improved target detection layer specifically includes the following steps: step S421: constructing a basic target detection subnet; step S422: constructing a multi-scale feature fusion layer; step S423: constructing a residual module; step S424: constructing a loss function group, specifically, constructing a dynamic programming detection loss function based on traditional confidence loss, classification loss and coordinate loss, and constructing an overall loss function; step S425: improving target detection layer construction; Step S5: Identify metal surface depressions and obtain metal surface depression identification reference data.

2. The method for identifying metal surface depressions based on machine learning according to claim 1, characterized in that: In step S1, the data acquisition is used to acquire the original image data set required for metal surface depression recognition, specifically by online or offline acquisition, using a high-resolution industrial camera, obtaining metal surface images through data acquisition, and manually pre-marking the metal surface portrait with corresponding labels to obtain the original data set for metal surface depression recognition.

3. The method for identifying metal surface depressions based on machine learning according to claim 2, characterized in that: In step S31, the image is reduced, specifically, a linear interpolation algorithm is used to reduce the image in the optimized metal surface image data set to obtain reduced metal surface image data; In step S32, the image filtering is specifically to use a median filtering algorithm to perform blur processing on the image in the reduced metal surface image data, eliminate surface depressions and obtain reduced approximate background image data; In step S33, the original background is generated by again using the linear interpolation algorithm to enlarge the reduced approximate background image data to obtain the original background image data. The calculation formula is: ; In the formula, I B (i, j) is the original background image data, Scale(·, n) is the linear interpolation algorithm function, where n is the magnification, MB(·) is the median filter function, I(i, j) is the image data in the optimized metal surface image dataset, i is the image horizontal pixel index, and j is the image vertical pixel index; In step S34, the background separation is specifically to perform pixel subtraction between the image data in the optimized metal surface image data set and the corresponding original background image data to obtain the separated background metal depression grayscale data, and the calculation formula is: ; In the formula, I E (i, j) is the grayscale data of the metal depression separated from the background, 128 is the specific value of the image reference grayscale value, I(i, j) is the image data in the optimized metal surface image data set, I B (i, j) is the original background image data; In step S35, the image fusion enhancement is specifically to calculate the difference between the grayscale data of the metal depression separated from the background under different light source angles of the metal surface image, and perform grayscale fusion to obtain the heterogeneous fusion enhanced metal depression image data. The calculation formula is: ; In the formula, is the image pixel difference between the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees and the light source angle is 180 degrees. abs(·) is the absolute value function. It is the grayscale data of the metal depression separated from the background collected when the light source angle is 0 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 180 degrees. It is the image pixel difference between the grayscale data of the metal depression separated from the background collected at a light source angle of 90 degrees and a light source angle of 270 degrees. It is the grayscale data of metal depression separated from the background collected at a light source angle of 90 degrees. is the grayscale data of the metal depression separated from the background collected at a light source angle of 270 degrees. F (i, j) is the metal depression image data enhanced by heterogeneous fusion.

4. The method for identifying metal surface depressions based on machine learning according to claim 3, characterized in that: In step S4, the improved dent detection and recognition is used to perform metal surface dent detection and recognition using an improved target detection model, specifically, based on the heterogeneous fusion enhanced metal dent image data, an improved target detection model combined with a BP classifier is used to perform dent detection and recognition to obtain metal surface dent data; The improved target detection model combined with the BP classifier specifically includes a pre-training model layer, an improved target detection layer and a BP neural subnet layer; The pre-trained model layer is used to extract high-level features of metal surface images; The improved target detection layer is used to generate a candidate depression region and mark the detected depression position; The BP neural subnet layer is used to refine the classification of the specific depression type to which the depression position belongs.

5. The method for identifying metal surface depressions based on machine learning according to claim 4, characterized in that: In step S4, the step of using the improved target detection model combined with the BP classifier to perform dent detection and recognition to obtain metal surface dent data includes: Step S41: pre-training a feature extraction model, specifically receiving the heterogeneous fusion enhanced metal depression image data as an original data input sample, and using the intervention trained ResNet50 model to extract image features to obtain image feature mapping data; Step S42: constructing an improved target detection layer, specifically using the Yolov8n model as the basic target detection subnet, and using a method combining multi-scale feature fusion and residual modules to improve and optimize the target detection layer, so as to construct the improved target detection layer; Step S43: constructing a BP neural subnet layer, specifically by flattening the feature map, constructing a BP basic structure and constructing a BP classifier, constructing a BP neural subnet layer, and classifying the depression types; Step S44: Model integration training, specifically, performing subnet integration through the feature extraction model pre-training, the construction of the improved target detection layer and the construction of the BP neural subnet layer, and performing model training based on the heterogeneous fusion enhanced metal concave image data to obtain the concave detection and recognition model Model ADR ; Step S45: improving the sag detection and recognition, specifically using the sag detection and recognition model Model ADR , based on the metal surface depression recognition original data set, metal surface depression detection and recognition are performed to obtain metal surface depression data.

6. The method for identifying metal surface depressions based on machine learning according to claim 5, characterized in that: In step S42, the construction of the improved target detection layer specifically includes the following steps: Step S421: constructing a basic target detection subnet, specifically using the Yolov8n model as the basic subnet for target detection, and performing initial marking of the concave bounding box by constructing the basic target detection subnet; Step S422: construct a multi-scale feature fusion layer for fusing deep and shallow information, specifically performing multi-scale feature extraction and bottom-up feature fusion; Step S423: construct a residual module to reduce the information loss caused by the multi-layer model. Specifically, a residual module is introduced, and the feature map is output and integrated through residual module integration. The calculation formula is: ; In the formula, y s is the integrated output of the feature map after the residual module is introduced, s is the residual layer index, where when s takes the value of 1, it means that the initial feature without the residual is introduced, x s is the original feature map, K s (·) is the convolution operation function. When s is 2, the convolution operation is used to transform the original feature map. S is the total number of residual layers. It is the integrated output of the feature map of the previous residual layer; Step S424: construct a loss function group, specifically, construct a dynamic programming detection loss function based on the traditional confidence loss, classification loss and coordinate loss, and construct an overall loss function. The calculation formula is: ; Where, L VE is a dynamic programming detection loss function, which is used to asymmetric weight positive and negative samples, where q is the predicted sample label and p is the true sample label. When q is positive, q is a positive label, which indicates that a metal concave area is detected. When q is negative, q is a negative label, which indicates that a metal concave area is not detected. At this time, p is set to 0. is the asymmetric weighting parameter, L ALL is the overall loss function, is the confidence loss weight, L OBJ is the confidence loss function, is the classification loss weight, L CLS is the classification loss function, is the coordinate loss weight, L LOC is the coordinate loss function, is the dynamic programming detection loss weight; Step S425: improving the construction of the target detection layer, specifically, constructing the improved target detection layer by constructing the basic target detection subnet, constructing the multi-scale feature fusion layer, constructing the residual module and constructing the loss function group, specifically, improving the deep and shallow features through the multi-scale feature fusion layer, optimizing the information loss through the residual module, and finally reconstructing through the loss function group, optimizing the model training, and constructing the improved target detection layer.

7. The method for identifying metal surface depressions based on machine learning according to claim 6, characterized in that: In step S5, the metal surface depression recognition is used to detect the position of the metal surface depression and identify the type of the metal surface depression, specifically by obtaining the metal surface depression data, combining the metal surface depression recognition original data set, marking the metal surface depression position, and classifying and identifying the metal surface depression type by marking the metal surface depression position, so as to obtain the metal surface depression recognition reference data; The metal surface depression recognition reference data specifically includes the depression mark position and the depression mark type.

8. A metal surface dent recognition system based on machine learning, used to implement a metal surface dent recognition method based on machine learning as described in any one of claims 1 to 7, characterized in that: It includes a data acquisition module, a basic preprocessing module, a metal surface dent image enhancement module, an improved dent detection and recognition module and a metal surface dent recognition module.

9. The metal surface depression recognition system based on machine learning according to claim 8, characterized in that: The data acquisition module is used for data acquisition, and obtains a raw data set for metal surface depression recognition through data acquisition, and sends the raw data set for metal surface depression recognition to the basic preprocessing module and the metal surface depression recognition module; The basic preprocessing module is used for basic preprocessing, and obtains an optimized metal surface image data set through basic preprocessing, and sends the optimized metal surface image data set to the metal surface depression image enhancement module; The metal surface concave image enhancement module is used for metal surface concave image enhancement, obtains heterogeneous fusion enhanced metal concave image data through metal surface concave image enhancement, and sends the heterogeneous fusion enhanced metal concave image data to the improved concave detection and recognition module; The improved dent detection and recognition module is used to improve dent detection and recognition, obtain metal surface dent data through improved dent detection and recognition, and send the metal surface dent data to the metal surface dent recognition module; The metal surface depression recognition module is used for metal surface depression recognition, and obtains metal surface depression recognition reference data through metal surface depression recognition.

Citation Information

Cited By

  • Metal bonding interface interlocking texture laser etching manufacturing method based on machine vision

    CN119794586A