CN-122024235-A - Stamping part defect automatic detection method and system based on visual identification
Abstract
The invention discloses a stamping part defect automatic detection method and system based on visual identification, which relates to the technical field of machine vision and industrial automatic detection, the invention decouples a detection flow into two stages of special and cascade functions of rapid abnormal region proposal and fine attention segmentation, an abnormal region proposal network adopts a lightweight design to execute high-speed and low-calculation cost scanning of a whole graph, generates an abnormal thermodynamic diagram to locate all potential defect regions, namely proposal regions, the computational redundancy and omission of small targets caused by global fine processing are effectively avoided, the fine attention segmentation network takes the proposal area which is output by the abnormal area proposal network and has limited range as accurate input, high-precision pixel-level segmentation and classification are carried out in the local area, and the computational resources and modeling capacity of the network are completely concentrated on the suspicious area and the boundary thereof, so that the problem of confusion at the junction of defects, complex background and structures can be solved.
Inventors
- LIU XIAOHUAN
- ZHANG GANGQIANG
- WANG DA
- XU ZEWEN
- MEI BIZHOU
- ZHANG ZHAOHUA
- XUE DONGDONG
- Hua Honghu
- QUAN MENG
- ZHOU XUANRU
- GUO XINJIE
- NING SHUPENG
- CAI WENZHONG
Assignees
- 浙江易锻精密机械有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251218
Claims (9)
- 1. The stamping part defect automatic detection method based on visual identification is characterized by comprising the following specific steps of: S100, acquiring a surface image of a stamping part to be detected through image acquisition equipment, and preprocessing the surface image to obtain a preprocessed image to be detected; S200, inputting the preprocessed image to be detected into a pre-trained multi-stage cascade attention deficit positioning and segmentation network, wherein the multi-stage cascade attention deficit positioning and segmentation network sequentially executes an abnormal region proposal stage and a fine attention segmentation stage; S300, in the rapid abnormal region proposal stage, scanning the image to be detected by an abnormal region proposal network in the multistage cascade attention defect positioning and segmentation network, generating an abnormal thermodynamic diagram covering a full graph, and extracting a plurality of rectangular proposal regions containing abnormal defects from the abnormal thermodynamic diagram; S400, in the fine attention segmentation stage, processing original image blocks corresponding to each rectangular proposed area by a fine attention segmentation network in the multi-stage cascade attention defect positioning and segmentation network respectively, wherein the fine attention segmentation network is integrated with a space and channel dual attention mechanism so as to focus on a defect area and a boundary thereof, and outputting a pixel-level defect segmentation mask and a defect category corresponding to each rectangular proposed area; S500, mapping the corresponding pixel-level defect segmentation mask back to the original coordinate system of the image to be detected according to the position information of all the rectangular proposal areas, and performing post-processing and fusion to generate a structural detection result containing defect contour, category and size information.
- 2. The method for automatically detecting defects of stamping parts based on visual recognition according to claim 1, wherein in S200, the multi-stage cascade attention defect localization and segmentation network is coupled in a cascade manner; The output end of the abnormal region proposal network is connected to the input end of the fine attention segmentation network; the abnormal region proposal network is configured to perform high recall potential defect region localization, and the rectangular proposal region output by the abnormal region proposal network is used as a concerned region and a processing object of the fine attention segmentation network; The refined attention splitting network is configured for high precision pixel level splitting and classification within the rectangular proposed area for verification and refinement of the abnormal area proposed network results.
- 3. The method for automatically detecting defects in stamping parts based on visual recognition according to claim 2, wherein the abnormal region proposal network is a lightweight convolutional neural network based on an encoder-decoder structure, the training of the abnormal region proposal network is to make network learning generate the abnormal thermodynamic diagram positively related to the existence probability of defects by using training data marked with rough boundary boxes, the value of each pixel point in the abnormal thermodynamic diagram represents the probability of surface abnormality at the position, and the coordinates of the rectangular proposal region are determined by thresholding the abnormal thermodynamic diagram and conducting connected domain analysis.
- 4. The method for automatically detecting a defect in a stamping part based on visual identification according to claim 1, wherein the fine attention splitting network is an encoder-decoder structure integrated with an attention module, and the spatial and channel dual attention mechanism comprises a spatial attention module and a channel attention module; the spatial attention module is configured to generate a weight distribution map in a spatial dimension for an input feature map for enhancing a feature response of a spatial location associated with the defect and suppressing a response of an unrelated background area; The channel attention module is configured to generate a weight vector in a channel dimension for an input feature map for enhancing a response of a feature channel most sensitive to a defect type within the rectangular proposed area.
- 5. The automatic detection method for stamping part defects based on visual identification according to claim 4, wherein the working process of the spatial attention module is integrated in the forward propagation process of the refined attention splitting network, and the specific steps are as follows: feature map for input Wherein In order to provide the number of channels, And Respectively carrying out global maximization pooling and global average pooling on the channel dimension to obtain two spatial feature description graphs And ; Will be And Splicing in the channel dimension, and generating a space attention weight graph through a convolution layer and a Sigmoid activation function The spatial attention weighting map Each element of (3) Representing the spatial position of a feature map Importance weights of (2); mapping the spatial attention weighting map With the original input feature map Multiplying element by element to obtain a characteristic diagram weighted by spatial attention , wherein, Representing element-by-element multiplication, through a broadcast mechanism, Copying in the channel dimension to match Is a number of channels.
- 6. The automatic detection method of stamping part defects based on visual identification according to claim 4, wherein the working process of the channel attention module is integrated in the forward propagation process of the fine attention splitting network, and the specific steps are as follows: feature map for input In the spatial dimension Global averaging pooling is performed on the channel descriptor vector to obtain a channel descriptor vector Wherein the vector is Is the first of (2) Individual elements , Represent the first The channels are located at positions Is a characteristic value of (2); Vector the channel descriptor The nonlinear dependency relationship between channels is learned through a structure comprising two full-connection layers and nonlinear activation functions, and the channel attention weight vector is generated through the Sigmoid activation function The channel attention weight vector Each element of (3) Represent the first Importance weights of the individual feature channels; the channel attention weight vector With the original input feature map Multiplying channel by channel to obtain a weighted feature map of channel attention , wherein, Representing channel-by-channel multiplication along a channel dimension, i.e. 。
- 7. The visual identification based stamping part defect automatic detection method as claimed in claim 4, wherein the spatial attention module and the channel attention module are integrated in sequence and in parallel in a decoder path of the fine attention splitting network; When the feature images are sequentially integrated, the feature images are weighted by the spatial attention module and then input to the attention module; when parallel integration is carried out, the feature images are respectively and independently processed by the space attention module and the channel attention module, and the obtained two weighted feature images are fused in a mode of element-by-element addition and splicing.
- 8. The method for automatically detecting defects in a stamping part based on visual recognition according to claim 1, wherein in S400, a network loss function of each rectangular proposal area is processed by a refined attention dividing network Lost by segmentation And classification loss Weighted composition: wherein And To balance the weight coefficients of the two losses, the segmentation loss Employing a combination of a Dice penalty and a cross entropy penalty for optimizing the accuracy of the pixel-level defect segmentation mask, the classification penalty And cross entropy loss is adopted for optimizing the prediction accuracy of the defect class.
- 9. The stamping part defect automatic detection system based on visual identification is applicable to the stamping part defect automatic detection method based on visual identification as claimed in any one of claims 1 to 8, and is characterized in that the system comprises an image acquisition and preprocessing module, a rapid abnormal region proposal module, a refined attention segmentation module, a result generation module and a storage and communication module; The image acquisition and preprocessing module acquires a surface image of the stamping part to be detected through image acquisition equipment, and preprocesses the surface image to obtain a preprocessed image to be detected; the rapid abnormal region proposal module comprises the abnormal region proposal network and is used for rapidly scanning the preprocessed image and generating a rectangular proposal region; The fine attention segmentation module comprises the fine attention segmentation network and the space and channel dual attention mechanism and is used for finely segmenting and classifying each rectangular proposal area; The result generation module is used for mapping and post-processing the segmentation result and generating a structured detection report; the storage and communication module is used for storing parameters of the multistage cascade attention defect positioning and dividing network, intermediate data in the processing process and final detection results, and providing a data communication interface with external equipment.
Description
Stamping part defect automatic detection method and system based on visual identification Technical Field The invention relates to the technical field of machine vision and industrial automatic detection, in particular to a stamping part defect automatic detection method and system based on visual identification. Background In the field of industrial manufacture, stamping parts are used as basic components, and the surface quality of the stamping parts directly influences the performance and the appearance of the final product. The traditional manual visual detection method has low efficiency, strong subjectivity and easy fatigue, can not meet the high-speed and high-precision requirements of modern production lines, and along with the development of deep learning, the automatic visual detection technology based on the convolutional neural network CNN has become a research hotspot. However, the application of the existing generic object detection or segmentation network directly to stamping part defect detection faces the following serious challenges: The size range of the defects to be detected is extremely wide, and the defects from micro-scale micro scratches, pits to centimeter-scale large-area cracks and wrinkles exist in the same workpiece, so that the network of single-scale receptive fields is difficult to simultaneously and effectively capture the very small, weak, very large and obvious defect characteristics, and the defects are missed or false detected. The background interference is strong, the surface of the stamping part often has complex textures, light reflection and structural traces left by the die, defects are often mixed with the complex backgrounds or structural junctions, so that the network is difficult to separate the defects from the normal backgrounds, the positioning boundary is fuzzy, and the segmentation precision is low. The detection speed and the precision are balanced, the network for realizing pixel-level fine segmentation is complex in calculation, the throughput requirement of online real-time detection is difficult to meet, and the lightweight network for pursuing the speed is poor in detection precision under a complex scene, especially in the treatment of small defects and boundary definition. Therefore, there is an urgent need for an automatic detection method for defects of special stamping parts, which can adapt to multi-scale defects, inhibit complex background interference, and achieve both detection speed and accuracy. Disclosure of Invention The invention aims to make up the defects of the prior art, and provides a stamping part defect automatic detection method and system based on visual identification, which can decouple a detection flow into two stages of special and cascade functions of fast abnormal region proposal and refined attention segmentation, wherein an abnormal region proposal network adopts a lightweight design to execute scanning on a whole image at high speed and low calculation cost, generates an abnormal thermodynamic diagram to locate all potential defect regions, namely proposal regions, effectively avoids calculation redundancy brought by global fine processing and omission of small targets, the refined attention segmentation network takes the proposal regions which are output by the abnormal region proposal network and have limited range as accurate input, and high-precision pixel-level segmentation and classification are carried out in the local region, so that the computing resources and modeling capacity of the network are fully concentrated on suspicious regions and boundaries thereof, and the problem of confusion of defects and complex backgrounds and structure boundaries can be solved, and the system can maintain the whole processing speed and separate and accurately describe the contours of the defects under the complex backgrounds when processing high-resolution images. The invention provides a stamping part defect automatic detection method based on visual identification, which comprises the following specific steps of: S100, acquiring a surface image of a stamping part to be detected through image acquisition equipment, and preprocessing the surface image to obtain a preprocessed image to be detected; S200, inputting the preprocessed image to be detected into a pre-trained multi-stage cascade attention deficit positioning and segmentation network, wherein the multi-stage cascade attention deficit positioning and segmentation network sequentially executes an abnormal region proposal stage and a fine attention segmentation stage; S300, in the rapid abnormal region proposal stage, the abnormal region proposal network in the multistage cascade attention defect positioning and segmentation network rapidly scans the image to be detected, generates an abnormal thermodynamic diagram covering a full graph, and extracts a plurality of rectangular proposal regions containing abnormal defects from the abnormal thermodynamic diagram; S400, i