CN-121982011-A - Surface detection method based on feature selection and parallel interaction attention mechanism
Abstract
The invention discloses a surface detection method based on feature selection and a parallel interaction attention mechanism, and belongs to the technical field of image detection. The method comprises the steps of firstly sending a feature map to be detected into a DFS module, screening out a feature channel subset which is most sensitive to abnormality by the DFS module, mapping the feature channel subset into a unified space through a feature adapter, reducing the dimension to obtain an adaptive feature map, secondly sending the adaptive feature map into a PIA module, respectively processing the adaptive feature map through a global context branch and a local detail branch by the PIA module, enabling the outputs of the global context branch and the local detail branch to interact, and finally outputting the enhanced feature map through residual connection, and thirdly, testing the enhanced feature map through an abnormality decision technology to obtain an abnormality detection result. The invention can find a channel more sensitive to the defects, realize multi-scale characteristic enhancement and enhance the space perception capability of the model to the abnormal region.
Inventors
- YUAN ZHIXIANG
- JIN YUFANG
- Ren Shiliu
- ZHANG HAIMING
Assignees
- 安徽工业大学
Dates
- Publication Date
- 20260505
- Application Date
- 20260202
Claims (10)
- 1. A surface detection method based on feature selection and parallel interaction attention mechanism, characterized by comprising the following steps: 1. Sending the feature map to be detected into a DFS module, screening out a feature channel subset which is most sensitive to abnormality by the DFS module, mapping the feature channel subset to a unified space through a feature adapter, and performing dimension reduction to obtain an adaptive feature map; 2. the adaptive feature map is sent to a PIA module, the PIA module respectively processes the adaptive feature map through a global context branch and a local detail branch, then outputs of the global context branch and the local detail branch are interacted, and finally the enhanced feature map is output through residual connection; 3. And (3) testing the enhanced feature map by adopting an anomaly decision technology to obtain an anomaly detection result.
- 2. The method of claim 1, wherein in step one, the multi-scale feature map is extracted through a backbone network pre-trained at imageNet before the feature map is fed into the DFS module.
- 3. The method for surface detection based on feature selection and parallel interaction attention mechanism of claim 2, wherein the DFS module screens the feature channel subset comprising three phases: (1) A module initialization phase, according to a predefined structure, preparing for feature selection; (2) An index initialization process, before training begins, evaluating and selecting the most effective channel in each feature block; (3) The forward propagation process uses pre-computed indices to efficiently construct multi-scale features.
- 4. The surface detection method based on feature selection and parallel interaction attention mechanism of claim 3, wherein the specific flow of the module initialization stage is: The method comprises the steps of reading and analyzing the structural definition of a module, setting up a feature block from different levels, creating a trainable index parameter for each layer in each feature block for storing a selected channel index, registering a corresponding up-sampling module for each feature layer for unifying the features to a target scale.
- 5. The surface detection method based on feature selection and parallel interaction attention mechanism of claim 4, wherein the specific flow of the index initialization process is: for each feature layer l, the differences between the abnormal and normal features are calculated: ; Wherein, the B is the batch size, C is the channel number, H, W is the spatial dimension, A feature map of a normal image is shown, A feature map representing an abnormal image; The difference map was then remodeled and min-max normalized channel by channel: ; Wherein, the Is a very small number, prevents zero removal errors, Representing the normalized characteristic difference value of the c-th channel, Representing the original characteristic difference value of the c-th channel, min # ) Representing the minimum value of all pixel values of the c-th channel, max # ) Representing the maximum value of all pixel values of the c-th channel; The binarized true anomaly mask is then used Upsampling to AND The same size and reshaped into Then copy C times along the channel dimension to obtain Finally, the MSE loss for each channel c is calculated: ; After the losses of a plurality of batches are accumulated finally, the first K channels with the minimum losses are selected: ; ; Wherein, the Representing the cumulative loss of all channels of the first layer, k representing the number of channels to be selected, values representing the selected k minimum loss values, indexes representing the corresponding channel index numbers, the selected channel index Stored for later use.
- 6. The surface detection method based on feature selection and parallel interaction attention mechanism of claim 5, wherein the specific flow of the forward propagation process is: Channel selection: ; Wherein, the Representing the original feature map of the first layer, Indicated is the selected first layer feature, Representing the channel index set of the first layer, dim=1 represents selecting in the channel dimension (1 st dimension, 0-based index); Feature upsampling: ; Wherein, the Representing the bicubic interpolation function of the first layer, The upsampling scale factor of the first layer, model= Indicating that bicubic interpolation mode is specified to be used; Feature fusion: ; Wherein, the Represent the first The features after the layer up-sampling, cancat represent the stitching operation, Representing the final fused feature block.
- 7. The method for detecting a surface based on feature selection and parallel interaction attention mechanisms of claim 1, wherein the adaptive feature map received by the PIA module Wherein B is Batch size, C is channel number, H and W are feature map height and width, then dividing the channel dimension into G groups and remodelling into Batch dimension: 。
- 8. The method for detecting surface based on feature selection and parallel interaction attention mechanism of claim 7, wherein global context branching is adopted The flow of processing the adaptive feature map is as follows: the branch generates channel attention weights for direction perception to capture global context information, and the channel attention weights are divided into a horizontal direction and a vertical direction, wherein the horizontal direction is compressed along a width dimension, and the formula is as follows: ; Wherein, the An adaptive two-dimensional average pooling operation is shown, Indicated are a height H, a width 1, Representing a horizontal global pooling result; The vertical direction is compressed along the high latitude, and the formula is: ; Wherein, the Representing a global pooling result in a vertical direction, (1, w) represents a height of 1 and a width of w; then the features in the two directions are spliced and used Convolution fusion: ; Wherein, the Representation 1 1 One-dimensional convolution; And generating global attention weights by Sigmoid activation functions: ; Wherein, the Represented is a compressed global semantic feature, The activation function is represented as a function of the activation, Representing global attention weights.
- 9. The method for detecting surface based on feature selection and parallel interaction attention mechanism as recited in claim 8, wherein local detail branching is adopted The flow of processing the adaptive feature map is as follows: depth can be molecularly convolved: ; Wherein, the Representing Depth separable convolution, L, represents local detail features; local feature activation: ; Wherein, the Representing local attention weights.
- 10. The method for detecting the surface based on the feature selection and parallel interaction attention mechanism of claim 9, wherein the process of enabling the outputs of the global context branch and the local detail branch to interact and finally outputting the enhanced feature map through residual connection is as follows: The outputs of the global context branches and the local detail branches realize cross-branch interaction through matrix multiplication: ; Where d is a scaling factor, typically taking d=c/G, Representing the transposed local feature matrix, softmax representing the normalized exponential function; attention weights are then applied to the local features: ; wherein, the Attention represents a global-local correlation matrix, Representing the weighted feature matrix; remodelling the weighted features back to the original spatial dimension: ; Wherein, the Representing the enhanced grouping feature; restoring the original batch and channel dimensions: ; Finally, the original information and the enhancement features are contained through residual connection output: ; representing the final enhancement profile.
Description
Surface detection method based on feature selection and parallel interaction attention mechanism Technical Field The invention belongs to the technical field of image detection, and particularly relates to a surface detection method based on feature selection and a parallel interaction attention mechanism. Background Surface detection is a technique that identifies and precisely locates abnormal areas of the surface of a captured object. Compared with the traditional image processing method, the surface defect detection method based on the deep convolutional neural network achieves the performance advantage of more competitive power. Since small defects are easily masked by background noise in the task of surface defect detection, it is necessary to extract feature information of finer granularity to detect small defects. The general convolution module generally extracts more local feature information under a single scale, so that the general convolution module is difficult to cope with image detection of complex defect types, and is poor in defect positioning accuracy and tiny defect detection rate. At present, in the field of surface detection, a method based on deep learning has remarkable progress in the aspects of defect positioning precision and micro defect detection rate. However, when the existing feature extraction method faces a complex industrial scene, the problem of insufficient multi-scale information fusion still exists, in order to solve the problem, PANet (Path Aggregation Network) networks are proposed, and PANet is to increase a bottom-up enhancement path on the basis of FPN (Feature Pyramid Network), so as to form a bidirectional pyramid structure, and achieve more sufficient multi-scale feature fusion. Furthermore, SCANet (Spatial-Channel Attention Network) networks have been proposed to address the problem of low contrast between defects and background by multi-layer attention mechanisms and feature recalibration. Recently, DCNv-ADet (Deformable Convolution v 4+ Adaptive Attention) has been proposed to solve the problem of positioning ambiguity caused by defect morphology diversity by adapting the deformable convolution v4 to defect boundaries of arbitrary shape and dynamically adjusting the receptive field to the scale variation. However, despite the significant advances in surface inspection tasks, these techniques suffer from several shortcomings, including (1) feature redundancy resulting in poor accuracy of defect localization, the traditional approach being to use all feature channels, resulting in 95% of the computing resources and time being wasted in processing redundant and noisy information, and significant differences in the intensity of the feature responses of the different channels. Some redundant feature channels produce an excessively strong activation response, while some critical features that are susceptible to anomalies tend to be buried in background noise. This imbalance in the characteristic response severely affects the model's perceptibility of subtle abnormal patterns. (2) The multi-scale information fusion is insufficient, and industrial defects often show multi-scale characteristics, and have macroscopic structural anomalies and microscopic texture defects. When the prior method fuses the characteristic information of different scales, simple splicing or adding operation is generally adopted, deep excavation of semantic association among the trans-scale characteristics is lacking, and the multi-scale collaborative detection effect is poor. (3) The space context information is underutilized, and the abnormality detection task has higher requirements on the space distribution relation of the characteristics. When the traditional method processes the feature map, correlation modeling between the spatial positions is insufficient, and the connection between the local features and the global context cannot be effectively established, so that the accurate positioning of the model to the abnormal region is affected. Disclosure of Invention 1. Problems to be solved Aiming at the problems of various defects in the existing surface detection technology, the invention provides a surface detection method based on feature selection and parallel interaction attention mechanisms, and a channel more sensitive to defects can be found by using a DFS and PIA module, so that multi-scale feature enhancement is realized, and the space perception capability of a model to an abnormal region is enhanced. 2. Technical proposal In order to solve the problems, the invention adopts the following technical scheme. A surface detection method based on feature selection and parallel interaction attention mechanism, comprising the steps of: 1. Sending the feature map to be detected into a DFS module, screening out a feature channel subset which is most sensitive to abnormality by the DFS module, mapping the feature channel subset to a unified space through a feature adapter, and performing