High-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion
By introducing lightweight hybrid polymerization networks and enhanced generalized feature fusion technology in fabric defect detection, the problems of insufficient robustness, detection accuracy and generalization capabilities in the existing technology are solved, and higher detection accuracy and stronger Robustness and generalization ability.
Patent Information
- Application Number
- CN202411537802.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
AI Technical Summary
The existing fabric defect detection methods have shortcomings in robustness, detection accuracy and generalization capabilities, especially when dealing with fabric images with complex background textures and diverse defect patterns.
A high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion is proposed. Combined with the lightweight hybrid aggregation network module LMANet and enhanced generalized feature pyramid network EGFPN, it improves the robustness and generalization capability of the model, and The QIoU loss function improves the training efficiency and generalization ability of the model.
The detection accuracy on the TianChi dataset has been improved by 7.6%, which can accurately detect tiny defects from the size of hair particles and wide strip defects from the dilute settings, showing high robustness and generalization capabilities.
Smart Images

Figure CN119444714A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of target detection, and in particular to a high-precision fabric defect detection method. Background Art
[0002] At present, fabric defect detection mainly includes manual detection and automatic high-precision detection. Manual detection requires observation through the naked eye or professional visual inspection equipment, so the detection results are easily affected by subjective factors and have poor consistency. Automatic high-precision detection methods are based on computer vision technology, especially deep learning, which can realize automated defect detection. Yolov1, first proposed by Joseph Redmon et al. in 2016, has higher operating efficiency and accuracy compared with traditional manual detection methods, but its recognition ability for small objects is limited; Yolov2 adds a new activation function based on Yolov1, thereby improving the detection accuracy; Yolov3 introduces a multi-scale feature fusion method based on Yolov2, and realizes the effective detection of targets of different scales; Yolov4 adopts a larger network structure, which enables it to achieve better detection results in more complex scenes, but the amount of calculation and memory consumption also increase accordingly; Yolov5 adopts a lightweight network structure and advanced training methods to achieve higher detection accuracy and lower memory consumption while maintaining a fast speed; Yolov8 adopts a deeper and more layered convolutional neural network architecture design to further improve the accuracy of fabric defect detection, but the algorithm has poor adaptability. In short, the existing fabric defect detection methods based on the Yolo series can automatically learn high-level abstract information of defects from a large amount of sample data, thereby obtaining high-precision detection results. However, due to the complex texture characteristics of fabric background and the diverse morphologies of defects, they still have room for improvement in robustness, detection accuracy and generalization ability.
[0003] The invention patent with publication number CN117576038A is a fabric defect detection method and system based on the YOLOv8 network, S1, collect fabric image data set; S2, perform data enhancement; S3, divide according to the preset ratio to obtain training set, verification set and test set; S4, obtain N predicted feature maps; S5, for N predicted feature maps, predict the probability that each pixel in the image belongs to the object to be detected and the bounding box information of the object, and generate a bounding box; S6, calculate the network loss value based on the bounding box and the GT box of the corresponding image, and use the gradient descent method to update the parameters of the YOLOv8 network. This invention accelerates the network without affecting the detection accuracy of the network. However, this invention is insufficient in its ability to obtain target background information, resulting in poor detection accuracy. Summary of the invention
[0004] In view of the technical problems of weak robustness, detection accuracy and generalization ability in fabric defect detection, the present invention proposes a high-precision fabric defect detection method based on lightweight mixed aggregation network and enhanced generalized feature fusion, and proposes the LME-Yolov8 model. On the basis of the Yolov8 model, the lightweight mixed aggregation network module LMANet (Lightweight Mixed Aggregation Network, referred to as LMANet) is combined, and the feature vectors of different gradient feature maps are extracted respectively by parallel routing to generate more diverse and rich gradient flows, thereby improving the robustness and generalization ability of the model. And the enhanced generalized feature pyramid network (Enhanced generalized FPN, referred to as EGFPN) is used to enhance multi-path fusion to integrate features of different levels and improve the accuracy of defect detection. Finally, the dissimilarity of the two frames is measured by the QIoU loss function, thereby improving the training efficiency and generalization ability of the model.
[0005] In order to achieve the above object, the technical solution of the present invention is achieved as follows:
[0006] A high-precision fabric defect detection method based on a lightweight hybrid aggregation network and enhanced generalized feature fusion, comprising the steps of:
[0007] S1: Obtain a data set, preprocess the data set, and divide the preprocessed data set into a training set, a validation set, and a test set;
[0008] S2: constructing an LME-Yolov8 defect detection network model; the LME-Yolov8 defect detection network model comprises a backbone network, a neck network and a detection head connected in sequence, the neck network adopts an EGFPN network; an LMANet network is constructed in the neck network;
[0009] S3: Use the training set and the validation set to train and validate the LME-Yolov8 defect detection network model, respectively, to obtain the trained LME-Yolov8 defect detection network model;
[0010] S4: Use the trained LME-Yolov8 defect detection network model to detect the fabric images in the test set and obtain the fabric defect location image.
[0011] The data set adopts the TianChi data set; the preprocessing uses Mosaic data enhancement to randomly splice multiple different pictures into a new picture, and uses the LabelImg annotation tool to annotate the enhanced pictures in the data set. The annotated data set is divided into a training set, a validation set, and a test set in a ratio of 5:3:2.
[0012] The backbone network includes a first CBS module, a second CBS module, a first C2f module, a third CBS module, a second C2f module, a fourth CBS module, a third C2f module, a fifth CBS module, a fourth C2f module and an SPPF module which are connected in sequence.
[0013] The EGFPN network includes a sixth CBS module, a first Concat module, a first LMANet module, a first Upsample module, a second Concat module, a second LMANet module, a second Upsample module, a third Concat module, a third Upsample module and a fourth Concat module connected in sequence; the sixth CBS module is connected to the SPPF module, the first Concat module is connected to the third C2f module through the seventh CBS module, the second Concat module is respectively connected to the third C2f module and the eighth CBS module, the eighth CBS module is connected to the second C2f module, the third Concat module is respectively connected to the second C2f module and the third LMANet module, and the fourth Concat module is connected to the first C2f module;
[0014] The EGFPN network also includes a fourth LMANet module, a ninth CBS module, a fifth Concat module, a fifth LMANet module, a tenth CBS module, a sixth Concat module, a sixth LMANet module, an eleventh CBS module, a seventh Concat module and a seventh LMANet module connected in sequence; the fourth LMANet module is connected to the fourth Concat module, the fifth Concat module is connected to the third LMANet module, the sixth Concat module is connected to the second LMANet module, the seventh Concat module is respectively connected to the twelfth CBS module and the first LMANet module, and the twelfth CBS module is connected to the second LMANet module.
[0015] The detection head includes a Detect (P1) module, a Detect (P2) module, and a Detect (P3) module which are connected in sequence; the Detect (P1) module is connected to the seventh LMANet module for detecting small fabric defect targets; the Detect (P2) module is connected to the sixth LMANet module for detecting medium-sized fabric defect targets; and the Detect (P3) module is connected to the fifth LMANet module for detecting large fabric defect targets.
[0016] The LMANet module includes a convolution block a, which is used to enhance the feature representation of the input feature map. The convolution block a is respectively connected to three parallel routes for extracting feature vectors of different gradient feature maps. The first parallel route is a bypass convolution block for channel-level feature recalibration; the second parallel route is a depth-separable convolution block for increasing the convolution operation for efficient spatial feature processing; the third parallel route is a lightweight convolution block for enhancing feature hierarchical integration; finally, the three parallel routes are cascaded to aggregate the output feature maps in each channel and finally connected to the convolution block b, which is used to output a feature map of the same size as the input feature map.
[0017] The calculation process in the convolution block a is:
[0018] X mid =Conv1(X in )
[0019] Among them, X in is the input feature map, Conv1 is the convolution operation, X mid is the feature map obtained by convolution;
[0020] The calculation process in the bypass convolution block is:
[0021] X1=Conv2(X mid )
[0022] Conv2 is the convolution operation;
[0023] The calculation process in the depth-separable convolution block of the added convolution operation is: feature map X mid After convolution operation, DeepConv operation and PointConv operation, the feature map X2 is obtained:
[0024] X2=DSConv(Conv3(X mid ))
[0025] Among them, Conv3 is a convolution operation, and DSConv is a depth-separable convolution operation;
[0026] The calculation process in the lightweight convolution block is:
[0027] X3=Split(X mid )
[0028] X4=DSConv(X3)
[0029] X5=Conv4(X4)
[0030] X6=Conv5(X5)
[0031] The process of cascading and outputting is as follows:
[0032] X out =Conv5(cat(X1,X2,X3,X4,X5,X6)
[0033] Among them, Split means the feature division along the channel dimension, cat is the cascade operation, and Conv5 is the convolution operation.
[0034] The method for training and verifying the LME-Yolov8 defect detection network model using a training set and a validation set is as follows: inputting the training set into the constructed LME-Yolov8 defect detection network model, extracting a multi-scale feature map of the input image using a backbone network, using an EGFPN network in the neck network to obtain the multi-scale feature map extracted by the backbone network, and performing feature fusion on the multi-scale feature map to obtain the fused multi-scale features, using a detection head to perform regression tasks and classification tasks according to the fused multi-scale features, using a QIoU loss function to calculate the regression loss according to the prediction box obtained from the regression task, using a cross entropy loss function to calculate the classification loss according to the category probability distribution of the classification task, combining the regression loss and the classification loss to update the model parameters using a back propagation algorithm, using a validation set to verify and adjust the hyperparameters of the model after each round of training until the model converges, and obtaining a trained LME-Yolov8 defect detection network model.
[0035] The calculation formula of the QIoU loss function is:
[0036]
[0037] Among them, b and b gt Represent the center points of the predicted box and the real box respectively, 2 (·) represents the square of the Euclidean distance, c is the diagonal length of the minimum enclosing box covering the two boxes, α is a positive trade-off parameter, v is the consistency of the aspect ratio, which is used to measure the similarity of the aspect ratio, w represents the width of the predicted box, h represents the height of the predicted box, d1 represents the distance between the upper left coordinate of the predicted box and the true box, and d2 represents the distance between the lower right coordinate of the predicted box and the true box.
[0038] The EGFPN network uses cross-scale connection and generalized feature fusion methods to fuse multi-scale feature maps; the marked types include 9 defect types with different shapes and sizes, such as knots, three wires, coarse fibers, sparse and dense gaps, pulp spots, holes, coarse warps, rolling marks, and nipples.
[0039] Beneficial effects of the present invention:
[0040] The existing Yolov8 defect detection model uses the traditional FPN feature pyramid network structure, which has information loss and redundancy when extracting features of different scales, and the Wise-IoU loss function it uses can only predict a single defect target position. When processing fabric images with complex background textures and diverse defect forms, it faces the problems of poor robustness, low accuracy and weak generalization ability. The present invention proposes a high-precision fabric defect detection method based on lightweight hybrid aggregation and enhanced generalized feature fusion. A lightweight hybrid aggregation network LMANet is proposed in the neck network Neck of the Yolov8 model to enhance the feature representation ability and improve the robustness of the model; an enhanced generalized feature pyramid network EGFPN is proposed in the neck network Neck to enhance beneficial features, reduce redundant information and improve the defect detection accuracy through cross-scale connections of upper and lower interactions; and a QIoU loss function is proposed to improve the adaptability and generalization ability of the model.
[0041] Compared with the prior art, the improved algorithm of the present invention has a detection accuracy of 7.6% higher than that of the Yolov8 model on the TianChi dataset, and can accurately detect tiny defects as small as fuzz and wide strip defects as large as sparse and dense defects. At the same time, tests on two different fabric defect datasets show that the improved model LME-Yolov8 has high robustness and generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 It is a network structure diagram of the LME-Yolov8 defect detection network model of the present invention, which adopts the structure of a custom enhanced generalized feature pyramid network EGFPN.
[0044] Figure 2 It is a structural diagram of the lightweight hybrid aggregation network LMANet of the present invention.
[0045] Figure 3 It is a schematic diagram of the structure of the enhanced generalized feature pyramid network EGFPN of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] A high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion, such as Figure 1 As shown, the steps include:
[0048] S1: Obtain a data set, preprocess the data set, and divide the preprocessed data set into a training set, a validation set, and a test set.
[0049] Dataset acquisition:
[0050] The present invention obtains the TianChi public dataset. The TianChi public dataset contains 9 defect types with different shapes and sizes, including knots, three-wire, coarse fibers, sparse and dense gaps, pulp spots, holes, coarse warps, rolling marks, and fuzz. It contains a total of 6186 fabric defect images, each with a size of 640×640.
[0051] Dataset preprocessing and partitioning:
[0052] Mosaic data enhancement is used to randomly splice four different pictures into a new picture to increase the diversity and complexity of the training data, thereby improving the performance and robustness of the model, and reducing the risk of overfitting, thereby improving the generalization ability of the model. The enhanced pictures in the dataset are annotated in detail using the LabelImg annotation tool. The enhanced dataset is divided into a dataset in a ratio of 5:3:2, that is, 50% of the fabric images are randomly selected as the training set, 30% of the fabric images are randomly selected as the validation set, and 20% of the fabric images are randomly selected as the test set. The final training set, validation set, and test set have 3093, 1856, and 1237 images, respectively.
[0053] S2: Construct LME-Yolov8 defect detection network model; the LME-Yolov8 defect detection network model includes a backbone network, a neck network and a detection head connected in sequence, wherein the backbone network is used to extract multi-scale features of the image for use by subsequent network layers; the neck network is used to enhance the ability of network feature fusion, thereby improving the detection accuracy of the model; the detection head module is mainly responsible for multi-scale target detection of the feature map extracted by the backbone network, using 19×19, 38×38, 76×76 grids to detect large, medium and small targets respectively. The neck network adopts the enhanced generalized pyramid feature network (EGFPN), through cross-scale connections (such as Figure 1 The outputs of the three C2f modules in the backbone network and the SPPF module are connected to the first, second, third and fourth Concat modules in the neck network respectively) and generalized feature fusion (such as Figure 1 The output of the Concat module of the neck network is connected to the LMANet module for feature fusion) to better capture the multi-level features in the fabric. A lightweight hybrid aggregation network module (LMANet) is constructed in the neck network to extract useful feature information by hybrid aggregation of different scale feature maps of the model.
[0054] The backbone network includes a first CBS module, a second CBS module, a first C2f module, a third CBS module, a second C2f module, a fourth CBS module, a third C2f module, a fifth CBS module, a fourth C2f module and an SPPF module which are connected in sequence; the CBS module is a standard convolution to improve the accuracy of the model; the C2f module divides the input data into two branches for processing, increases the nonlinear ability and representation ability of the network, and thus improves the network's modeling ability for complex data; the SPPF module processes multiple small pooling cores in parallel to improve computing efficiency.
[0055] The enhanced generalized pyramid feature network (EGFPN) includes a sixth CBS module, a first Concat module, a first LMANet module, a first Upsample module, a second Concat module, a second LMANet module, a second Upsample module, a third Concat module, a third Upsample module and a fourth Concat module connected in sequence; the sixth CBS module is connected to the SPPF module, the first Concat module is connected to the third C2f module through the seventh CBS module, the second Concat module is respectively connected to the third C2f module and the eighth CBS module, the eighth CBS module is connected to the second C2f module, the third Concat module is respectively connected to the second C2f module and the third LMANet module, and the fourth Concat module is connected to the first C2f module;
[0056] The enhanced generalized pyramid feature network (EGFPN) also includes a fourth LMANet module, a ninth CBS module, a fifth Concat module, a fifth LMANet module, a tenth CBS module, a sixth Concat module, a sixth LMANet module, an eleventh CBS module, a seventh Concat module and a seventh LMANet module connected in sequence; the fourth LMANet module is connected to the fourth Concat module, the fifth Concat module is connected to the third LMANet module, the sixth Concat module is connected to the second LMANet module, the seventh Concat module is connected to the twelfth CBS module and the first LMANet module respectively, and the twelfth CBS module is connected to the second LMANet module;
[0057] The LMANet module includes a 1×1 convolution block a, which is used to enhance the feature representation of the input feature map. The 1×1 convolution block a is respectively connected to three parallel routes for extracting feature vectors of different gradient feature maps. The first parallel route is a 1×1 bypass convolution block for channel-level feature recalibration; the second parallel route is a depth-separable convolution block (DSConv) with added convolution operations for efficient spatial feature processing; the third parallel route is a lightweight convolution block (LCNet) for enhancing feature hierarchical integration; finally, the three parallel routes are cascaded to aggregate the output feature maps in each channel to generate more diverse and rich gradient flows, and finally connected to the 1×1 convolution block b, which is used to output a feature map of the same size as the input feature map;
[0058] The calculation process in the 1×1 convolution block a is:
[0059] X mid =Conv1(X in )
[0060] Among them, X in is the input feature map, Conv1 is a 1×1 convolution operation, X mid It is the feature map obtained by 1×1 convolution;
[0061] The calculation process in the 1×1 bypass convolution block is:
[0062] X1=Conv2(X mid )
[0063] Conv2 is a 1×1 convolution operation;
[0064] Increasing the depth of the convolution operation The calculation process in the separable convolution block is: Feature map X mid After 1×1 convolution operation, 3×3 DeepConv operation and 1×1 PointConv operation, the feature map X2 is obtained:
[0065] X2=DSConv(Conv3(X mid ))
[0066] Among them, Conv3 is a 1×1 convolution operation, and DSConv is a 3×3 depth-separable convolution operation, which includes a 3×3 DeepConv operation and a 1×1 PointConv operation.
[0067] The calculation process in the lightweight convolution block is:
[0068] X3=Split(X mid )
[0069] X4=DSConv(X3)
[0070] X5=Conv4(X4)
[0071] X6=Conv5(X5)
[0072] The process of cascading and outputting is as follows:
[0073] X out =Conv5(cat(X1,X2,X3,X4,X5,X6)
[0074] Among them, Split means the feature division along the channel dimension, cat is a cascade operation, which means the feature concatenation along the channel dimension, and Conv5 is a 1×1 convolution operation.
[0075] like Figure 1 As shown in the middle neck network, first, the multi-scale feature map is extracted through the multi-layer convolutional neural network of the backbone network to generate pyramid feature maps that can represent the information of different scales of the image, which are respectively Figure 1 The output feature maps of the first, second, and third C2f modules and the SPPF module in the backbone network. Then, in the enhanced generalized pyramid feature network (EGFPN), the multi-scale feature maps (low-level feature maps) from the backbone network and the high-level feature maps generated in the neck network are combined, and then upsampled (Upsample) to increase the scale, so that the low-level feature maps can obtain more background information, thereby improving the accuracy of target detection. Then, without significantly increasing the computational complexity and latency, a lightweight hybrid aggregation network LMANet is used to combine high-level semantic features with low-level spatial details, thereby further improving the flow of defect information of different defects in the fabric. Through the above method, the LME-Yolov8 defect detection network model can effectively integrate feature information at various levels, thereby extracting rich semantic information and enhancing the precision of target detection.
[0076] The detection head includes a Detect (P1) module, a Detect (P2) module, and a Detect (P3) module which are connected in sequence; the Detect (P1) module is connected to the seventh LMANet module for detecting small fabric defect targets; the Detect (P2) module is connected to the sixth LMANet module for detecting medium-sized fabric defect targets; and the Detect (P3) module is connected to the fifth LMANet module for detecting large fabric defect targets.
[0077] The detection head is divided into two subtasks: recognition and classification. Separating the tasks of classification and recognition allows the model to focus on its specific tasks, thereby improving the accuracy of classification and detection precision. One subtask is for target recognition, which is measured by bounding box regression loss. Its loss function is calculated using QIoU Loss. This loss function not only integrates the overlapping area and center point distance between the predicted box and the true box, but also introduces information such as aspect ratio information and aspect height distance difference. It can more comprehensively measure the similarity between the true box and the predicted box, and improve the regression speed and accuracy of the detection box; the other subtask is for target classification, which is measured using the binary cross entropy loss function. Among them, the true box will be the defect bounding box pre-labeled in the training set, and the predicted box is the bounding box of the target area predicted by the model.
[0078] S3: Use the training set and the validation set to train and validate the LME-Yolov8 defect detection network model, respectively, to obtain the trained LME-Yolov8 defect detection network model;
[0079] The method for training and verifying the LME-Yolov8 defect detection network model using a training set and a validation set is as follows: inputting the training set into the constructed LME-Yolov8 defect detection network model, extracting a multi-scale feature map of the input image using a backbone network, using an EGFPN network in the neck network to obtain the multi-scale feature map extracted by the backbone network, and performing feature fusion on the multi-scale feature map to obtain the fused multi-scale features, using a detection head to perform regression tasks and classification tasks according to the fused multi-scale features, using a QIoU loss function to calculate the regression loss according to the prediction box obtained from the regression task, using a cross entropy loss function to calculate the classification loss according to the category probability distribution of the classification task, combining the regression loss and the classification loss to use a back propagation algorithm to update the model parameters, using a validation set to verify and adjust the hyperparameters of the model after each round of training until the model converges, and obtaining a trained LME-Yolov8 defect detection network model.
[0080] The model parameters are set as follows: 100 epochs, 37 batch-size, 640×640 img-size, 0.01 CLR, 50 weights-decay, QIoU loss function. The QIoU loss function is based on IoU and introduces parameters such as the aspect ratio and the difference in width and height to measure the similarity between the predicted box and the real box. The calculation formula is:
[0081]
[0082]
[0083] Among them, b and b gt Represent the center points of the predicted box and the true box respectively. 2 (·) represents the square of the Euclidean distance, c is the diagonal length of the minimum enclosing box covering the two boxes, α is a positive trade-off parameter, v is the consistency of the aspect ratio, which is used to measure the similarity of the aspect ratio, w represents the width of the predicted box, h represents the height of the predicted box, d1 represents the distance between the upper left coordinate of the predicted box and the true box, and d2 represents the distance between the lower right coordinate of the predicted box and the true box.
[0084] The QIoU loss function evaluates the overlapping area, center point distance, aspect ratio, and aspect-to-height distance difference between the predicted box and the true box. It can more comprehensively measure the similarity between the two boxes and improve the regression speed and accuracy of the detection box.
[0085] S4: Use the trained LME-Yolov8 defect detection network model to detect the fabric images in the test set and obtain the fabric defect location image.
[0086] The effectiveness of the improved algorithm of the present invention is verified by ablation experiments, and the experimental results are shown in Table 1. According to experiments (a), (b), and (c) in Table 1, it can be seen that after gradually adding the three modules, the detection accuracy has been improved to varying degrees. After adding the lightweight hybrid aggregation network module LMANet, the mAP of the baseline method was improved by 3.1%. Then, the enhanced generalized feature pyramid network EGFPN was introduced into the neck network Neck, and the average detection accuracy was improved by 4.2%. Finally, the average detection accuracy of the improved algorithm obtained after fusing the three modules reached 82.1%, and the mAP was improved by 7.9% compared with the baseline model. This shows that the LMANet module, the EGFPN structure, and the QIoU loss function can effectively improve the detection accuracy, which fully proves the correctness of the improved scheme.
[0087] Table 1 Ablation experiment results based on TianChi dataset:
[0088]
[0089] In order to show the superiority of the proposed model, the experimental results compared with the benchmark model are shown in Table 2. It can be seen that the LME-Yolov8 defect detection network model has higher detection accuracy and faster detection speed.
[0090] Table 2 compares experimental data based on the TianChi dataset:
[0091] mAP(%) FPS Yolov8m 74.2 62 LME-Yolov8 82.1 74
[0092] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion, characterized in that: Includes steps: S1: Obtain a data set, preprocess the data set, and divide the preprocessed data set into a training set, a validation set, and a test set; S2: constructing an LME-Yolov8 defect detection network model; the LME-Yolov8 defect detection network model comprises a backbone network, a neck network and a detection head connected in sequence, the neck network adopts an EGFPN network; an LMANet network is constructed in the neck network; S3: Use the training set and the validation set to train and validate the LME-Yolov8 defect detection network model, respectively, to obtain the trained LME-Yolov8 defect detection network model; S4: Use the trained LME-Yolov8 defect detection network model to detect the fabric images in the test set and obtain the fabric defect location image.
2. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 1 is characterized in that: The data set adopts the TianChi data set; the preprocessing uses Mosaic data enhancement to randomly splice multiple different pictures into a new picture, and uses the LabelImg annotation tool to annotate the enhanced pictures in the data set. The annotated data set is divided into a training set, a validation set, and a test set in a ratio of 5:3:
2.
3. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 2 is characterized in that: The backbone network includes a first CBS module, a second CBS module, a first C2f module, a third CBS module, a second C2f module, a fourth CBS module, a third C2f module, a fifth CBS module, a fourth C2f module and an SPPF module which are connected in sequence.
4. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 3 is characterized in that: The EGFPN network includes a sixth CBS module, a first Concat module, a first LMANet module, a first Upsample module, a second Concat module, a second LMANet module, a second Upsample module, a third Concat module, a third Upsample module and a fourth Concat module connected in sequence; the sixth CBS module is connected to the SPPF module, the first Concat module is connected to the third C2f module through the seventh CBS module, the second Concat module is respectively connected to the third C2f module and the eighth CBS module, the eighth CBS module is connected to the second C2f module, the third Concat module is respectively connected to the second C2f module and the third LMANet module, and the fourth Concat module is connected to the first C2f module; The EGFPN network also includes a fourth LMANet module, a ninth CBS module, a fifth Concat module, a fifth LMANet module, a tenth CBS module, a sixth Concat module, a sixth LMANet module, an eleventh CBS module, a seventh Concat module and a seventh LMANet module connected in sequence; the fourth LMANet module is connected to the fourth Concat module, the fifth Concat module is connected to the third LMANet module, the sixth Concat module is connected to the second LMANet module, the seventh Concat module is respectively connected to the twelfth CBS module and the first LMANet module, and the twelfth CBS module is connected to the second LMANet module.
5. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 4 is characterized in that: The detection head includes a Detect (P1) module, a Detect (P2) module, and a Detect (P3) module which are connected in sequence; the Detect (P1) module is connected to the seventh LMANet module for detecting small fabric defect targets; the Detect (P2) module is connected to the sixth LMANet module for detecting medium-sized fabric defect targets; and the Detect (P3) module is connected to the fifth LMANet module for detecting large fabric defect targets.
6. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to any one of claims 1 to 5, characterized in that: The LMANet module includes a convolution block a, which is used to enhance the feature representation of the input feature map. The convolution block a is respectively connected to three parallel routes for extracting feature vectors of different gradient feature maps. The first parallel route is a bypass convolution block for channel-level feature recalibration; the second parallel route is a depth-separable convolution block for increasing the convolution operation for efficient spatial feature processing; the third parallel route is a lightweight convolution block for enhancing feature hierarchical integration; finally, the three parallel routes are cascaded to aggregate the output feature maps in each channel and finally connected to the convolution block b, which is used to output a feature map of the same size as the input feature map.
7. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 6 is characterized in that: The calculation process in the convolution block a is: X mid =Conv1(X in ) Among them, X in is the input feature map, Conv1 is the convolution operation, X mid is the feature map obtained by convolution; The calculation process in the bypass convolution block is: X1=Conv2(X mid ) Conv2 is the convolution operation; The calculation process in the depth-separable convolution block of the added convolution operation is: feature map X mid After convolution operation, DeepConv operation and PointConv operation, the feature map X2 is obtained: X2=DSConv(Conv3(X mid )) Among them, Conv3 is a convolution operation, and DSConv is a depth-separable convolution operation; The calculation process in the lightweight convolution block is: X3=Split(X mid ) X4=DSConv(X3) X5=Conv4(X4) X6=Conv5(X5) The process of cascading and outputting is as follows: X out =Conv5(cat(X1,X2,X3,X4,X5,X6) Among them, Split means the feature division along the channel dimension, cat is the cascade operation, and Conv5 is the convolution operation.
8. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 7 is characterized in that: The method for training and verifying the LME-Yolov8 defect detection network model using a training set and a validation set is as follows: inputting the training set into the constructed LME-Yolov8 defect detection network model, extracting a multi-scale feature map of the input image using a backbone network, using an EGFPN network in the neck network to obtain the multi-scale feature map extracted by the backbone network, and performing feature fusion on the multi-scale feature map to obtain the fused multi-scale features, using a detection head to perform regression tasks and classification tasks according to the fused multi-scale features, using a QIoU loss function to calculate the regression loss according to the prediction box obtained from the regression task, using a cross entropy loss function to calculate the classification loss according to the category probability distribution of the classification task, combining the regression loss and the classification loss to update the model parameters using a back propagation algorithm, using a validation set to verify and adjust the hyperparameters of the model after each round of training until the model converges, and obtaining a trained LME-Yolov8 defect detection network model.
9. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 8 is characterized in that: The calculation formula of the QIoU loss function is: Among them, b and b gt Represent the center points of the predicted box and the real box respectively, 2 (·) represents the square of the Euclidean distance, c is the diagonal length of the minimum enclosing box covering the two boxes, α is a positive trade-off parameter, v is the consistency of the aspect ratio, which is used to measure the similarity of the aspect ratio, w represents the width of the predicted box, h represents the height of the predicted box, d1 represents the distance between the upper left coordinate of the predicted box and the true box, and d2 represents the distance between the lower right coordinate of the predicted box and the true box.
10. The high-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion according to claim 8, characterized in that: The EGFPN network uses cross-scale connection and generalized feature fusion methods to fuse multi-scale feature maps; the marked types include 9 defect types with different shapes and sizes, such as knots, three wires, coarse fibers, sparse and dense gaps, pulp spots, holes, coarse warps, rolling marks, and nipples.
Citation Information
Patent Citations
Fabric defect detection method and system based on YOLOv8 network
CN117576038A
Cited By
Railway track defect detection method based on MFGA-YOLO model
CN120298307A
A railway track defect detection method based on an MFGA-YOLO model
CN120298307B
Defect detection method based on fabric texture correlation
CN121053141A
Intelligent shirt yellow spot stain identification method
CN121527504A
A machine vision-based online identification method and system for surface defects of a textile fabric
CN122714425A