Fabric defect detection method based on visual saliency model

By constructing a visual saliency model with spatial detail extraction branch and global information extraction branch, the problem that existing fabric defect detection methods have difficulty taking into account both local anomalies and global structure in complex texture backgrounds is solved, and high-precision and high-efficiency fabric defect detection is achieved.

CN122156168APending Publication Date: 2026-06-05UNIV FOR SCI & TECH ZHENGZHOU

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
UNIV FOR SCI & TECH ZHENGZHOU
Filing Date
2026-03-12
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing fabric defect detection methods struggle to balance the consistency of the global structure with the sensitivity to local anomalies when faced with highly regular textured backgrounds and sudden, minute defects. This results in high-confidence background texture signals easily masking low-contrast defect features, leading to frequent missed detections or false alarms. Furthermore, existing models struggle to achieve a balance between long-distance dependent modeling capabilities and industrial deployment efficiency.

Method used

A fabric defect detection method based on a visual saliency model is adopted, which constructs a spatial detail extraction branch and a global information extraction branch. By leveraging the local perception advantage of convolutional neural networks and the long-distance dependency modeling of visual state space models, and combining a bidirectional feature fusion decoder, the organic combination of local detail features and global context features is achieved.

Benefits of technology

It effectively overcomes the shortcomings of single convolutional networks in taking into account both global regularity and local weak features in strong texture backgrounds, and achieves high-precision detection of fabric defects in complex texture scenes, improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

The application relates to the technical field of computer vision and deep learning, and particularly discloses a fabric defect detection method based on a visual saliency model, which utilizes a convolutional neural network to construct a spatial detail extraction branch, accurately captures the edge and texture details of local tiny defects through a self-adaptive weighted context coordination mechanism, simultaneously introduces a visual state space model to construct a global information extraction branch, and efficiently establishes a long-distance dependence model of a global background with the aid of a two-dimensional space selective scanning technology. On this basis, a bidirectional feature fusion decoder is used to perform deep cascading and dynamic integration on local details and global contexts, thereby effectively suppressing the interference of regular texture backgrounds, enhancing the feature saliency of irregular defects, and realizing high-precision and high-efficiency automatic detection of fabric defects in a low-contrast scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer vision and deep learning technology, and more specifically, to a method for detecting fabric defects based on a visual saliency model. Background Technology

[0002] Fabric defect detection is a crucial step in quality control within the textile industry's production process, directly determining the final grade and commercial value of textiles. With the advancement of Industry 4.0 and intelligent manufacturing, automated inspection technologies based on machine vision are gradually replacing traditional manual visual inspection, becoming the primary means of improving inspection efficiency and accuracy. Fabric images possess significant visual characteristics: the background is typically composed of highly regular, repetitive textures, while defects manifest as sudden, localized, irregular signals, often small in size and with extremely low contrast. This presents a significant challenge to automated inspection algorithms.

[0003] Existing methods for fabric defect detection mainly include traditional image processing methods and deep learning-based methods. Traditional statistical or spectral methods (such as Gabor filtering and gray-level co-occurrence matrix) rely on hand-designed feature descriptors, which have poor generalization ability to complex and varied texture backgrounds and are easily affected by noise. In recent years, deep learning methods, represented by convolutional neural networks, have performed well in general object detection, but still face significant technical bottlenecks in fabric quality inspection scenarios. First, the simple CNN architecture is limited by the local receptive field, making it difficult to effectively model the long-distance texture dependencies on the fabric surface, resulting in insufficient perception of large-scale structural defects. Although introducing Transformer or Mamba architectures can solve the global modeling problem, their computational complexity is high, making it difficult to meet the real-time requirements of industry. Second, and more critically, the processing mechanism in the feature fusion stage is flawed. Existing technologies often use simple physical concatenation and standard convolutional smoothing when fusing local detail features and global context features. However, the background texture signal in fabric images is usually extremely strong, while the signal of tiny defects is extremely weak. This indiscriminate smoothing process leads to the equalization of semantic conflicts. That is, high-confidence background texture information will drown out and suppress low-contrast defect feature signals, making it impossible for the model to accurately distinguish between normal texture fluctuations and real defect damage. As a result, when faced with minor flaws in complex texture backgrounds, it is very easy to miss detections and make false alarms.

[0004] Therefore, an optimized fabric defect detection scheme based on a visual saliency model is desired. Summary of the Invention

[0005] To address the aforementioned technical problems, this application is proposed. Embodiments of this application provide a fabric defect detection method based on a visual saliency model, comprising: S1: Perform size normalization on the acquired original fabric image to be detected to obtain the preprocessed image tensor; S2: Input the preprocessed image tensor into the spatial detail extraction branch to extract local spatial detail features and obtain a local detail feature map; S3: Input the preprocessed image tensor into the global information extraction branch to perform long-distance dependency modeling and global context information capture on the preprocessed image tensor to obtain the global context feature map; S4: Perform bidirectional deep feature fusion on the local detail feature map and the global context feature map to obtain the fused feature representation; S5: Pixel-level probability mapping of the fused feature representation is performed using the terminal prediction convolutional layer to obtain a fabric defect saliency map that characterizes the location and morphology of fabric defects.

[0006] Compared with existing technologies, this application proposes a fabric defect detection method based on a visual saliency model. It simultaneously inputs the preprocessed fabric image into two independent feature extraction paths: the spatial detail extraction branch utilizes the local perception advantage of convolutional neural networks, combined with an adaptive weighted context coordination module, to accurately capture the edges and texture details of minute defects on the fabric surface; the global information extraction branch introduces a visual state space model, establishing long-distance dependencies between pixels through a two-dimensional spatial selective scanning mechanism, effectively modeling the texture patterns of the global background. Based on this, a bidirectional feature fusion decoder is used to perform channel cascading and deep integration of the two feature paths, organically combining local high-frequency abnormal signals with global structured semantic information. This approach effectively overcomes the shortcomings of single convolutional networks in handling strong texture backgrounds, which struggle to simultaneously capture global patterns and weak local features, and avoids the suppression of low-contrast defect signals by high-confidence background noise, thus achieving high-precision detection of fabric defects in complex texture scenes. Attached Figure Description

[0007] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0008] Figure 1 This is a flowchart of a fabric defect detection method based on a visual saliency model according to an embodiment of this application; Figure 2 This is a schematic diagram of the data flow of a fabric defect detection method based on a visual saliency model according to an embodiment of this application; Figure 3This is a flowchart illustrating the process of inputting a preprocessed image tensor into a spatial detail extraction branch to extract local spatial detail features and obtain a local detail feature map, according to the fabric defect detection method based on a visual saliency model in this application embodiment. Figure 4 This is a flowchart illustrating the process of inputting a preprocessed image tensor into a global information extraction branch to perform long-distance dependency modeling and global context information capture on the preprocessed image tensor to obtain a global context feature map, according to the fabric defect detection method based on the visual saliency model of this application. Figure 5 This is a flowchart illustrating the process of performing bidirectional deep feature fusion of local detail feature maps and global context feature maps to obtain fused feature representations in the fabric defect detection method based on the visual saliency model according to embodiments of this application. Figure 6 This is a flowchart illustrating the process of convolutional smoothing and correlation enhancement of a coarse fusion tensor to obtain a fusion feature representation in a fabric defect detection method based on a visual saliency model according to an embodiment of this application. Detailed Implementation

[0009] Hereinafter, exemplary embodiments according to this application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein.

[0010] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not specifically singular and may include plural forms. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.

[0011] Flowcharts are used in this application to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.

[0012] Existing fabric defect detection technologies often struggle to balance the consistency of global structure with the sensitivity to local anomalies when faced with highly regular textured backgrounds and sudden, minute defects. This leads to high-confidence background texture signals easily masking low-contrast defect features, resulting in frequent missed detections or false alarms. Furthermore, existing models struggle to balance long-distance dependency modeling capabilities with industrial deployment efficiency. Therefore, this application proposes a fabric defect detection method based on a visual saliency model. This method specifically constructs a spatial detail extraction branch and a global information extraction branch. The former utilizes the local perception advantage of convolutional networks combined with an adaptive weighted context coordination mechanism to focus on capturing fine edges and texture abrupt changes on the fabric surface. The latter innovatively introduces a visual Mamba architecture, using a two-dimensional spatial selective scanning mechanism to efficiently model long-distance dependencies between pixels to resolve global texture patterns while maintaining linear computational complexity. Based on this, a bidirectional feature fusion decoder is used to perform deep concatenation and convolution smoothing of the two features in the channel dimension, which organically combines local high-frequency abnormal signals with global low-frequency semantic information. This effectively suppresses background noise interference while significantly enhancing the feature expression ability of multi-form, low-contrast defects, ultimately achieving high-precision and high-efficiency intelligent detection of fabric defects.

[0013] Figure 1 This is a flowchart of a fabric defect detection method based on a visual saliency model according to an embodiment of this application. Figure 2 This is a schematic diagram of the data flow in a fabric defect detection method based on a visual saliency model according to an embodiment of this application. Figure 1 and Figure 2 As shown, the fabric defect detection method based on the visual saliency model according to an embodiment of this application includes: S1, performing size normalization processing on the acquired original fabric image to be detected to obtain a preprocessed image tensor; S2, inputting the preprocessed image tensor into a spatial detail extraction branch to extract local spatial detail features to obtain a local detail feature map; S3, inputting the preprocessed image tensor into a global information extraction branch to perform long-distance dependency modeling and global context information capture on the preprocessed image tensor through the global information extraction branch to obtain a global context feature map; S4, performing bidirectional feature deep fusion on the local detail feature map and the global context feature map to obtain a fused feature representation; S5, using a terminal prediction convolutional layer to perform pixel-level probability mapping on the fused feature representation to obtain a fabric defect saliency map used to characterize the location and shape of the fabric defect.

[0014] Specifically, in step S1, the acquired original fabric image to be detected is subjected to size normalization processing to obtain a preprocessed image tensor. It should be noted that due to objective differences in the height, angle, and lighting conditions of fabric image acquisition equipment in industrial production environments, the acquired original fabric images exhibit inconsistent resolution and large fluctuations in pixel grayscale value distribution. Directly inputting such non-standardized data into a deep neural network would make it difficult for the model to perform batch tensor operations, and could lead to gradient vanishing or convergence lag due to drastic shifts in data distribution. Therefore, the technical solution of this application first introduces a size normalization based on bilinear interpolation and a numerical standardization preprocessing mechanism based on statistical distribution, forcing fabric images from different sources to be mapped to a unified spatial geometric scale and numerical distribution range. Through the above processing, the spatial dimensional differences and pixel dimension effects of the input data can be effectively eliminated, ensuring that the subsequent spatial detail extraction branch and global information extraction branch can receive tensor inputs with stable distributions, thereby improving the robustness and convergence efficiency of the model training process.

[0015] More specifically, in a specific example of this application, step S1 includes: performing size normalization processing on the original fabric image based on bilinear interpolation to obtain an intermediate size image based on a preset target size parameter; performing pixel value normalization processing on the intermediate size image; and performing decentering and scaling normalization on the normalized data to obtain a preprocessed image tensor.

[0016] More specifically, the target size parameter is first set according to the input layer configuration of the deep learning model, for example, 512×512 pixels. For the acquired original fabric images of arbitrary resolution, a bilinear interpolation algorithm is used to perform a size resampling operation. This operation determines the value of the target pixel by calculating the weighted average of the four adjacent pixels of the target pixel in the source image, thereby generating an intermediate-sized image with uniform size while maintaining the fabric texture structure features. Subsequently, pixel value normalization processing is performed on this intermediate-sized image, that is, the pixel intensity value of each channel of the image is divided by 255, so that its value range is linearly mapped to the floating-point range of 0 to 1. On this basis, the pre-calculated channel mean and standard deviation of the fabric dataset are further used to perform centering and scaling standardization processing on the normalized data, that is, subtracting the channel mean and dividing by the channel standard deviation, so that the numerical distribution of the output data approximately conforms to the standard normal distribution. Finally, the dimensional order of the image data is transposed, adjusting the channel dimension to the first dimension, and constructing a preprocessed image tensor that meets the network input requirements.

[0017] Specifically, in step S2, the preprocessed image tensor is input to the spatial detail extraction branch to extract local spatial detail features and obtain a local detail feature map. It should be noted that, given the diverse shapes, small sizes, and highly complex textures of fabric defects in actual industrial scenarios—such as holes and oil stains—these subtle defects are often hidden within regular warp and weft weave structures, making their edge information easily lost during the downsampling process of deep neural networks. Furthermore, overly complex backbone networks like ResNet introduce redundant parameters, increasing deployment difficulty. Based on this, the technical solution of this application further constructs a spatial detail extraction branch based on a convolutional neural network. The preprocessed image tensor is input to a truncated VGG16 backbone network, utilizing its first thirteen convolutional layers to extract a multi-scale pyramid feature set covering five different resolution levels. An adaptive weighted adjacent context coordination mechanism is introduced for each level of features. While expanding the local perception range using receptive field blocks and refining features through a joint attention mechanism, the features from the previous layer (downsampled by max pooling) and the features from the next layer (upsampled by bilinear interpolation) are respectively introduced for three-way adaptive weighted fusion. Through the above processing, high-frequency spatial texture details and weak defect edge information in fabric images can be effectively preserved. Through dynamic interaction and adaptive fusion of multi-scale contexts, the model's ability to represent defects of different sizes and irregular shapes is enhanced. While reducing computational complexity, the technical problem of easy omission of small targets is solved.

[0018] Figure 3 This is a flowchart illustrating the process of inputting a preprocessed image tensor into a spatial detail extraction branch to extract local spatial detail features and obtain a local detail feature map, according to an embodiment of the fabric defect detection method based on a visual saliency model. Figure 3 As shown, step S2 includes: S21, inputting the preprocessed image tensor into the truncated VGG16 backbone network to perform multi-scale pyramid feature extraction to obtain a multi-scale feature set with five different resolution levels; S22, for the current layer features in the multi-scale feature set, performing multi-dilation rate convolution on the current layer features using receptive field blocks and combining it with a joint attention mechanism for purification to obtain local enhancement features, while performing max pooling downsampling on the previous layer features to generate positive adjacent branch features, and performing bilinear interpolation upsampling on the next layer features to generate negative adjacent branch features, to obtain three feature groups to be fused; S23, performing adaptive weighted fusion on the three feature groups to be fused to obtain local detail feature maps.

[0019] In step S21, the preprocessed image tensor is input into a truncated VGG16 backbone network for multi-scale pyramid feature extraction to obtain a multi-scale feature set with five different resolution levels. It should be noted that due to the strict limitations on the real-time performance and deployment cost of detection algorithms in textile industry quality inspection sites, while complex architectures such as deep residual networks have strong feature extraction capabilities, their excessive depth and large number of parameters lead to excessive computational load. Furthermore, the presence of fully connected layers can destroy the spatial structure information of the image, limiting the ability to represent defects in fabrics of different sizes at multiple scales. Therefore, the technical solution of this application further selects the VGG16 network, which has a simple structure and strong generalization ability, as the backbone architecture. A truncated feature extraction network is constructed by removing its fully connected layers and terminal pooling layers, and its preceding convolutional layers are cascaded to extract a multi-scale feature set containing five different resolution levels. Through the above processing, the parameter size and computation time of the model can be effectively reduced. While preserving the original image spatial location information, it also takes into account the capture of fine-grained texture details and high-level semantic features, thereby improving the feasibility of the model deployment on industrial end-devices and the accuracy of multi-scale defect detection.

[0020] More specifically, in a concrete example of this application, the preprocessed image tensor generated in step S1 is used as input data and subjected to layer-by-layer convolution operations through a truncated VGG16 backbone network. This backbone network consists of thirteen convolutional layers and four max-pooling layers stacked alternately, and is divided into five consecutive convolutional blocks. During feature extraction, the data stream sequentially passes through each convolutional block, maintaining spatial resolution within each block while halving the feature map size between blocks using max-pooling operations. The output tensors of the last convolutional layer in each of the first to fifth convolutional blocks—namely, the outputs of Conv1-2, Conv2-2, Conv3-3, Conv4-3, and Conv5-3—are extracted as feature maps for the first to fifth levels. The first-level feature map retains high-resolution fabric surface texture details, while the fifth-level feature map aggregates abstract semantic information through multiple downsampling. Finally, these five sets of feature maps together constitute a multi-scale feature set, providing a rich source of information for subsequent interactions between local details and global context.

[0021] In step S22, for the current layer features in the multi-scale feature set, multi-dilution rate convolution is performed on the current layer features using receptive field blocks, and a joint attention mechanism is used for purification to obtain local enhanced features. Simultaneously, max pooling downsampling is performed on the previous layer features to generate positive adjacent branch features, and bilinear interpolation upsampling is performed on the subsequent layer features to generate negative adjacent branch features, resulting in a three-way feature set to be fused. It should be noted that because fabric defects have varying scales and irregular shapes, and the receptive field of a single convolution kernel is fixed, it is difficult to simultaneously capture subtle texture anomalies and fully cover large-scale background structures when extracting features. Furthermore, relying solely on the current layer features lacks contextual information from adjacent scales, easily leading to isolated and one-sided feature representations. Based on this, the technical solution of this application further targets the current layer features in the multi-scale feature set by performing multi-dilation rate convolution on the current layer features using receptive field blocks and combining it with a joint attention mechanism for purification to obtain local enhanced features. Simultaneously, max pooling downsampling is performed on the previous layer features to generate positive adjacent branch features, and bilinear interpolation upsampling is performed on the subsequent layer features to generate negative adjacent branch features, resulting in a three-way feature set to be fused. Through the above processing, the perceptual range of feature extraction can be effectively expanded and the weight of key information can be strengthened. At the same time, semantic and detailed information from adjacent layers is introduced for complementarity, solving the problems of insufficient feature information and background noise interference at a single scale, and providing rich and spatially aligned multi-dimensional feature support for subsequent high-precision defect localization.

[0022] More specifically, in a concrete example of this application, a local processing branch is first constructed for the feature map of the current layer. This branch introduces a receptive field block containing four dilated convolution branches. Differentiated combinations of dilation rates are configured based on the depth of the current feature layer. For example, a smaller combination of dilation rates is used for shallow features to focus on fine-grained local information, while a larger combination of dilation rates is used for deep features to cover a wider context. Subsequently, the features extracted from each branch are concatenated and summed element-wise. After processing the receptive field block, a joint attention mechanism is used to cleanse the features. This mechanism aggregates spatial information through global average pooling, compresses channels using convolutional layers, and generates attention weights, which are finally multiplied with the input features to suppress redundant texture noise in the fabric background and highlight defect areas. Meanwhile, to incorporate cross-layer contextual information, shallow feature maps preceding the current layer are acquired and subjected to max-pooling with a stride of two to reduce their spatial resolution to match that of the current layer, thereby generating positive neighbor branch features carrying rich edge details. Correspondingly, deep feature maps following the current layer are acquired and subjected to a 2x upsampling operation based on bilinear interpolation to enlarge their spatial size to align with that of the current layer, thereby generating negative neighbor branch features containing abstract semantic information. Finally, the processed local augmented features, positive neighbor branch features, and negative neighbor branch features are combined into three sets of feature tensors with completely identical spatial dimensions to be fused.

[0023] In step S23, the three feature groups to be fused are adaptively weighted and fused to obtain a local detail feature map. It should be noted that due to the high complexity and diversity of fabric textures, and the significant irregularities in size and shape of defects, simple fixed-ratio summation or averaging fusion methods cannot distinguish the differences in contribution of different levels of features to specific defect types. This results in crucial fine-grained defect information being easily submerged by background noise or becoming redundant. Therefore, the technical solution of this application further performs adaptive weighted fusion on the three feature groups to be fused to obtain a local detail feature map. Through the above processing, weights can be dynamically allocated according to the actual quality of the feature content, intelligently balancing the fusion ratio of local details, adjacent layer textures, and semantic information. This maximizes the preservation of discriminative features of defects while suppressing background interference, improving the model's adaptability to multi-scale defects.

[0024] More specifically, in a concrete example of this application, independent weight prediction paths are first configured for the local augmentation features, the forward adjacent branch features, and the backward adjacent branch features. These paths utilize a 1x1 convolution kernel to perform channel compression on the input feature tensor, then generate a spatial response distribution using a sigmoid activation function, and aggregate the feature maps into a single scalar form of raw weight values ​​using global average pooling to quantify the feature contribution of each branch. Based on this, the raw weight values ​​of the three features are normalized using a Softmax function to ensure that the sum of the weight coefficients of all branches is one, thereby constructing a relatively balanced fusion ratio parameter. Finally, the normalized weight coefficients are multiplied element-wise by the corresponding three feature tensors, and the weighted three feature tensors are summed. Simultaneously, to preserve the integrity of the original features and prevent gradient vanishing, the unweighted original local augmentation features are directly superimposed onto the weighted summation result via residual connections, ultimately generating a local detail feature map that integrates multi-scale contextual information.

[0025] Specifically, in step S3, the preprocessed image tensor is input to the global information extraction branch to perform long-distance dependency modeling and global context information capture on the preprocessed image tensor to obtain a global context feature map. It should be noted that, given the highly complex texture structure of fabric images, the periodic background formed by the crisscrossing warp and weft threads often occupies the main part of the image. Defects typically manifest as local anomalies that disrupt this global consistency. If feature extraction relies solely on local receptive fields, it is difficult to establish pixel relationships across a large spatial range, thus failing to effectively distinguish between normal texture fluctuations and real structural defects. Furthermore, conventional global modeling mechanisms often involve excessively high computational overhead. Therefore, the technical solution of this application further inputs the preprocessed image tensor to the global information extraction branch. Utilizing the integrated hybrid feature extraction unit within this branch, a two-dimensional spatial selective scanning mechanism is used to dynamically update the image feature sequence and perform long-distance dependency modeling, thereby capturing global context information from the preprocessed image tensor. Through the above processing, global semantic features reflecting the overall texture pattern of the fabric can be accurately extracted while maintaining linear computational complexity. This overcomes the limitations of local convolution operations in macroscopic structure perception and provides key global background constraint information for distinguishing complex backgrounds from minor defects.

[0026] Figure 4 This is a flowchart illustrating the process of inputting a preprocessed image tensor into a global information extraction branch to perform long-distance dependency modeling and global contextual information capture on the preprocessed image tensor to obtain a global contextual feature map, according to an embodiment of the present application's fabric defect detection method based on a visual saliency model. Figure 4As shown, step S3 includes: S31, inputting the preprocessed image tensor into the left branch of the hybrid feature extraction unit to perform multi-receptive field local feature enhancement to obtain the left branch local features; S32, inputting the preprocessed image tensor into the right branch of the hybrid feature extraction unit to perform two-dimensional spatial selective scanning modeling to obtain the right branch global features; S33, performing dual-branch feature channel cascading on the left branch local features and the right branch global features to obtain the global context feature map.

[0027] In step S31, the preprocessed image tensor is input into the left branch of the hybrid feature extraction unit for multi-receptive field local feature enhancement to obtain the left branch local features. It should be noted that since fabric defects often exhibit subtle and irregular spatial distributions, and the strong periodicity of background textures easily masks weak defect features, traditional single-scale convolution operations struggle to maintain low computational cost while accurately capturing multi-scale local context. This leads to the feature extraction process being easily affected by background noise and losing crucial edge details. Therefore, the technical solution of this application further constructs the left branch of the hybrid feature extraction unit, inputting the preprocessed image tensor into this branch. A cascaded multi-receptive field depth-separable convolution strategy is used to gradually expand the perception range, and a channel attention mechanism is combined to adaptively filter and weight the extracted local features. Through the above processing, fine-grained features containing multi-scale context can be effectively captured without significantly increasing the number of parameters. Furthermore, the ability to discriminate defect regions is enhanced by suppressing redundant channel responses, thereby providing high-quality local detail support for the construction of the global context feature map. More specifically, in a particular example of this application, the input preprocessed image tensor (denoted as ) is first processed... The feature extraction link is fed into the left branch and utilized... The depthwise separable convolutional kernel of a certain size performs preliminary processing on the input features to extract basic local texture features, followed by a convolutional kernel with a dilation rate of 2. Depthwise dilation of the separable convolution further expands the receptive field of feature extraction, thereby capturing multi-scale local contextual information while maintaining feature map resolution. After multi-scale feature extraction, a channel attention module is connected, which compresses spatial dimension feature information into channel descriptors through global average pooling, and utilizes two cascaded... Convolutional layers (containing ReLU activation functions in between) model the dependencies between channels, and finally, a channel attention weight map is generated via a Sigmoid activation function. This weight map is applied to the feature tensor element-wise to enhance highly discriminative feature channels and suppress irrelevant background noise. Finally, a residual connection is used to connect the attention-purified features to the original input tensor. Element-by-element stacking is performed to generate the final left-branch local features. The computational process involved in this step can be represented as follows: ; in, This represents the local features of the left branch of the output. This represents the input preprocessed image tensor. This indicates an element-wise addition operation (residual join). This indicates the channel attention mechanism operation. Indicates an expansion rate of 2 Depth-dilation separable convolution express Depthwise separable convolution.

[0028] In step S32, the preprocessed image tensor is input into the right branch of the hybrid feature extraction unit for two-dimensional spatial selective scanning modeling to obtain the global features of the right branch. It should be noted that, given the highly complex texture structure of fabric images, where warp and weft threads intertwine to form global patterns with long-distance dependencies, traditional convolutional neural networks, limited by their local receptive fields, struggle to capture such texture patterns spanning a large spatial range. This results in limitations in distinguishing between normal texture fluctuations and destructive defects, and simply introducing the Transformer architecture would impose an unbearable computational load. Therefore, the technical solution of this application further inputs the preprocessed image tensor into the right branch of the hybrid feature extraction unit, utilizing the visual state space model technology integrated in this branch, particularly the two-dimensional spatial selective scanning mechanism, to dynamically update the state of the image feature sequence and capture global contextual information while maintaining linear computational complexity. Through the above processing, semantic relationships between distant pixels in the image can be effectively established, and the global texture consistency features of the fabric surface can be accurately analyzed, thereby compensating for the shortcomings of the local detail extraction branch in macroscopic structural perception and providing crucial global semantic constraints for subsequent feature fusion.

[0029] More specifically, in a concrete example of this application, the input preprocessed image tensor is first fed into the linear projection layer of the right branch to map the feature channel dimensions to a preset dimensional space for alignment. Then, using... Depthwise separable convolutions process the features, and the SiLU activation function introduces nonlinearity to supplement necessary local neighborhood information before entering the global scan. Based on this, the core 2D spatially selective scanning operation is performed: this operation unfolds the 2D feature map into a one-dimensional sequence along four different directions (top left, bottom right, top right, bottom left). For each direction's sequence, a discretized state-space equation is used for recursive scanning and state updates to capture long-range dependencies in the sequence. The output sequences from the four directions are then merged back to restore the 2D feature map. The feature tensor after SS2D processing undergoes distribution adjustment through layer normalization and is element-wise multiplied with the output of a parallel gated branch consisting of a linear layer and the SiLU activation function to achieve gating modulation of the features. Finally, a linear layer projects the features back to the original channel dimension, generating the right-branch global features. The computational process involved in this step can be represented as follows: ; in, This represents the global features of the right branch of the output. This represents the input preprocessed image tensor. Indicates a linear projection layer. This represents a two-dimensional selective scan operation, which internally includes the discretization parameter update of the state-space model and sequential scanning. This represents the SiLU activation function. express Depthwise separable convolution.

[0030] In step S33, the local features of the left branch and the global features of the right branch are concatenated in a dual-branch feature channel to obtain a global context feature map. It should be noted that, due to the highly complex local texture details and global structural dependencies in fabric images, a single feature extraction path often struggles to simultaneously capture the edges of minute defects and fully model the overall texture patterns. If local and global features are processed independently without interaction, the subsequent feature decoding process lacks multi-dimensional semantic support, making it difficult to highlight abnormal targets while suppressing background noise. Therefore, the technical solution of this application further performs a channel-dimensional physical concatenation of the local fine-grained features output from the left branch and the global context features output from the right branch in the hybrid feature extraction unit. Through this processing, multi-scale local texture information extracted based on convolution and long-distance global dependencies captured based on the state-space model can be integrated into a unified feature tensor, thereby endowing the model with the ability to simultaneously perceive local anomalies and global consistency, providing feature representations rich in complementary information for subsequent fabric defect detection.

[0031] More specifically, in a concrete example of this application, the local features of the left branch extracted using multi-receptive field convolution and channel attention mechanisms are obtained, denoted as... This feature is rich in fine-grained edge information after background suppression; simultaneously, the global features of the right branch, modeled using a two-dimensional spatial selective scanning mechanism, are obtained, denoted as... This feature contains long-range contextual dependency information of the fabric image. Subsequently, a tensor concatenation operation is performed, stacking the two spatially resolution-consistent feature tensors along the channel axis, so that the number of channels in the output feature map becomes the sum of the number of channels in the two input features. This step aims to fuse multi-level information from different architectural branches, and its computation process can be represented as follows: ,in This indicates a channel cascading operation. This results in the final global context feature map, which contains both local and global semantics.

[0032] Specifically, in step S4, a bidirectional deep feature fusion is performed on the local detail feature map and the global context feature map to obtain a fused feature representation. It should be noted that while the spatial detail extraction branch of the convolutional neural network excels at capturing the edges and textures of minute defects, it lacks semantic understanding of the overall image structure. Conversely, while the global information extraction branch based on the visual state space model can establish long-distance dependencies, it easily ignores fine-grained spatial information. The features generated by these two methods differ significantly in distribution patterns and semantic levels. If they cannot be effectively fused, the model will struggle to simultaneously suppress the background and highlight the target. Therefore, the technical solution of this application further performs a bidirectional deep feature fusion of the local detail feature map and the global context feature map. First, the spatial resolution and distribution of the two feature paths are unified through dimensionality transformation and normalization. Then, bidirectional concatenation is performed along the channel dimension to integrate multi-level, multi-scale features into a unified format. Finally, convolutional layers are used to smooth and enhance the correlation of the concatenated feature tensors. Through the above processing, the complementarity and deep integration of local high-frequency details and global low-frequency semantics can be effectively achieved. While enhancing the feature correlation between channels, the spatial dimension is smoothed, thereby constructing a fusion feature representation that contains both accurate defect morphology and strong background constraint, solving the problem of insufficient expressive power of single features.

[0033] Figure 5 This is a flowchart illustrating the bidirectional deep feature fusion of local detail feature maps and global context feature maps to obtain a fused feature representation in the fabric defect detection method based on a visual saliency model according to embodiments of this application. Figure 5As shown, step S4 includes: S41, performing feature space alignment and normalization on the local detail feature map and the global context feature map to obtain aligned local features and aligned global features; S42, bidirectionally concatenating the aligned local features and aligned global features along the channel axis to obtain a coarse fusion tensor containing complementary information; S43, performing convolutional smoothing and correlation enhancement on the coarse fusion tensor to obtain a fused feature representation.

[0034] In step S41, the local detail feature map and the global context feature map are aligned and normalized in feature space to obtain aligned local features and aligned global features. It should be noted that, since the spatial detail extraction branch is based on a convolutional neural network architecture, while the global information extraction branch is based on a visual state space model architecture, the inherent differences in their feature extraction mechanisms lead to inherent inconsistencies in channel dimension, spatial resolution, and feature response distribution between the generated local detail feature map and global context feature map. Direct physical concatenation would cause dimensionality mismatch errors and gradient optimization conflicts due to numerical distribution shifts. Therefore, the technical solution of this application further performs feature space alignment and normalization on the local detail feature map and global context feature map. Through the above processing, the feature distribution differences and dimensionality barriers between heterogeneous network branches can be effectively eliminated, ensuring strict compatibility of the two features in spatial geometry and channel hierarchy, providing a numerically stable unified input benchmark for subsequent bidirectional feature deep fusion.

[0035] More specifically, in a particular example of this application, the local detail feature map (denoted as ) output by the spatial detail extraction branch is first obtained. ) and the global context feature map output by the global information extraction branch (denoted as ) The spatial resolution of the two sets of feature maps is validated. If a size difference exists, bilinear interpolation upsampling is performed on the lower-resolution feature map, or stride convolution / pooling downsampling is performed on the higher-resolution feature map to ensure its height and width dimensions are strictly aligned with the target size. Subsequently, a dimensionality transformation operation is performed to construct projection layers for each of the two feature paths, for example, using... The convolutional kernel performs channel mapping on the feature tensor, adjusting the number of channels in the local detail feature map and the global context feature map to a preset uniform dimension. After completing the spatial and channel alignment, a normalization operation (such as batch normalization) is further introduced to standardize the numerical distribution of the projected feature tensor, that is, rescaling the feature values ​​to make them fall into a uniform numerical range, thereby eliminating the dimensional differences caused by different extraction sources, and finally generating aligned local features and aligned global features.

[0036] In step S42, the aligned local features and aligned global features are bidirectionally concatenated along the channel axis to obtain a coarse fusion tensor containing complementary information. It should be noted that the spatial detail extraction branch based on convolutional neural networks and the global information extraction branch based on visual state space models exhibit drastically different levels of feature abstraction. The former focuses on high-frequency spatial details of the fabric surface, such as defect edges, while the latter focuses on low-frequency global semantic context. Simply relying on a single branch or performing simple element-wise addition will inevitably lead to the loss of key complementary information or the suppression of weak defect signals by strong background textures. Therefore, the technical solution of this application further concatenates the aligned local features and aligned global features along the channel axis to obtain a coarse fusion tensor containing complementary information. Through the above processing, heterogeneous features from different extraction mechanisms can be physically stacked at corresponding spatial positions, thereby constructing a complete feature set that combines fine-grained local texture anomalies with long-distance global dependency constraints, providing a rich and complete information foundation for subsequent feature fusion and defect localization.

[0037] More specifically, in a particular example of this application, a local feature map that has undergone spatial alignment and normalization (denoted as...) is used. ) and global feature map (denoted as Using the input data, the channel concatenation function is called to perform a tensor stacking operation. This operation concatenates the two feature tensors along the depth direction (channel axis) while maintaining the height and width spatial resolution of the feature maps, thus expanding the channel dimension of the output tensor to the sum of the number of channels in the two input tensors. This process aims to integrate the multi-scale local details extracted by the CNN architecture with the global context information captured by the Mamba architecture into a unified tensor format, forming a coarsely fused tensor. The mathematical expression for this logical operation is as follows: ,in This indicates a cascading operation along the channel dimension. Features representing branches derived from global information extraction This represents the features derived from the spatial detail extraction branch. The coarse fusion tensor directly preserves the original dual-path feature information without any weight compression or filtering, thus providing a rich foundation containing the original complementary information for subsequent convolutional layers to perform cross-channel information interaction and smoothing processing.

[0038] In step S43, the coarse fusion tensor is subjected to convolutional smoothing and correlation enhancement to obtain a fused feature representation. It should be noted that, given that the coarse fusion tensor generated through channel concatenation is merely a physical stack of features from the spatial detail extraction branch and the global information extraction branch, the two remain relatively independent in terms of feature distribution, semantic hierarchy, and frequency domain attributes. This results in a lack of necessary nonlinear interaction between channels, and the directly stitched feature maps often contain abrupt, unsmooth regions in space. If used directly for prediction, it is difficult to fully exploit the complementary relationship between local texture and global background. Based on this, the technical solution of this application further performs convolutional smoothing and correlation enhancement on the coarse fusion tensor, utilizing the sliding window mechanism of the convolutional layer to aggregate and smooth neighborhood information in the spatial dimension, while simultaneously using convolutional weights to perform weighted combination and recombination of features in the channel dimension. Through the above processing, the semantic discontinuity of feature splicing boundaries can be effectively eliminated. While compressing redundant spatial dimensions, the feature correlation between channels can be strengthened. This allows for the deep integration of high-frequency defect details extracted by CNN with low-frequency global texture dependencies captured by Mamba, constructing a fusion feature representation with strong semantic consistency and accurate expression. This provides a robust feature foundation for the subsequent generation of high-precision fabric defect saliency maps.

[0039] Figure 6 This is a flowchart illustrating the process of convolutional smoothing and correlation enhancement of a coarse fusion tensor to obtain a fused feature representation in a fabric defect detection method based on a visual saliency model according to embodiments of this application. Figure 6 As shown, step S43 includes: S431, performing feature decoupling and difference interaction modeling on the coarse fusion tensor to obtain a semantic difference descriptor; S432, performing adaptive confidence gating on the semantic difference descriptor to obtain a spatial confidence gating; S433, based on the spatial confidence gating, performing difference-guided residual reconstruction fusion on the semantic difference descriptor and the coarse fusion tensor to obtain a fused feature representation.

[0040] In step S431, feature decoupling and differential interaction modeling are performed on the coarse fusion tensor to obtain a semantic difference descriptor. It should be noted that, given that fabric defects often exist in areas where local rules violate global patterns, simple feature superposition is insufficient to distinguish between normal texture fluctuations and true defects. Furthermore, the coarse fusion tensor contains mixed information and lacks a direct measure of the degree of rule disruption. Therefore, the technical solution of this application further performs feature decoupling and differential interaction modeling to explicitly quantify the degree of conflict between local details and the global background, and to generate a semantic difference descriptor. Through the above processing, it can act like a differential amplifier, extracting abnormal signals hidden in the texture and constructing a feature map highly sensitive to the degree of disruption. This provides precise guidance signals for subsequent gating mechanisms, effectively enhancing the model's ability to perceive subtle defects in complex backgrounds.

[0041] More specifically, in a concrete example of this application, the input tensor data is first split along the channel dimension, thus first separating the input coarse fused tensor. Restored to local feature components along the channel dimension and global feature components This achieves physical and logical decoupling of features. Subsequently, to capture semantic conflicts between the two, a bidirectional differential interaction operator is introduced to calculate the local deviation from the global and the global correction from the local, respectively. Before performing the differential calculation, a feature transformation function is used... (usually) Convolution is used to process the global feature components to align the global and local feature distributions, ensuring consistency with the comparison benchmark. Next, the aligned feature differences are calculated, and the positive responses are extracted using the ReLU activation function and then superimposed. This step is represented as follows: ; in, Represents semantic difference descriptors, Indicates from Extracted local feature components, Indicates from Extracted global feature components, The feature transformation function (usually) Convolution (or convolution) is used to align global feature distributions. To correct the linear unit activation function. Taking the detection of jacquard fabrics with regular geometric textures as an example, when there are tiny warp breaks on the fabric surface, the global feature components... It can reconstruct the complete meridian texture trend based on long-distance dependence, while local feature components This will accurately record the pixel abrupt changes at the break point; in normal texture areas, the difference between the two is close to 0, while at the break point, the strong difference between the two will be captured and amplified by the bidirectional difference and activation operations in the above formula, resulting in a semantic difference descriptor. The defect area is highlighted, while the background area remains suppressed.

[0042] In step S432, the semantic difference descriptor is adaptively gated to obtain spatial confidence gating. It should be noted that not all differences are defects; background noise can also cause differences. While the semantic difference descriptor calculated in the previous steps can capture local and global inconsistencies, it cannot distinguish whether such inconsistencies stem from actual defects or random background texture fluctuations. Therefore, a mechanism is needed to evaluate the confidence level of the differences. Based on this, the technical solution of this application further performs adaptive confidence gating generation, adjusting the semantic difference descriptor with adaptive confidence gating to obtain spatial confidence gating. Through the above processing, pixel-level weighted coefficients can be generated, thereby endowing the model with selective attention capabilities that focus on anomalies and ignore the background, ensuring that subsequent feature enhancement only applies to high-confidence defect regions and avoiding erroneous enhancement of background noise.

[0043] More specifically, in a particular example of this application, the semantic difference descriptor is first... Input to the feature compression layer, using Convolutional processing compresses the channel information of semantic difference descriptors, thereby reducing the number of parameters and extracting key feature channels. The compressed feature map is then input into the spatial perception layer, and then... Convolutional perceptualization (CPS) assesses spatial neighborhood context by examining the correlation between the center pixel and surrounding pixels to determine the connectivity and structure of differences, thus eliminating isolated noise points. Finally, a sigmoid activation function is used to generate... Spatial confidence gating of intervals This step is described as follows: ; in, Indicates spatial confidence gating. This represents the Sigmoid activation function. and These represent convolution operations with different kernel sizes. In practical detection scenarios, such as for plain-weave fabrics with oil stains on the surface, the oil stain area will produce a high semantic difference value due to the color abrupt change, and since oil stains usually occupy a certain continuous spatial area, Convolution can perceive this neighborhood consistency, thus outputting a high-confidence gating value close to 1. Conversely, for random cotton knots or fly noise on the fabric surface, although they also produce slight semantic differences, their spatial distribution is discrete and irregular, so spatially perceptive convolution will output a low response. Finally, after being activated by Sigmoid, a gating value close to 0 is generated, which can be effectively filtered in subsequent fusion.

[0044] In step S433, based on spatial confidence gating, difference-guided residual reconstruction fusion is performed on the semantic difference descriptor and the coarse fusion tensor to obtain the fused feature representation. It should be noted that, although the coarse fusion tensor contains the original information, it lacks explicit focus on anomalous regions, and simply superimposing difference features may introduce background noise, causing the model to generate false positives in flat regions. Therefore, the technical solution of this application further performs difference-guided residual reconstruction fusion to safely inject the extracted high-value difference information back into the main feature stream, completing the final feature enhancement. Through the above processing, a combination of soft and hard approaches to feature fusion can be effectively achieved. That is, in flat background regions, the residual term is close to 0, and the model retains smoothness characteristics to reduce false positives; in complex defect regions, the residual term is activated, and the model forcibly enhances feature contrast, thereby synthesizing a feature map that has both background suppression capabilities and high-sharp defect edges, directly improving the accuracy of saliency map generation.

[0045] More specifically, in a concrete example of this application, a gated residual mechanism is employed to perform the fusion operation. First, spatial confidence gating is used. semantic difference descriptors Weighting is performed to obtain the purified difference features. This process essentially involves filtering out noise components from the difference map using a confidence map. Next, this purified difference feature is used as a residual term and multiplied by a learnable factor. Then, it is combined with the main feature stream. Simultaneously, the input coarse fusion tensor undergoes basic convolution smoothing, typically using... Convolutional processing combined with the SiLU activation function extracts backbone features while preserving spatial continuity. Finally, the weighted residual terms are superimposed onto the coarse fusion tensor smoothed by the basic convolutions to generate the final fused feature representation. The mathematical expression for this step can be represented as: ; in, This represents the fused feature representation of the final output. This represents the learnable scaling factor. This indicates an element-wise multiplication operation. This represents the Swish activation function. The input is a coarse fusion tensor. Taking the detection of minor oil stains on twill denim as an example, the twill background has a strong periodic texture, and direct processing easily generates a large amount of high-frequency noise. Under this fusion mechanism, for large areas of normal twill background, due to spatial confidence gating... The value of approaches 0, making the semantic difference descriptor Texture fluctuations are suppressed, and the residual term is close to zero. At this point, the output mainly relies on the smoothed main feature flow, thus avoiding misclassifying normal diagonal lines as defects. For oil stain areas, although their contrast is low, the confidence gating is affected because it disrupts local texture consistency. Being in a high-activation state allows the differential features of this region to be preserved and transmitted through factors. By magnifying and overlaying, the salience of the oil stain area in the final feature map is forcibly improved, achieving accurate detection under complex texture interference.

[0046] Specifically, in step S5, the fused feature representation is subjected to pixel-level probability mapping using an end-predictive convolutional layer to obtain a fabric defect saliency map characterizing the location and morphology of fabric defects. It should be noted that although the fused feature representation constructed in the preceding steps has achieved deep integration of local high-frequency details and global low-frequency semantics within the feature space, its data form is still a high-dimensional abstract tensor, making it difficult to directly quantify the specific probability that each pixel on the fabric surface belongs to a defect category. Furthermore, industrial-grade fabric detection requires algorithms to output pixel-level segmentation masks with clear physical boundaries to address the precise location requirements of irregular defects such as holes and oil stains. Based on this, the technical solution of this application further utilizes an end-predictive convolutional layer to perform pixel-level probability mapping calculation on the fused feature representation. Through dimensionality reduction projection and nonlinear activation operations, the feature response values ​​are transformed into spatially distributed saliency probability values ​​to generate a fabric defect saliency map characterizing the location and morphology of fabric defects. Through the above processing, the abstract features extracted by the deep neural network can be effectively decoded into an intuitive visual saliency distribution, realizing pixel-level segmentation and localization of small and complex morphological defects, thereby reducing the false detection rate and providing accurate quantitative basis for subsequent automated quality grading and defect labeling.

[0047] More specifically, in a specific example of this application, step S5 includes: inputting the fused feature representation into the terminal convolutional layer for pixel-level probability mapping to obtain an initial predicted saliency map; setting a saliency threshold, and performing pixel-by-pixel threshold judgment and binarization segmentation on the initial predicted saliency map to obtain a fabric defect saliency map.

[0048] Accordingly, the fused feature representation is input into the terminal convolutional layer for pixel-level probability mapping to obtain the initial predicted saliency map. It should be noted that although the fused feature representation output by the bidirectional feature fusion decoder achieves deep integration of local high-frequency details and global low-frequency semantics within the feature space, its essence remains a multi-channel, high-dimensional abstract feature tensor. It cannot be directly used as an intuitive basis for quantifying the probability of each pixel on the fabric surface belonging to a defect category. Furthermore, industrial-grade fabric inspection requires algorithms to output pixel-level prediction results with clear physical boundaries to address the precise localization needs of irregular defects such as holes and oil stains. Based on this, the technical solution of this application further utilizes the terminal prediction convolutional layer to perform pixel-level probability mapping calculation on the fused feature representation. Through the above processing, the abstract features extracted by the deep neural network can be effectively decoded into spatially distributed saliency probability values, achieving pixel-level segmentation and localization of small and complex morphological defects, thus providing an accurate data foundation for subsequent binarization segmentation and automated quality grading.

[0049] More specifically, in a particular example of this application, the fused feature representation output by the bidirectional feature fusion decoder is first obtained, denoted as... This feature representation aggregates defect feature information enhanced by difference-guided and residual reconstruction. Subsequently, this fused feature representation is fed into a kernel with a kernel size of... The final convolutional layer compresses the channel dimension of the feature tensor from high dimension to a single channel through convolution operations, thereby aggregating the information of all feature channels to form a single-channel feature response map. Next, a Sigmoid activation function is applied to this single-channel feature response map, non-linearly mapping the value of each pixel to a floating-point number between 0 and 1, quantifying the confidence that the pixel belongs to a fabric defect. Finally, to ensure that the output saliency map maintains spatial consistency with the original input image, a bilinear interpolation algorithm is used to upsample the probability-mapped feature map, restoring its spatial resolution to a target size of 512×512, thus generating an initial predicted saliency map. The computational process involved in this step can be represented as follows: ,in, This represents the generated initial prediction saliency map. This indicates a bilinear interpolation upsampling operation. This represents the Sigmoid activation function. express Convolution operation, The input is a fusion feature representation.

[0050] Accordingly, a saliency threshold is set, and the initial predicted saliency map is subjected to pixel-by-pixel threshold judgment and binarization segmentation to obtain a fabric defect saliency map. It should be noted that since the pixel values ​​in the initial predicted saliency map only represent the probability confidence that the location belongs to a fabric defect, they present a continuous floating-point number distribution between zero and one, lacking clear physical boundary definition. This cannot directly meet the binarization requirements for accurate measurement, cutting, and grading of defect areas in industrial settings. Based on this, the technical solution of this application further sets a saliency threshold, performing pixel-by-pixel threshold judgment and binarization segmentation on the initial predicted saliency map. Through the above processing, the fuzzy probability distribution can be effectively transformed into a definite binary mask, clearly separating the defect foreground from the fabric background, eliminating low-confidence prediction noise, and thus generating a fabric defect saliency map with clear geometric shape and positional coordinates.

[0051] More specifically, in a concrete example of this application, a scalar saliency threshold is first set based on the tolerance for false positives and false negatives in the actual fabric detection scenario. This threshold can be set to 0.5. Then, each pixel in the initial predicted saliency map is traversed, its corresponding predicted probability value is read, and this predicted value is compared with the set saliency threshold. If the predicted value of the current pixel is greater than the saliency threshold, the pixel is determined to belong to a defect area, and its pixel value is assigned a value of one; conversely, if the predicted value of the current pixel is less than or equal to the saliency threshold, the pixel is determined to belong to the normal fabric background, and its pixel value is assigned a value of zero. This binarization logic can be represented as a piecewise function relationship where the output is one when the predicted value is greater than the threshold and zero otherwise. After completing the pixel-by-pixel threshold judgment, to further improve the connectivity and noise resistance of the detection results, morphological opening operations are performed on the generated binary image, i.e., erosion followed by dilation, to remove isolated noise points and smooth defect edges, ultimately outputting a fabric defect saliency map to characterize the location and shape of fabric defects.

[0052] Specifically, in one particular training and evaluation embodiment of this application, the constructed deep learning model is implemented based on the PyTorch framework and trained end-to-end on a high-performance computing workstation equipped with an NVIDIA RTX 4090 graphics processing unit. For training hyperparameter settings, the Adam optimizer is used for iterative updates of the network parameters, and the initial learning rate is set to [value missing]. And set the weight decay coefficient to To prevent overfitting, a multinomial learning rate decay strategy is introduced to dynamically adjust the learning step size. The batch size is set to 8, and the total number of iterations is set to 100 to ensure sufficient convergence of the model in the complex solution space. During the inference and testing phases, the input images are uniformly adjusted to... The standard size of the model output probability saliency map is restored to the original resolution using bilinear interpolation, and 0.5 is used as the significance threshold. The final binary defect mask is generated. To quantitatively evaluate the model's performance in fabric defect detection, precision, recall, F1 score, and mean intersection-over-union ratio (mIoU) are selected as core evaluation metrics. Among them, mIoU is used to measure the geometric overlap between the predicted defect region and the true labeled region, while the F1 score comprehensively reflects the model's ability to balance precision and recall, thereby verifying the technical advantages of this dual-branch architecture in suppressing strong textured background interference and capturing small defects.

[0053] In summary, the fabric defect detection method based on a visual saliency model according to the embodiments of this application is explained. First, the input original fabric image is preprocessed to construct a standard input tensor, which is then input in parallel into a dual-branch feature extraction network. The spatial detail extraction branch utilizes a truncated convolutional neural network and an adaptive weighted adjacent context coordination mechanism to focus on capturing multi-scale local texture and edge details. The global information extraction branch relies on a hybrid feature extraction unit and two-dimensional spatial selective scanning technology to perform long-distance dependency modeling of the image to grasp global background patterns. Through a bidirectional feature fusion decoder, the aforementioned local details and global context features are deeply aligned and cascaded in the channel dimension. Convolutional smoothing is used to generate fused features rich in complementary information, which are finally mapped through the terminal prediction layer to obtain a pixel-level fabric defect saliency map. This scheme effectively overcomes the suppression of weak defect signals by complex texture backgrounds through complementary enhancement of local and global information, improving the detection accuracy and robustness of low-contrast and multi-scale defects.

[0054] As described above, the fabric defect detection method based on the visual saliency model according to the embodiments of this application can be implemented in various industrial vision inspection and intelligent manufacturing platforms, such as automatic fabric inspection machines on textile production lines, intelligent textile factory control centers, or industrial vision quality inspection workstations. In one possible implementation, this method can be integrated into an industrial machine vision system or textile production execution system as a high-precision defect recognition engine or automated quality control component. For example, the method can be a standalone fabric defect detection application running on an industrial control computer, or it can be an algorithm function plug-in and deep learning inference module of existing machine vision software, or a quality management service deployed in the cloud and receiving image data via network for offline analysis; of course, the image preprocessing, bi-branch feature extraction, bi-directional feature fusion, and saliency map generation modules in this method can also run in embedded vision sensors, intelligent industrial cameras, or edge computing boxes equipped with AI acceleration chips, serving as the underlying visual inference base of the intelligent quality inspection system.

[0055] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for detecting fabric defects based on a visual saliency model, characterized in that, include: S1: Perform size normalization on the acquired original fabric image to be detected to obtain the preprocessed image tensor; S2: Input the preprocessed image tensor into the spatial detail extraction branch to extract local spatial detail features and obtain a local detail feature map; S3: Input the preprocessed image tensor into the global information extraction branch to perform long-distance dependency modeling and global context information capture on the preprocessed image tensor to obtain the global context feature map; S4: Perform bidirectional deep feature fusion on the local detail feature map and the global context feature map to obtain the fused feature representation; S5: Pixel-level probability mapping of the fused feature representation is performed using the terminal prediction convolutional layer to obtain a fabric defect saliency map that characterizes the location and morphology of fabric defects.

2. The fabric defect detection method based on a visual saliency model according to claim 1, characterized in that, Step S1 includes: Based on the preset target size parameters, the original fabric image is subjected to size normalization processing based on bilinear interpolation to obtain an intermediate size image; The pixel values ​​of the intermediate-sized image are normalized, and the normalized data is then decentered and scaled to obtain a preprocessed image tensor.

3. The fabric defect detection method based on a visual saliency model according to claim 1, characterized in that, Step S2 includes: The preprocessed image tensor is input into the truncated VGG16 backbone network for multi-scale pyramid feature extraction to obtain a multi-scale feature set at five different resolution levels. For the current layer features in the multi-scale feature set, the receptive field block is used to perform multi-dilution rate convolution on the current layer features and combined with the joint attention mechanism to clean up the features to obtain local enhanced features. At the same time, the previous layer features are downsampled by max pooling to generate positive adjacent branch features, and the next layer features are upsampled by bilinear interpolation to generate negative adjacent branch features, so as to obtain three feature groups to be fused. Adaptive weighted fusion is performed on the three feature groups to be fused to obtain local detail feature maps.

4. The fabric defect detection method based on a visual saliency model according to claim 1, characterized in that, Step S3 includes: The preprocessed image tensor is input into the left branch of the hybrid feature extraction unit to perform multi-receptive field local feature enhancement to obtain the local features of the left branch; The preprocessed image tensor is input into the right branch of the hybrid feature extraction unit to perform two-dimensional spatial selective scanning modeling to obtain the global features of the right branch; The local features of the left branch and the global features of the right branch are concatenated in a bi-branch feature channel to obtain a global context feature map.

5. The fabric defect detection method based on a visual saliency model according to claim 1, characterized in that, Step S4 includes: The local detail feature map and the global context feature map are aligned and normalized in feature space to obtain aligned local features and aligned global features; Along the channel axis, the aligned local features and aligned global features are bidirectionally concatenated along their channel dimensions to obtain a coarse fusion tensor containing complementary information. Convolutional smoothing and correlation enhancement are applied to the coarse fusion tensor to obtain the fusion feature representation.

6. The fabric defect detection method based on a visual saliency model according to claim 1, characterized in that, Step S5 includes: The fused feature representation is input into the terminal convolutional layer for pixel-level probability mapping to obtain the initial predicted saliency map; A saliency threshold is set, and the initial predicted saliency map is subjected to pixel-by-pixel threshold judgment and binarization segmentation to obtain the fabric defect saliency map.

7. The fabric defect detection method based on a visual saliency model according to claim 5, characterized in that, Convolutional smoothing and correlation enhancement are applied to the coarse fusion tensor to obtain the fusion feature representation, including: Feature decoupling and differential interaction modeling are performed on the coarse fusion tensor to obtain semantic differential descriptors; Adaptive confidence gating is applied to semantic difference descriptors to obtain spatial confidence gating; Based on spatial confidence gating, a difference-guided residual reconstruction fusion is performed on semantic difference descriptors and coarse fusion tensors to obtain fused feature representations.