CN117974648B - Fabric flaw detection method - Google Patents

Fabric flaw detection method Download PDF

Info

Publication number
CN117974648B
CN117974648B CN202410370353.4A CN202410370353A CN117974648B CN 117974648 B CN117974648 B CN 117974648B CN 202410370353 A CN202410370353 A CN 202410370353A CN 117974648 B CN117974648 B CN 117974648B
Authority
CN
China
Prior art keywords
channel
feature
feature extraction
image
convolution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410370353.4A
Other languages
Chinese (zh)
Other versions
CN117974648A (en
Inventor
周玉龙
钟梅嘉
张久林
赵一多
王伟
杨光
胡巧生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China National Machinery Institute Group Jiangsu Branch Co ltd
Original Assignee
China National Machinery Institute Group Jiangsu Branch Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China National Machinery Institute Group Jiangsu Branch Co ltd filed Critical China National Machinery Institute Group Jiangsu Branch Co ltd
Priority to CN202410370353.4A priority Critical patent/CN117974648B/en
Publication of CN117974648A publication Critical patent/CN117974648A/en
Application granted granted Critical
Publication of CN117974648B publication Critical patent/CN117974648B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06N3/0455Auto-encoder networks; Encoder-decoder networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/30Noise filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/36Applying a local operator, i.e. means to operate on image points situated in the vicinity of a given point; Non-linear local filtering operations, e.g. median filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/42Global feature extraction by analysis of the whole pattern, e.g. using frequency domain transformations or autocorrelation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • G06V10/443Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by matching or filtering
    • G06V10/449Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters
    • G06V10/451Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters with interaction between the filter responses, e.g. cortical complex cells
    • G06V10/454Integrating the filters into a hierarchical structure, e.g. convolutional neural networks [CNN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30124Fabrics; Textile; Paper
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Nonlinear Science (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Quality & Reliability (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)

Abstract

The application relates to the technical field of defect detection, in particular to a fabric defect detection method, which comprises the following steps of S1, constructing a fabric defect detection model comprising a plurality of encoders and decoders corresponding to the encoders, wherein the encoders are connected with the decoders through jump connection layers; s2, acquiring an image and preprocessing the image; s3, extracting defect characteristics by using a fabric defect detection model; the defect feature extraction process comprises the following steps: a CoT feature extraction module is adopted in the encoder to be fused with an ECA module, the image is downsampled, and then upsampled by a decoder; and fusing the spatial branches and the channel branches of the image in the jump connection layer to perform feature expression, and performing defect feature position identification. The application combines the CoT feature extraction module with the ECA module, and adopts average pooling and maximum pooling in parallel to perform feature extraction, thereby improving the operation efficiency and the defect identification precision, combining the space branch with the channel branch, and accurately positioning the features.

Description

Fabric flaw detection method
Technical Field
The application relates to the technical field of defect detection, in particular to a fabric defect detection method.
Background
Cloth flaw detection is a vital link in the textile industry, cloth has nearly hundred different flaw types, even the same flaw, the shape and the size of the cloth also have differences, and the defects are difficult to distinguish due to the difference of cloth materials and the fact that the cloth is based on flexible materials. Therefore, the existing defect detection method is difficult to accurately distinguish the defects of the fabric, and the defect detection of the fabric generally depends on manual visual inspection, so that the time and the labor are wasted, and human errors are easy to occur, so that a large number of situations such as false detection, missing detection and the like are caused. Therefore, how to detect the surface flaws of the fabric efficiently and accurately is a problem to be solved.
Disclosure of Invention
The invention aims to solve the technical problems that: the existing defect detection method is difficult to accurately distinguish the defects of the fabric, and the defect detection efficiency of the fabric is low.
To this end, the present invention provides a method for detecting fabric defects.
The technical scheme adopted for solving the technical problems is as follows:
a fabric flaw detection method comprises the following steps,
S1, constructing a fabric defect detection model, wherein the fabric defect detection model comprises a plurality of encoders and decoders corresponding to the encoders, and the encoders are connected with the decoders corresponding to the encoders through jump connection layers;
S2, acquiring an image of the surface of the object to be detected, and preprocessing the image;
s3, performing defect feature extraction on the preprocessed image by using a fabric defect detection model;
The process of defect feature extraction in step S3 includes:
S3.1, fusing a CoT feature extraction module and an ECA module in an encoder, downsampling an image, and upsampling through a decoder;
s3.2, fusing the spatial branches and the channel branches of the image in the jump connection layer to perform feature expression, and performing defect feature position recognition.
Further, the specific step of S3.2 includes:
S3.2.1 giving weights in the vertical direction and weights in the horizontal direction in the spatial branches to input X (i, j), embedding and splicing coordinate information given with the weights in the vertical direction and the weights in the horizontal direction, and then performing convolution, batch regularization and nonlinear activation operation to obtain a feature Y1;
The number of S3.2.2 channel branches corresponds to the number of dimensions in the space branches, one channel branch is associated with a vertical dimension in the space branch to form a third dimension (W, C, H), the other channel branch is associated with a horizontal dimension in the space branch to form a third dimension (C, W, H), and the third dimension is compressed and spliced through average pooling and maximum pooling to obtain a characteristic diagram of (W, C, 2) and (C, H, 2);
s3.2.3, after correlating the two dimensions of the channel branch and the space branch, convolving and activating to obtain features Y2 and Y3, and obtaining a fusion positioning feature Y by the fusion features Y1, Y2 and Y3.
Further, in step S3.2.1, the coordinate information of the two directions of the input point X is embedded to be spliced, and then convolution, batch regularization and nonlinear activation operations are performed,Wherein z h、zw is the use of two pooled cores/>, respectivelyAfter each channel is encoded along the horizontal and vertical coordinates, outputting a c-th channel with the height of h and the width of w; /(I)Is/>Is a convolution kernel of (2); /(I)A nonlinear activation function; f represents the intermediate feature map of the surface flaw spatial information, and the convolution check decomposes f into/>And/>Use/>Pair/>And/>And (3) performing transformation: /(I)Wherein/>Representing a sigmoid function; conv1 is used to restore the channel number of two components to the channel number size of input X, with/>And/>Weights in both vertical and horizontal directions are expressed, and the coordinates (i, j) and weights of the input point X are calculatedAnd/>The multiplication results in an output Y1, as shown in the following equation: /(I)
Further, in step S3.2.2, cross-channel interactions between channel dimension C and spatial dimension W/H are captured,Wherein cat is a splicing operation, avg and max are an average pooling operation and a maximum pooling operation respectively, and per' and per″ are transposition operations.
Further, in step S3.2.3, the final weight is obtained through convolution operation and a b n layer and then through a sigmoid activation function, and the final weight is obtained through dot multiplication with the input X to obtain the outputs Y2 and Y3:,/> Final output fusion positioning feature is/>
Further, the specific step of fusing the CoT feature extraction module with the ECA module in step S3.1 includes:
S3.1.1 extracting context information from the convolution with the convolution kernel k of the input X (i, j) in the CoT feature extraction module, and fusing the two context expressions to obtain an output result y of the CoT feature extraction module;
S3.1.2 inputting the output result y of the CoT feature extraction module into an ECA module, in the ECA module, respectively carrying out parallel calculation on global average pooling and global maximum pooling aggregate global features on the output result y of the CoT feature extraction module, and fusing the features obtained after the two pooling to obtain a final fused feature extraction output result y';
s3.1.3 carrying out one-dimensional convolution and activation on the fusion characteristic extraction output result y' with the size of k, then obtaining a weight used for representing the correlation and importance of each channel, multiplying the weight W with the input characteristic y, and finishing recoding of the characteristic of each channel.
Further, the method comprises the steps of,Where y' is a full channel feature,/>GAP and MAX are global average pooling operations and maximum pooling operations, respectively.
Further, in step S3.1.3, one-dimensional convolution with a size k is performed under the condition of the same dimension, where the size k of the convolution kernel represents the coverage of local cross-channel interaction, the coverage of interaction is determined, and after convolution, the activation value is calculated by using Sigmoid function to obtain the weightRepresenting the relevance and importance of each channel: Wherein/> Representing a one-dimensional convolution of size k,/>Representing Sigmoid activation functions.
Further, multiplying the weight W with the input feature y to complete recoding of each channel feature, so that a larger weight is allocated to important features, a smaller weight is allocated to non-task information to suppress, and finally, the original input features are fused through residual connection:
The invention has the beneficial effects that the CoT feature extraction module is combined with the ECA module in the feature extraction process, and the feature extraction is carried out in the ECA module in a mode of parallel connection of average pooling and maximum pooling, so that on the basis of improving the operation efficiency, the feature information of all channels is simultaneously extracted by adopting an average pooling layer and a maximum pooling layer, and the feature space information is aggregated, thereby being capable of maximizing the remarkable features of the focusing flaw area and improving the accuracy of defect identification.
In addition, the coordinate attention module is embedded into the jump connection part of the corresponding codec structure to extract the position information of the fabric defect area, the space branch is combined with the channel branch, and the two-dimensional feature in the space branch is associated into the three-dimensional feature, so that the correlation between the extracted feature points in the image is enhanced, the accuracy of the feature special area is improved, the noise interference is reduced, and the defect area can be quickly and accurately identified and the feature is accurately positioned when the defect detection is carried out.
Drawings
The invention will be further described with reference to the drawings and examples.
FIG. 1 is an overall flow chart of a fabric defect detection method of the present invention.
Fig. 2 is a schematic structural diagram of a feature extraction model in the present invention.
Fig. 3 is a schematic structural diagram of the CoT feature extraction module in the present invention.
Fig. 4 is a schematic diagram of the structure of the coordinate attention module CA in the present invention.
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings. The drawings are simplified schematic representations which merely illustrate the basic structure of the invention and therefore show only the structures which are relevant to the invention.
In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the device or element being referred to must have a specific orientation, be configured and operated in a specific orientation, and therefore should not be construed as limiting the present invention. Furthermore, features defining "first", "second" may include one or more such features, either explicitly or implicitly. In the description of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
Referring to fig. 1-4, a fabric defect detection method comprises the steps of:
s1: constructing a feature extraction model
The structure of the feature extraction algorithm is shown in fig. 2, the upper layer is an encoder, the middle layer is a jump connection layer, the lower layer is a decoder, the encoder is 4 layers, and each layer firstly adopts a CoT (Contextual Transformer-attention) feature extraction module and an ECA module to extract the features of the input image and the input image passes throughDownsampling is performed by the maximum pooling of (c), and then upsampling is performed by the decoder through uppooling, recovering the feature map size layer by layer.
The corresponding coding layer and decoding layer are connected through a jump connection layer, a CA module is embedded to filter noise, a final feature image is output, a picture flaw pixel area is judged, a flaw segmentation result is output, and the jump connection layer adopts spatial branches and fusion of the same branches to perform feature expression and perform defect feature position identification.
S2, acquiring an image of the surface of the object to be detected, and preprocessing the image.
S2.1 image acquisition
The image acquisition module comprises an illumination system and an industrial camera, and obtains the surface image of the object to be detected through the cooperative coordination of the light source and the camera. Polishing the fabric surface by using an illumination system, shooting the fabric surface by using a CCD camera, and transmitting the shot fabric surface image into a fabric surface flaw detection system of a computer.
S2.2 image preprocessing
The image processing module comprises image enhancement and image denoising, and the background noise interference exists in the fabric surface photo, so that the image preprocessing operation is needed. The image can be enhanced by using Retinex, the local texture detail characteristics of the image can be enhanced, and definition is definedIs the coordinates of the original image,/>For the coordinates of the reflected image,/>For incident luminance images, their relationship can be expressed as:
taking the logarithm of two sides to obtain:
the conversion is as follows:
For a pair of And (5) performing contrast enhancement to obtain a final result image.
The bilateral filtering simultaneously considers airspace information and gray level similarity, and the purposes of edge protection and denoising are achieved. Compared with mean filtering, median filtering and Gaussian filtering, the bilateral filtering is used for denoising and meanwhile preserving the edge characteristics of the image. The bilateral filtering operation is as follows:
Wherein the method comprises the steps of Coordinate point representing current convolved pixel,/>Representing a range pixel coordinate point,/>Representing the value calculated by two gaussian functions,/>,/>Is a smoothing parameter, and in a flat area of an image, the pixel value change is small, and Gaussian blur is performed; in the edge region of the image, the pixel value changes greatly and the information of the edge is maintained.
And S3, performing defect feature extraction on the preprocessed image by using a fabric defect detection model.
Dividing the data set obtained after pretreatment into a training set and a testing set, training the feature extraction model by using the training set, verifying the fabric defect detection model by using the testing set, and then putting into use.
The model dataset is a real image 8563 acquired in a textile factory and comprises 12 defects such as knots, three wires, holes and the like, wherein 6150 sheets are training sets, 2413 sheets are test sets, and the model with the best effect is obtained after training and testing and is deployed on weaving machine equipment. If the defective area is detected on the surface of the fabric, sending the detection result to the client for reminding in real time, wherein the early warning information comprises the product number of the defect, the position, the type and the severity of the defective area.
S3.1, fusing the CoT feature extraction module and the ECA module in the encoder, downsampling the image, and upsampling through the decoder.
In S3.1.1 downsampling process, a feature extraction module CoT (Contextual Transformer-attention) is built, and Query, key Keys and value vector Values of the input image are respectively defined asWhere W v is a weight matrix of V, convolving adjacent keys with k to obtain(H, W, C are the length, width, channel number of the feature map K 1, respectively), K 1 has context information, which can be regarded as locally statically modeled, correlation information between reaction regions: /(I)Wherein/>The convolution kernel is denoted as the convolution of k.
Then, after K 1 is spliced with Q, a local attention matrix is obtained through two convolutions: wherein, the method comprises the steps of, wherein, Representing the convolution kernel as/>Convolution of/>Representing the convolution kernel as/>Is a convolution of (a) and (b).
The local attention matrixes A and V are polymerized to obtain enhanced characteristicsK 2 is the dynamic context expression of X, and can acquire the characteristic interaction of X.
Fusing the two context expressions to obtain an output result of the CoT feature extraction module:
S3.1.2 inputting the output result y into an ECA (EFFICIENTCHANNEL ATTENTION, high-efficiency channel attention) module, in the ECA module, carrying out parallel calculation on global average pooling and global maximum pooling on the output result y of the CoT feature extraction module, and fusing the features obtained after the two pooling to obtain a final feature extraction output result y', wherein the global average pooling is to average global information, and the global maximum pooling retains the most remarkable information in the global information.
Compared with the prior art, the global average pooling is generally used for aggregating spatial information, so that a part of information of an image is lost, in order to obtain more information and improve the efficiency of feature extraction, an ECA module and a CoT feature extraction module are used in a fused mode, on one hand, the calculation efficiency can be improved, on the other hand, as the colors of a flaw area and a non-flaw area tend to be greatly different, the edges of the flaw area tend to be uneven, interference items exist, an average pooling layer and a maximum pooling layer are connected in parallel, global maximum pooling operation is used for enhancing channel attention, the most remarkable feature information is reserved by the maximum pooling operation, and meanwhile, the feature information of all channels is extracted by adopting the average pooling layer and the maximum pooling layer, so that the remarkable features of the flaw area can be maximized, and the defect identification accuracy is improved.
Fusion characteristics obtained after extraction of an average pooling layer and a maximum pooling layer:
Where y' is the full channel feature, GAP and MAX are global average pooling operations and maximum pooling operations, respectively.
S3.1.3 carrying out one-dimensional convolution with the size of k under the condition of the same dimension, wherein the size of a convolution kernel is k which represents the coverage range of local cross-channel interaction, the coverage range of interaction is determined, and an activation value is calculated by using a Sigmoid function after convolution to obtain a weightThat is, W is a weight vector of (1, c), representing the correlation and importance of each channel:
where con '(y') represents a one-dimensional convolution of size k, Representing a Sigmoid activation function, multiplying the weight W by the input feature y to finish recoding of each channel feature, so that a larger weight is allocated to important features, and a smaller weight is allocated to non-task information to restrain. Finally, fusing the original input features through residual connection: /(I)The residual connection provides a path around the nonlinear transformation by adding a cross-layer connection between the output and input of each layer, adding the output of the previous layer directly to the output of the current layer. Thus, the network can learn the method for retaining important information after the information is compressed or stretched, and the problems of gradient disappearance or gradient explosion are relieved.
S3.2, fusing the spatial branches and the channel branches of the image in the jump connection layer to perform feature expression, and performing defect feature position recognition.
The jump connection part of the corresponding codec structure is embedded with a coordinate attention module to extract the position information of a fabric defect area, the input features are decomposed into a pair of dimensional direction perception feature images by using global average pooling operation, each channel is encoded along the horizontal coordinates and the vertical coordinates to obtain weights in the vertical and horizontal space directions, and finally the weights are fused with the input feature images to obtain the coordinate attention feature images.
S3.2.1 in the spatial branch, a global pooling operation is performed on the C-th channel of the input point X with dimensions (W, H, C), z c represents the output of the C-th channel:
Using two pooling cores Encoding each channel along the horizontal and vertical coordinates, the output of the c-th channel with height h and width w is expressed as:
both of these transformations can capture not only cross-channel information, but also location information, which helps the network model to locate the defect area more accurately.
And splicing the aggregated feature graphs in two directions, aggregating features along two spatial directions respectively to obtain a pair of direction-sensing feature graphs, wherein the feature graphs comprise global feature information and accurate position information, and performing convolution, batch regularization and nonlinear activation on the feature graphs after splicing.
Wherein,Is/>Is a convolution kernel of (2); /(I)A nonlinear activation function; f represents the intermediate feature map of the surface flaw spatial information, and the convolution check decomposes f into/>And/>Use/>Pair/>And/>And (3) performing transformation:
Wherein, Representing a sigmoid function; conv1 is used to restore the channel number of two components to the channel number size of input X, with/>And/>Weights in both vertical and horizontal directions are expressed, and coordinates (i, j) of the input point X and the weights/>And/>The multiplication results in an output Y1, as shown in the following equation:
The number of S3.2.2 channel branches corresponds to the number of dimensions in the spatial branches, one channel branch being associated with a vertical dimension in the spatial branch to form a third dimension, the other channel branch being associated with a horizontal dimension in the spatial branch to form a third dimension. And (3) respectively transposing the dimension of the input X with the dimension of (W, H, C) into the characteristics of (W, C, H) and (C, W, H), and then carrying out compression operation on the third dimension through average pooling and maximum pooling, so as to obtain the characteristic diagrams of (W, C, 2) and (C, H, 2) after splicing, and respectively capturing cross-channel interaction between the channel dimension C and the space dimension W/H through the operation.
Wherein cat is a splicing operation, avg and max are an average pooling operation and a maximum pooling operation respectively, and per' and per″ are transposition operations.
S3.2.3 obtaining final weight through a sigmoid activation function after convolution operation and bn layer (batch standardization layer), and obtaining outputs Y2 and Y3 after dot multiplication with input X:
The final output fusion positioning characteristic is that
Y1 is the position characteristic of the fabric defect based on the space branch, Y2 and Y3 are the position characteristics of the fabric defect after the channel branch and the space branch are associated, the three are fused and expressed as Y, the space branch and the channel branch are fused, and after the channel branch is fused, the two-dimensional characteristics in the space branch are associated as three-dimensional characteristics, so that the correlation between the extracted characteristic points in the image is enhanced, the accuracy of the characteristic special region is improved, the noise interference is reduced, and the defect region can be rapidly and accurately identified when the defect detection is carried out.
The present application also provides a computer readable storage medium, which can be disposed in a server to store at least one instruction or at least one program for implementing a fabric defect detection method as described above, the at least one instruction or the at least one program being loaded and executed by the processor to implement the fabric defect detection method as described above.
Alternatively, in this embodiment, the storage medium may be located in at least one network server among a plurality of network servers of the computer network. Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-only memory (ROM), a random access memory (RAM, randomAccessMemory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present invention also provide a computer program product or computer program comprising computer instructions stored in a storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform at least one of the fabric flaw detection methods provided in the various alternative embodiments described above.
In summary, the invention combines the CoT feature extraction module and the ECA module in the feature extraction process, and performs feature extraction in parallel by adopting an average pooling and maximum pooling mode in the ECA module, thereby extracting the feature information of all channels by adopting an average pooling layer and a maximum pooling layer on the basis of improving the operation efficiency, and aggregating the feature space information, so that the significant features of the maximized focusing flaw area can be obtained, and the accuracy of defect identification can be improved.
In addition, the coordinate attention module is embedded into the jump connection part of the corresponding codec structure to extract the position information of the fabric defect area, the space branch is combined with the channel branch, and the two-dimensional feature in the space branch is associated into the three-dimensional feature, so that the correlation between the extracted feature points in the image is enhanced, the accuracy of the feature special area is improved, the noise interference is reduced, and the defect area can be quickly and accurately identified and the feature is accurately positioned when the defect detection is carried out.
With the above-described preferred embodiments according to the present invention as an illustration, the above-described descriptions can be used by persons skilled in the relevant art to make various changes and modifications without departing from the scope of the technical idea of the present invention. The technical scope of the present invention is not limited to the description, but must be determined as the scope of the claims.

Claims (7)

1. A fabric flaw detection method is characterized by comprising the following steps,
S1, constructing a fabric defect detection model, wherein the fabric defect detection model comprises a plurality of encoders and decoders corresponding to the encoders, and the encoders are connected with the decoders corresponding to the encoders through jump connection layers;
S2, acquiring an image of the surface of the object to be detected, and preprocessing the image;
s3, performing defect feature extraction on the preprocessed image by using a fabric defect detection model;
The process of defect feature extraction in step S3 includes:
S3.1, fusing a CoT feature extraction module and an ECA module in an encoder, downsampling an image, and upsampling through a decoder;
The specific steps of fusing the CoT feature extraction module and the ECA module in step S3.1 include:
S3.1.1 extracting context information from the convolution with the convolution kernel k of the input X (i, j) in the CoT feature extraction module, and fusing the two context expressions to obtain an output result y of the CoT feature extraction module;
S3.1.2 inputting the output result y of the CoT feature extraction module into an ECA module, in the ECA module, respectively carrying out parallel calculation on global average pooling and global maximum pooling aggregate global features on the output result y of the CoT feature extraction module, and fusing the features obtained after the two pooling to obtain a final fused feature extraction output result y';
S3.1.3 carrying out one-dimensional convolution and activation with the size of k on the fusion characteristic extraction output result y', then obtaining a weight used for representing the correlation and importance of each channel, multiplying the weight W with the input characteristic y, and finishing recoding of the characteristic of each channel;
s3.2, fusing the spatial branches and the channel branches of the image in the jump connection layer to perform feature expression, and performing defect feature position identification;
the specific steps of S3.2 include:
S3.2.1 giving weights in the vertical direction and weights in the horizontal direction in the spatial branches to input X (i, j), embedding and splicing coordinate information given with the weights in the vertical direction and the weights in the horizontal direction, and then performing convolution, batch regularization and nonlinear activation operation to obtain a feature Y1;
The number of S3.2.2 channel branches corresponds to the number of dimensions in the space branches, one channel branch is associated with a vertical dimension in the space branch to form a third dimension (W, C, H), the other channel branch is associated with a horizontal dimension in the space branch to form a third dimension (C, W, H), and the third dimension is compressed and spliced through average pooling and maximum pooling to obtain a characteristic diagram of (W, C, 2) and (C, H, 2);
s3.2.3, after correlating the two dimensions of the channel branch and the space branch, convolving and activating to obtain features Y2 and Y3, and obtaining a fusion positioning feature Y by the fusion features Y1, Y2 and Y3.
2. The method for detecting fabric defects according to claim 1, wherein in step S3.2.1, coordinate information of two directions of the input point X is embedded and spliced, and then convolution, batch regularization and nonlinear activation operations are performed,Wherein z h、zw is the use of two pooled cores/>, respectivelyAfter each channel is encoded along the horizontal and vertical coordinates, outputting a c-th channel with the height of h and the width of w; /(I)Is/>Is a convolution kernel of (2); /(I)A nonlinear activation function; f represents the intermediate feature map of the surface flaw spatial information, and the convolution check decomposes f into/>And/>Use/>Pair/>And/>And (3) performing transformation: /(I),/>Wherein/>Representing a sigmoid function; conv1 is used to restore the channel number of two components to the channel number size of input X, with/>And/>Weights in both vertical and horizontal directions are expressed, and coordinates (i, j) of the input point X and the weights/>And/>The multiplication results in an output Y1, as shown in the following equation:
3. the method for detecting fabric defects according to claim 2, wherein in step S3.2.2, cross-channel interactions between channel dimension C and spatial dimension W/H are captured, Wherein cat is a splicing operation, avg and max are an average pooling operation and a maximum pooling operation respectively, and per' and per″ are transposition operations.
4. The fabric defect detection method of claim 2, wherein in step S3.2.3, final weights are obtained by convolution operation and bn layer and then by sigmoid activation function, and outputs Y2, Y3 are obtained by dot multiplication with input X:,/> Final output fusion positioning characteristics are that
5. The method for detecting fabric defects according to claim 1, wherein,Where y' is a full channel feature,/>GAP and MAX are global average pooling operations and maximum pooling operations, respectively.
6. The method for detecting fabric defects according to claim 1, wherein in step S3.1.3, one-dimensional convolution of size k is performed under the condition of the same dimension, wherein the size k of the convolution kernel represents the coverage of local cross-channel interaction, the coverage of interaction is determined, and the activation value is calculated by using Sigmoid function after convolution to obtain the weightRepresenting the relevance and importance of each channel: /(I)Wherein/>Representing a one-dimensional convolution of size k,/>Representing Sigmoid activation functions.
7. The method of claim 6, wherein the input features y are multiplied by a weight W, recoding is performed for each channel feature, wherein the weight of the important features in the channel feature is greater than the weight of the non-task information in the channel feature, and finally the original input features are fused by residual connection:
CN202410370353.4A 2024-03-29 2024-03-29 Fabric flaw detection method Active CN117974648B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410370353.4A CN117974648B (en) 2024-03-29 2024-03-29 Fabric flaw detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410370353.4A CN117974648B (en) 2024-03-29 2024-03-29 Fabric flaw detection method

Publications (2)

Publication Number Publication Date
CN117974648A CN117974648A (en) 2024-05-03
CN117974648B true CN117974648B (en) 2024-06-04

Family

ID=90853362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410370353.4A Active CN117974648B (en) 2024-03-29 2024-03-29 Fabric flaw detection method

Country Status (1)

Country Link
CN (1) CN117974648B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118396973B (en) * 2024-05-21 2024-10-22 华南理工大学 UMamba-based kettle defect semantic segmentation detection system and UMamba-based kettle defect semantic segmentation detection method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113888523A (en) * 2021-10-20 2022-01-04 山西省机电设计研究院有限公司 Real-time semantic segmentation method for strengthening X-ray stainless steel weld defects
CN113989228A (en) * 2021-10-27 2022-01-28 西安工程大学 Method for detecting defect area of color texture fabric based on self-attention
CN114119502A (en) * 2021-11-05 2022-03-01 西安工程大学 Method for detecting chromatic aberration and stain defects of colored texture fabric
CN114943694A (en) * 2022-05-09 2022-08-26 浙江科技学院 Defect detection method based on confrontation generation network and attention
CN116309648A (en) * 2023-05-14 2023-06-23 哈尔滨理工大学 Medical image segmentation model construction method based on multi-attention fusion
CN116862860A (en) * 2023-07-04 2023-10-10 中国机械总院集团江苏分院有限公司 Stamping intelligent detection and static production data acquisition networking method based on Yolov4
CN117727046A (en) * 2023-12-22 2024-03-19 上海华讯网络系统有限公司 Novel mountain torrent front-end instrument and meter reading automatic identification method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3510381A4 (en) * 2016-09-06 2020-07-29 Debina Diagnostics, Inc. Nanodiamond particles and related devices and methods
US20240005645A1 (en) * 2022-06-09 2024-01-04 Young-Jin Cha Computer-implemented methods for analyzing thermographic image having article of interest using machine learning and for training machine learning algorithm therefor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113888523A (en) * 2021-10-20 2022-01-04 山西省机电设计研究院有限公司 Real-time semantic segmentation method for strengthening X-ray stainless steel weld defects
CN113989228A (en) * 2021-10-27 2022-01-28 西安工程大学 Method for detecting defect area of color texture fabric based on self-attention
CN114119502A (en) * 2021-11-05 2022-03-01 西安工程大学 Method for detecting chromatic aberration and stain defects of colored texture fabric
CN114943694A (en) * 2022-05-09 2022-08-26 浙江科技学院 Defect detection method based on confrontation generation network and attention
CN116309648A (en) * 2023-05-14 2023-06-23 哈尔滨理工大学 Medical image segmentation model construction method based on multi-attention fusion
CN116862860A (en) * 2023-07-04 2023-10-10 中国机械总院集团江苏分院有限公司 Stamping intelligent detection and static production data acquisition networking method based on Yolov4
CN117727046A (en) * 2023-12-22 2024-03-19 上海华讯网络系统有限公司 Novel mountain torrent front-end instrument and meter reading automatic identification method and system

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
CoT-TransUNet:轻量化的上下文Transformer医学图像分割网络;杨鹤等;《计算机工程与应用》;20230201;第59卷(第3期);218-225 *
CoT-UNet++:A medical image segmentation method based on contextual transformer and dense connection;Yijun Yin等;《Mathematical Biosciences and Engineering》;20230301;第20卷(第5期);8320-8336 *
Deep Gaussian Attention Network for Lumber Surface Defect Segmentation;Yuming Zhong等;《IEEE Transactions on Instrumentation and Measurement》;20240326;第73卷;1-12 *
Efficient Channel Attention Based Ecoder-Decoder Approach for Image Captioning in Hindi;Santosh Kumar Mishra等;《ACM Transactions on Asian and Low-Resource Language Information Processing》;20211213;第21卷(第3期);1-17 *
基于UNet++自编码器的织物缺陷检测;莫惠文等;《棉纺织技术》;20231110;第51卷(第11期);22-29 *
基于语义分割的遥感影像建筑变化检测;尹美杰等;《应用科学学报》;20230531;第41卷(第3期);448-460 *

Also Published As

Publication number Publication date
CN117974648A (en) 2024-05-03

Similar Documents

Publication Publication Date Title
KR102319177B1 (en) Method and apparatus, equipment, and storage medium for determining object pose in an image
CN108491848B (en) Image saliency detection method and device based on depth information
CN114550021B (en) Surface defect detection method and device based on feature fusion
CN107767358B (en) Method and device for determining ambiguity of object in image
CN117974648B (en) Fabric flaw detection method
CN110555424A (en) port container layout detection method, device, equipment and readable storage medium
CN111612717A (en) Water surface image reflection removing and repairing method and device based on countermeasure network
CN115830004A (en) Surface defect detection method, device, computer equipment and storage medium
Zhang et al. Multi-task convnet for blind face inpainting with application to face verification
JP2024529423A (en) Security inspection CT object recognition method and device
CN117581232A (en) Accelerated training of NeRF-based machine learning models
CN115439804A (en) Monitoring method and device for high-speed rail maintenance
CN112785480B (en) Image splicing tampering detection method based on frequency domain transformation and residual error feedback module
CN115239672A (en) Defect detection method and device, equipment and storage medium
CN116071309A (en) Method, device, equipment and storage medium for detecting sound scanning defect of component
CN109493280B (en) Image processing method, device, terminal and storage medium
CN118397367A (en) Tampering detection method based on convolution vision Mamba
CN116912675B (en) Underwater target detection method and system based on feature migration
CN115630660B (en) Barcode positioning method and device based on convolutional neural network
CN111311732A (en) 3D human body grid obtaining method and device
CN116664952A (en) Image direction identification method integrating convolution and ViT
CN117333440A (en) Power transmission and distribution line defect detection method, device, equipment, medium and program product
CN116957999A (en) Depth map optimization method, device, equipment and storage medium
Yi et al. Attention-model guided image enhancement for robotic vision applications
CN112634126A (en) Portrait age reduction processing method, portrait age reduction training device, portrait age reduction equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant