A Deep Learning-Based Intelligent Defect Detection Method for Textiles

By employing background normalization and a lightweight deep learning network with multi-task collaboration, this study solves the problems of defect detection in textiles under complex backgrounds and the detection of small objects of multiple categories, achieving efficient and real-time defect detection that is suitable for embedded device deployment.

CN122089650APending Publication Date: 2026-05-26WUYI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUYI UNIV
Filing Date
2026-01-15
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing methods for detecting defects in textiles have difficulty recognizing defects against complex texture backgrounds, have low accuracy in detecting defects of multiple categories and small targets, and have a large number of model parameters that are not lightweight and efficient in deployment.

Method used

A background normalization algorithm is used to reduce interference from complex texture backgrounds. A lightweight deep learning detection network with multi-task collaboration is constructed, including an improved ShuffleNetV2 structure and a feature pyramid enhancement module. A phased training strategy and an adaptive hard sample mining loss function are combined, and model compression is achieved through layer fusion and quantization techniques.

Benefits of technology

It significantly improves the ability to identify defects in complex backgrounds, increases the detection accuracy and recall rate of multi-category and small-target defects, reduces hardware resource consumption, and achieves efficient and real-time defect detection, making it suitable for embedded device deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122089650A_ABST
    Figure CN122089650A_ABST
Patent Text Reader

Abstract

This invention relates to the field of textile quality inspection technology. It discloses a deep learning-based intelligent defect detection method for textiles, comprising the following steps: S1, acquiring textile images containing various defect types and constructing an image dataset, wherein the dataset includes images with complex textured backgrounds; S2, preprocessing the images in the dataset. This invention achieves a significant performance improvement in textile defect detection through end-to-end optimization. The background normalization algorithm and improved network structure efficiently extract multi-scale features. The dual-branch detection head, coupled with a dedicated training strategy, overcomes the challenges of detecting complex background interference, small targets, and multiple types of defects, significantly improving accuracy and recall. After layer fusion and quantization compression, the model is adapted for embedded deployment, balancing real-time performance and accuracy, providing a standardized intelligent quality control solution for the textile industry and helping enterprises improve quality and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of textile quality inspection technology, specifically to a deep learning-based intelligent defect detection method for textiles. Background Technology

[0002] As an essential component of daily life and industrial production, the quality of textiles directly impacts product performance and market competitiveness. Various defects, such as broken yarns, stains, and holes, are inevitable during the textile production process. These defects lower product quality and affect business profits. Therefore, defect detection in textiles has always been a crucial aspect of quality control in the textile industry.

[0003] In recent years, with the rapid development of artificial intelligence technology, deep learning has made breakthroughs in the field of computer vision, especially in tasks such as object detection, image classification and segmentation. Currently, many scholars have applied deep learning models to textile defect detection. For example, some studies have used the Faster R-CNN model and improved the Region Generation Network (RPN) to effectively improve detection accuracy in cases of small targets and imbalanced samples; other studies have used the Cascade R-CNN network, introducing variable convolution and multi-scale feature fusion mechanisms to achieve high-precision identification and localization of various defect types; in addition, single-stage detection models such as SSD and YOLO, due to their fast detection speed and simple structure, have also been applied in real-time defect detection. These methods have shown significant advantages in accuracy and detection speed, promoting the development of textile defect detection towards intelligence and efficiency.

[0004] Nevertheless, existing methods still face challenges in areas such as defect recognition in complex texture backgrounds, simultaneous detection of multiple types of defects, lightweight models, and deployment efficiency. Therefore, we propose a deep learning-based intelligent defect detection method for textiles to address these issues. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a deep learning-based intelligent defect detection method for textiles, which solves the problems of existing methods such as difficulty in defect identification in complex texture backgrounds, low accuracy in detecting multi-category and small-target defects, imbalanced samples, large number of model parameters, insufficient lightweight design, and inefficient deployment.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a deep learning-based intelligent defect detection method for textiles, comprising the following steps: S1. Collect textile images containing various defect types and construct an image dataset, the dataset containing images with complex textured backgrounds; S2. Preprocess the images in the dataset to reduce interference from complex textured backgrounds; the preprocessing uses a background normalization algorithm, which can analyze and suppress local texture features of the image, thereby enhancing the contrast between defective areas and the background. S3. Construct a lightweight deep learning detection network for multi-task collaboration. This network includes: A backbone feature extraction network employing an improved ShuffleNetV2 architecture is used to extract multi-scale features while maintaining lightweight design. A feature pyramid enhancement module, by introducing a channel-space attention mechanism and deformable convolution, adaptively fuses multi-scale features to enhance the detailed information of defects in complex backgrounds; A dual-branch detection head: the first branch is used for defect classification and bounding box regression, and the second branch is used for semantic segmentation of defects, enabling collaborative learning of classification, localization, and contour information; S4. The network is trained using a phased strategy. First, the first branch is trained using the image processed by the background normalization algorithm. Then, the parameters of the backbone feature extraction network are fixed, and the second branch is trained using the image processed by the background normalization algorithm and combined with the adaptive hard sample mining loss function to improve the model's ability to distinguish between multiple categories and small target defects. S5. For the image of the textile to be detected, the same background normalization algorithm as in step S2 is first used for preprocessing. Then, the preprocessed image is input into the trained model. The network outputs the category, location and pixel-level segmentation mask of the defects, and uses non-maximum suppression and post-processing fusion strategy to generate the final detection result. S6. The trained model is compressed using layer fusion and quantization techniques and converted into a format suitable for embedded device deployment to achieve efficient and real-time defect detection.

[0007] Preferably, in step S2, the specific process of the background normalization algorithm includes: Calculate the local texture pattern features of an image at different scales; A Gaussian mixture model is used to model texture features and generate a background suppression weight map; The original image is multiplied by the background suppression weight map to obtain the enhanced image after background normalization.

[0008] Preferably, in step S3, the improved ShuffleNetV2 structure includes: A channel splitting and recombination mechanism is embedded in the basic ShuffleNetV2 unit to divide the input feature map into two groups according to channels, and perform depthwise separable convolution and residual connection respectively. A lightweight ECA attention module is introduced to enhance the dependencies between feature channels; A cross-stage partial connection strategy is adopted to reduce computational redundancy and improve feature reuse rate.

[0009] Preferably, in step S3, the feature pyramid enhancement module specifically includes: A bidirectional cross-scale connection path is adopted to fuse deep semantic information with shallow detail information; Deformable convolutional layers are introduced after each layer is fused to adaptively adjust the receptive field of the convolutional kernel to adapt to defects of different shapes and scales. Before output, a channel-spatial attention module is used to weight the fused features and highlight defect-related features.

[0010] Preferably, in step S3, the first branch adopts a detection structure that does not require a preset anchor frame and directly predicts the center point and size of the defect; the second branch adopts a fully convolutional network structure and outputs a binary map of the defect region corresponding to the size of the input image.

[0011] Preferably, in step S4, the expression for the adaptive hard sample mining loss function is: in, To detect loss, focus loss and GIoU loss are combined; For the segmentation loss, a weighted binary cross-entropy loss is used; The loss for mining difficult samples is calculated by dynamically adjusting the weights based on classification confidence and segmentation intersection-union ratio; λ and γ are the balance coefficients.

[0012] Preferably, in step S5, the post-processing fusion strategy includes: The detection boxes output by the first branch are spatially aligned with the segmentation masks output by the second branch. The pixel category consistency of the segmentation mask within each detection box is calculated. If the consistency is lower than a set threshold, the detection box is penalized or removed. The overlapping detection boxes and segmented regions are merged, and a weighted voting method is used to determine the final defect contour.

[0013] Preferably, in step S6, the layer fusion and quantization technique includes: merging consecutive convolutional layers and normalization layers in the model into a single computational layer, and converting model parameters from floating-point numbers to low-bit integer representations to improve inference speed and reduce storage usage.

[0014] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the deep learning-based intelligent detection method for textile defects.

[0015] The present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements the deep learning-based intelligent detection method for textile defects.

[0016] Beneficial effects This invention provides a deep learning-based intelligent defect detection method for textiles. Compared with existing technologies, it has the following advantages:

[0017] This deep learning-based intelligent defect detection method for textiles achieves a comprehensive improvement in detection performance through end-to-end optimization. It employs a background normalization algorithm to accurately suppress interference from complex textured backgrounds, and combines an improved ShuffleNetV2 backbone network with a feature pyramid enhancement module. This ensures lightweight model design while efficiently extracting multi-scale defect features, significantly improving the recognition ability for low-contrast, small-target defects. A dual-branch detection head collaboratively completes classification, localization, and semantic segmentation tasks. Combined with a phased training strategy and an adaptive hard sample mining loss function, it effectively addresses the problems of low accuracy and imbalanced sample distribution in multi-class defect detection, achieving significantly higher detection accuracy and recall than existing methods.

[0018] This invention achieves efficient model compression through layer fusion and quantization techniques, adapting to the deployment requirements of embedded devices. While ensuring real-time detection speed, it significantly reduces hardware resource consumption. The post-processing fusion strategy further improves the accuracy of detection results, ensuring accurate output of defect category, location, and contour information. The entire solution balances detection accuracy, speed, and deployment flexibility, completely changing the current situation of low efficiency and high subjectivity in traditional manual inspection. It also solves the shortcomings of existing deep learning methods in terms of adaptability to complex scenarios and lightweight deployment, providing the textile industry with a standardized and intelligent quality control solution, helping enterprises improve production efficiency and product competitiveness. Attached Figure Description

[0019] Figure 1 This is a flowchart of a deep learning-based intelligent defect detection method for textiles according to the present invention. Figure 2 The flowchart for constructing a lightweight deep learning detection network for multi-task collaboration in this invention is as follows. Figure 3 This is a schematic diagram of an electronic device according to the present invention. Detailed Implementation

[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] like Figure 1 As shown: A deep learning-based intelligent defect detection method for textiles includes the following steps: S1. Collect textile images containing various defect types and construct an image dataset covering different defect shapes, sizes, and textures. Defect types include, but are not limited to, broken yarns, stains, holes, skipped stitches, skewed weft, missing warp, and missing weft. The dataset includes images with complex textures, such as checkered fabric, striped fabric, and jacquard fabric. Each image sample is labeled with the defect category, bounding box coordinates, and pixel-level contour mask to provide comprehensive and diverse supervision information for model training. During the dataset construction process, data augmentation techniques such as random cropping, rotation, flipping, brightness / contrast adjustment, and Gaussian noise addition are used to expand the number of samples, alleviate the sample imbalance problem, and improve the generalization ability of the model. S2. Preprocess the images in the dataset and the images to be detected. The core algorithm used is background normalization to reduce interference from complex textured backgrounds and enhance the saliency of defect areas. The specific process is as follows:

[0022] Calculate the local texture pattern features of the image at different scales: The original image is processed by multi-scale Gaussian filtering to obtain image feature maps at different scales. Local texture features at each scale are extracted by Local Binary Pattern (LBP) or Gray-Level Co-occurrence Matrix (GLCM) to comprehensively depict the texture distribution pattern of textiles. Modeling texture features using Gaussian mixture models: The extracted local texture features are input into a Gaussian mixture model (GMM), and the model parameters are estimated using the expectation-maximization (EM) algorithm to achieve statistical modeling of normal texture backgrounds and generate the probability distribution of background textures; Generate background suppression weight map: Based on the output of the Gaussian mixture model, calculate the probability that each pixel belongs to the normal background texture, and use the reciprocal of the probability as the background suppression weight. That is, the weight of pixels with normal background texture is lower, and the weight of pixels with defective areas is higher, thus constructing the background suppression weight map. Image enhancement: The original image is multiplied by the background suppression weight map to suppress the normal texture background and enhance the defect area, resulting in an enhanced image after background normalization, which effectively improves the contrast between the defect area and the background. S3. Construct a multi-task collaborative lightweight detection network that integrates feature extraction, multi-scale fusion, classification and localization and semantic segmentation. Specifically, it includes three parts: a backbone feature extraction network, a feature pyramid enhancement module and a dual-branch detection head. Based on the lightweight characteristics of ShuffleNetV2, we made structural improvements to enhance the multi-scale feature extraction capability while maintaining the model's lightweight nature. The specific improvements are as follows: A channel splitting and recombination module is embedded in the basic ShuffleNetV2 unit. The input feature map is divided into two groups according to the channel dimension. For example, if the number of input channels is C, it is divided into two groups, and the number of channels in each group is C / 2. One group is transformed by depthwise separable convolution, and the other group is directly connected by residual connection. Then the two groups of feature maps are concatenated according to the channel dimension, and the channel order is shuffled by channel shuffling operation to enhance the information interaction between channels. After channel splitting and recombination, a lightweight ECA attention module is introduced. It adaptively weights channel features through one-dimensional convolution, enhances the weight of key feature channels, suppresses interference from irrelevant feature channels, and improves the ability to model the dependency relationship between feature channels without adding too much extra computation. A cross-stage partial connection structure is adopted to divide the feature map into two parts. One part is processed by multiple improved ShuffleNetV2 units for feature extraction, and the other part is directly connected by residuals. Finally, the two parts of features are fused to reduce computational redundancy, improve feature reuse rate, enhance the gradient flow of the model, and alleviate the gradient vanishing problem. The improved ShuffleNetV2 backbone network, while maintaining the advantages of low parameter count and high computational efficiency, can effectively extract multi-scale features from textile images, providing strong feature support for subsequent defect detection. To address the feature extraction challenge of defects of different scales and shapes, a feature pyramid enhancement module is designed. By integrating bidirectional cross-scale connections, deformable convolution, and attention mechanisms, adaptive enhancement of multi-scale features is achieved. Bidirectional cross-scale connection paths are constructed, one from top to bottom and the other from bottom to top. The top-down path transmits deep semantic features (containing rich category information) to the shallow layer, while the bottom-up path transmits shallow detail features (containing precise location information) to the deep layer. This fully integrates deep semantic information with shallow detail information, thereby improving the feature representation capability of defects at different scales. After feature fusion at each layer, a deformable convolutional layer is introduced. By learning the shape and location information of defects, the receptive field of the convolutional kernel is adaptively adjusted, so that the convolutional operation can accurately focus on the defect area and effectively adapt to the feature extraction of defects of different shapes and scales. Before feature output, a channel-spatial attention module is introduced, which is divided into channel attention branch and spatial attention branch: The channel attention branch learns the importance weights of different feature channels through global average pooling and fully connected layers, highlighting feature channels related to defects. The spatial attention branch generates a spatial attention map through convolution operations and the Sigmoid activation function, which enhances the spatial features of the defect area and suppresses the interference of the background area; through dual-channel weighting, it further improves the defect recognition of the fused features. A dual-branch detection head is designed to achieve collaborative learning of defect classification, localization, and semantic segmentation. The first branch (classification and bounding box regression branch) employs a detection structure that does not require pre-set anchor boxes, directly predicting the center point coordinates, width and height dimensions, and category confidence of the defect. This structure avoids the subjectivity and computational redundancy issues of anchor box design in traditional anchor-based methods, enabling more flexible adaptation to defects of different sizes and shapes, and improving localization accuracy.

[0023] The second branch (semantic segmentation branch) adopts a fully convolutional network (FCN) structure. Through the encoder-decoder architecture, the feature maps extracted by the backbone network are gradually upsampled to the same size as the input image, and the binary segmentation mask of the defect region is output to achieve a fine depiction of the defect contour. The dual-branch detection head achieves collaborative learning of classification, localization, and segmentation tasks by sharing the feature outputs of the backbone feature extraction network and the feature pyramid enhancement module. These elements complement each other and improve overall detection performance. S4. To improve the model's ability to distinguish between multiple categories and small target defects, a phased training strategy is adopted, and an adaptive hard sample mining loss function is introduced. The specific process is as follows: The first stage of training (classification and localization task training): Using enhanced images processed by the background normalization algorithm, the first branch of the detection network (classification and bounding box regression branch) is trained separately, with the optimization objective being the detection loss. , Combining FocusLoss and GIoU loss: Focus loss reduces the weight of easily separable samples by introducing a difficulty coefficient, focusing the training on difficult samples and alleviating the sample imbalance problem. GIoU loss improves the accuracy of bounding box regression by calculating information such as the intersection-union ratio of the detection box and the ground truth box, and the minimum bounding rectangle. The second stage of training (segmentation task training and multi-task collaborative optimization) fixes the parameters of the backbone feature extraction network to avoid destroying the feature extraction capabilities trained in the first stage. The enhanced image processed by the background normalization algorithm is used to train the second branch (semantic segmentation branch), and an adaptive hard sample mining loss function is introduced for multi-task collaborative optimization. The expression for the adaptive hard sample mining loss function is: in: The detection loss for the first branch is (focus loss + GIoU loss). For the segmentation loss of the second branch, a weighted binary cross-entropy loss is adopted. By assigning different weights to defective regions and background regions, with higher weights to defective regions, the problem of imbalanced samples in the segmentation task is alleviated. To address the loss for mining difficult samples, the weights are dynamically adjusted based on the classification confidence and segmentation intersection-over-union (IoU) ratio of the samples: samples with low classification confidence and small segmentation IoU are assigned higher weights, while samples with high classification confidence and large segmentation IoU are assigned lower weights, thus enabling focused training on difficult samples. λ and γ are balance coefficients used to adjust the contribution ratio of each loss term, and are adaptively adjusted according to the actual training effect (preferably λ=0.8, γ=0.5). The phased training strategy first optimizes the core classification and localization tasks, and then focuses on segmentation tasks and difficult sample mining, so that the model gradually learns more accurate defect features and improves the detection performance of multi-class and small target defects. S5. For the image of the textile to be detected, the final detection result is generated according to the following process: The image is processed using the same background normalization algorithm as in step S2 to ensure that the preprocessing method of the input image is consistent with that of the training samples, so as to avoid affecting the detection result due to differences in preprocessing. The model inference process involves inputting the preprocessed image into a trained detection network, which simultaneously outputs: The output of the first branch includes the defect category, center point coordinates, width and height dimensions, and category confidence level. The output of the second branch is a binarized segmentation mask for the defect region corresponding to the size of the input image. Non-maximum suppression is applied to the detection boxes output by the first branch to remove redundant detection boxes with an overlap higher than a set threshold and retain the detection boxes with the highest confidence. To improve the accuracy of the detection results, the detection bounding box of the first branch and the segmentation mask of the second branch are fused and optimized. The specific steps are as follows: Align the detection box with the segmentation mask in spatial coordinates to ensure that they correspond to the same defect area; Calculate the pixel class consistency of the segmentation mask within each detection box, i.e. the proportion of pixels with a value of 1 within the detection box. If the consistency is lower than the set threshold, it indicates that the detection box may be a false detection, and a confidence penalty or direct rejection is applied. For overlapping detection boxes and segmented regions, a weighted voting method is used to determine the final defect category and contour: weights are assigned based on the confidence of the detection box and the pixel consistency of the segmentation mask, and the final defect category, bounding box and contour information are obtained after weighted calculation. S6. To meet the deployment requirements of embedded devices on the production line and achieve efficient, real-time defect detection, the trained model is compressed using layer fusion and quantization techniques and converted into a format suitable for embedded devices. The specific steps are as follows: This method combines consecutive convolutional and normalization layers in the model into a single computational layer. Combining convolutional and normalization layers reduces computational steps during inference, lowers memory access overhead, and improves inference speed.

[0024] The model parameters are converted from 32-bit floating-point numbers to low-bit integer representation, preferably 8-bit integer INT8. Through quantization technology, the storage and computational load of the model are significantly reduced while ensuring that the loss of detection accuracy is within an acceptable range (accuracy decrease does not exceed 3%). The compressed model is converted into a format suitable for embedded devices, such as ONNX, TensorRT, TFLite, etc., to adapt to different hardware platforms, such as NVIDIA Jetson series and ARM Cortex series processors. This invention provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements all the steps of the above-mentioned intelligent detection method for textile defects based on deep learning, including image dataset construction, background normalization preprocessing, construction of a multi-task collaborative lightweight detection network, phased network training, image processing and post-processing fusion, model compression and embedded deployment, etc. Computer-readable storage media can be any type of media suitable for storing computer programs, such as read-only memory (ROM), random access memory (RAM), hard disk, optical disk, USB flash drive, portable hard disk, flash memory, or non-volatile memory. By storing the computer program implementing the detection method of this invention in this medium, the program can be preserved, transmitted, and reused for a long time, facilitating the portability and application of the detection method across different devices and improving the practicality and scalability of the method.

[0025] like Figure 3 As shown: This invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements all the steps of the aforementioned intelligent textile defect detection method based on deep learning. The memory stores the computer program implementing the detection method of this invention, trained model parameters, image datasets, and intermediate data generated during the detection process. The processor executes the computer program, calls the data and model in the memory, and completes a series of operations such as image preprocessing, model inference, and detection result generation, ultimately achieving intelligent detection of textile defects. This electronic device provides a hardware platform for the detection method of this invention, ensuring that the method can be engineered and put into actual production use.

[0026] This solution achieves a comprehensive improvement in detection performance through end-to-end optimization. It employs a background normalization algorithm to accurately suppress interference from complex textured backgrounds, combined with an improved ShuffleNetV2 backbone network and feature pyramid enhancement module. This ensures lightweight model design while efficiently extracting multi-scale defect features, significantly enhancing the recognition capability of low-contrast, small-target defects. A dual-branch detection head collaboratively completes classification, localization, and semantic segmentation tasks. Coupled with a phased training strategy and an adaptive hard sample mining loss function, it effectively addresses the issues of low accuracy and imbalanced sample distribution in multi-class defect detection, resulting in significantly higher detection precision and recall than existing methods.

[0027] This invention achieves efficient model compression through layer fusion and quantization techniques, adapting to the deployment requirements of embedded devices and significantly reducing hardware resource consumption while ensuring real-time detection speed. The post-processing fusion strategy further enhances the accuracy of detection results, ensuring precise output of defect category, location, and contour information. The entire solution balances detection accuracy, speed, and deployment flexibility, completely changing the low efficiency and high subjectivity of traditional manual inspection. It also addresses the shortcomings of existing deep learning methods in adaptability to complex scenarios and lightweight deployment, providing the textile industry with a standardized and intelligent quality control solution to help enterprises improve production efficiency and product competitiveness.

[0028] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A deep learning-based intelligent defect detection method for textiles, characterized in that: Includes the following steps: S1. Collect textile images containing various defect types and construct an image dataset, the dataset containing images with complex textured backgrounds; S2. Preprocess the images in the dataset to reduce interference from complex textured backgrounds; the preprocessing uses a background normalization algorithm, which can analyze and suppress local texture features of the image, thereby enhancing the contrast between defective areas and the background. S3. Construct a lightweight deep learning detection network for multi-task collaboration. This network includes: A backbone feature extraction network employing an improved ShuffleNetV2 architecture is used to extract multi-scale features while maintaining lightweight design. A feature pyramid enhancement module, by introducing a channel-space attention mechanism and deformable convolution, adaptively fuses multi-scale features to enhance the detailed information of defects in complex backgrounds; A dual-branch detection head: the first branch is used for defect classification and bounding box regression, and the second branch is used for semantic segmentation of defects, enabling collaborative learning of classification, localization, and contour information; S4. The network is trained using a phased strategy. First, the first branch is trained using the image processed by the background normalization algorithm. Then, the parameters of the backbone feature extraction network are fixed, and the second branch is trained using the image processed by the background normalization algorithm and combined with the adaptive hard sample mining loss function to improve the model's ability to distinguish between multiple categories and small target defects. S5. For the image of the textile to be detected, the same background normalization algorithm as in step S2 is first used for preprocessing. Then, the preprocessed image is input into the trained model. The network outputs the category, location and pixel-level segmentation mask of the defects, and uses non-maximum suppression and post-processing fusion strategy to generate the final detection result. S6. The trained model is compressed using layer fusion and quantization techniques and converted into a format suitable for embedded device deployment to achieve efficient and real-time defect detection.

2. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In step S2, the specific process of the background normalization algorithm includes: Calculate the local texture pattern features of an image at different scales; A Gaussian mixture model is used to model texture features and generate a background suppression weight map; The original image is multiplied by the background suppression weight map to obtain the enhanced image after background normalization.

3. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In step S3, the improved ShuffleNetV2 structure includes: A channel splitting and recombination mechanism is embedded in the basic ShuffleNetV2 unit to divide the input feature map into two groups according to channels, and perform depthwise separable convolution and residual connection respectively. A lightweight ECA attention module is introduced to enhance the dependencies between feature channels; A cross-stage partial connection strategy is adopted to reduce computational redundancy and improve feature reuse rate.

4. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In S3, the feature pyramid enhancement module specifically includes: A bidirectional cross-scale connection path is adopted to fuse deep semantic information with shallow detail information; Deformable convolutional layers are introduced after each layer is fused to adaptively adjust the receptive field of the convolutional kernel to adapt to defects of different shapes and scales. Before output, a channel-spatial attention module is used to weight the fused features and highlight defect-related features.

5. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In step S3, the first branch adopts a detection structure that does not require a preset anchor frame and directly predicts the center point and size of the defect; the second branch adopts a fully convolutional network structure and outputs a binary map of the defect region corresponding to the size of the input image.

6. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In step S4, the expression for the adaptive hard sample mining loss function is: in, To detect loss, focus loss and GIoU loss are combined; For the segmentation loss, a weighted binary cross-entropy loss is used; The loss for mining difficult samples is calculated by dynamically adjusting the weights based on classification confidence and segmentation intersection-union ratio; λ and γ are the balance coefficients.

7. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In S5, the post-processing fusion strategy includes: The detection boxes output by the first branch are spatially aligned with the segmentation masks output by the second branch. The pixel category consistency of the segmentation mask within each detection box is calculated. If the consistency is lower than a set threshold, the detection box is penalized or removed. The overlapping detection boxes and segmented regions are merged, and a weighted voting method is used to determine the final defect contour.

8. The intelligent textile defect detection method based on deep learning according to claim 1, characterized in that: In S6, the layer fusion and quantization technique includes: merging consecutive convolutional layers and normalization layers in the model into a single computational layer, and converting model parameters from floating-point numbers to low-bit integer representations to improve inference speed and reduce storage usage.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the deep learning-based intelligent detection method for textile defects as described in any one of claims 1 to 8.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, When the processor executes the computer program, it implements the deep learning-based intelligent detection method for textile defects as described in any one of claims 1 to 8.