Curtain fabric light transmission defect detection method, system and equipment based on improved YOLOv8 model and medium
By improving the YOLOv8 model and combining it with deep learning and invisible light imaging technology, the comprehensiveness and accuracy issues of curtain fabric light transmittance defect detection were solved, achieving efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510866877.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-10-10
AI Technical Summary
The existing technology for detecting light transmittance defects in curtain fabrics has the problems of low efficiency and poor accuracy of manual detection, and insufficient detection precision of automated detection equipment, making it impossible to comprehensively detect the entire piece of fabric.
An improved YOLOv8 model is adopted, combined with invisible light imaging technology and deep learning algorithm, and the edge information enhancement module EIEM and C2f_Star module are introduced. The NWD loss function and CIoU loss function are used for joint optimization training, and the model is compressed through the LAMP pruning algorithm to achieve comprehensive detection of the entire piece of cloth.
It significantly improves the comprehensiveness and accuracy of detection, reduces the amount of calculation and increases the detection speed, and can effectively identify small target defects.
Smart Images

Figure CN120765576A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image recognition and detection technology, and in particular relates to a curtain fabric light transmittance defect detection method, system, equipment and medium based on an improved YOLOv8 model. Background Art
[0002] Curtain fabrics are a key product in the textile industry, and their surface quality directly impacts their performance and market competitiveness. Translucent defects (such as holes, thin spots, and uneven light transmission) are common quality issues in curtain fabric production. Failure to promptly detect and eliminate these defects can severely reduce product yields and negatively impact the user experience. Therefore, efficient and accurate translucent defect detection is crucial for improving curtain fabric production quality.
[0003] Currently, curtain fabric light transmittance testing is mainly divided into two categories: one is traditional manual testing, which is to hold the fabric in front of a light source in a dark room and judge light transmittance defects through manual observation; the other is some mechanical or automated testing equipment, such as a device that uses local sampling detection, which uses components such as photoresistors to sense the light transmittance of local areas and mark unqualified locations.
[0004] The method of using the human eye to judge whether there is too much, too little or uneven light transmission has the problems of large workload, low accuracy and low efficiency. In addition, staring at a strong light source for a long time in a dark room is very harmful to the human eye.
[0005] Compared with manual inspection, light transmittance inspection through automated inspection equipment has improved efficiency and accuracy. However, it still uses local evaluation instead of overall evaluation as the main logic, which is not comprehensive enough. The core reason is that the image detection model currently used by automated inspection equipment has the problem of insufficient detection accuracy. Once the overall evaluation of the fabric is carried out globally, many small target defects will be missed. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to address the deficiencies in the above-mentioned prior art and provide a curtain fabric light transmittance defect detection method, system, equipment and medium based on the improved YOLOv8 model. Deep learning technology and invisible light imaging technology are introduced to obtain the light transmittance image of the fabric through invisible light imaging, and the image is analyzed using a deep learning algorithm to achieve comprehensive detection of the entire piece of fabric, avoid the limitations of local sampling, and improve the comprehensiveness and accuracy of detection.
[0007] The first aspect of the present invention discloses a method for detecting light transmittance defects in curtain fabrics based on an improved YOLOv8 model, comprising the following steps:
[0008] S1. Illuminate the curtain fabric to be inspected with an invisible light source, and capture an invisible light transmission image of the curtain fabric using an invisible light camera;
[0009] S2. Input the invisible light transmission image into an improved YOLOv8 model to detect light transmission defects. The improved YOLOv8 model includes:
[0010] Edge Information Enhancement Module (EIEM) is used to extract multi-directional edge gradient features from the input image and fuse spatial structure information;
[0011] The backbone network includes the C2f_Star module, which is used to perform lightweight feature extraction of the input feature X through the star operation;
[0012] The improved YOLOv8 model adopts the joint optimization training of NWD loss function and CIoU loss function to improve the accuracy of small object defect detection;
[0013] S3. Output the detection result with the location and category of the defect, where the defect includes a hole, a thin spot and / or an uneven light transmission area.
[0014] Furthermore, the edge information enhancement module EIEM includes:
[0015] Sobel operator branch, used to extract edge gradient features through horizontal and vertical convolution kernels;
[0016] Pooling branch, used to preserve the spatial structure information of the input image;
[0017] The feature fusion unit performs weighted fusion of edge gradient features and spatial structure information and outputs them.
[0018] Furthermore, the C2f_Star module replaces the Darknet Bottleneck structure with the StarNet structure, including the following processing steps:
[0019] Step 1: Perform layer normalization on the output of the previous layer;
[0020] Step 2: Apply depthwise separable convolution to the normalized output of the layer.
[0021] Step 3: Feed the output of the depthwise separable convolution into at least two linear transformation layers.
[0022] Step 4: Pass one branch of the output of step 3 through the GELU activation function and perform element-wise addition or multiplication operation with the other branch;
[0023] Step 5: Perform element-wise addition operation on the output of step 4 and the input features of step 1.
[0024] Furthermore, the calculation of the NWD loss function includes:
[0025] Model the predicted box and the true box as a two-dimensional Gaussian distribution;
[0026] The normalized Wasserstein distance between the two is calculated as the loss term and weighted summed with the CIoU loss.
[0027] Furthermore, before the model is deployed, the following steps are also included:
[0028] The LAMP pruning algorithm is used to perform layer-adaptive pruning on the model, pruning parameters whose absolute weight values are lower than the dynamic threshold;
[0029] The pruned model is fine-tuned to restore accuracy.
[0030] A second aspect of the present invention discloses a curtain fabric light transmittance defect detection system, comprising:
[0031] An invisible light imaging unit, used for collecting invisible light transmission images of curtain fabrics through an invisible light source and a camera;
[0032] A processing unit, running the improved YOLOv8 model as described in the first aspect;
[0033] Output unit for visualizing defect detection results and generating quality reports.
[0034] Furthermore, the invisible light imaging unit includes:
[0035] Invisible light LED array light source with a wavelength range of 850-1550nm;
[0036] High-resolution CMOS camera with invisible light filter, frame rate ≥60fps.
[0037] A third aspect of the present invention discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements the method steps described in the first aspect when executing the computer program in the memory.
[0038] A fourth aspect of the present invention discloses a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the method steps described in the first aspect.
[0039] The fifth aspect of the present invention discloses a curtain fabric production line quality control system, which integrates the detection system as described in the second aspect and is linked with the correction device of the production line to adjust the production process parameters in real time according to the detection results.
[0040] Compared with existing technologies, this invention offers the following advantages: The introduction of an edge information enhancement module significantly improves the model's ability to detect target defects by strengthening edge features. The designed C2f_Star module reduces the model's computational complexity, achieving high-precision defect detection while maintaining a low computational load. The improved YOLOv8 model employs a combined optimization training method using the NWD loss function and the CIoU loss function, significantly improving the accuracy of small target defect detection. Furthermore, model compression using LAMP pruning reduces computational complexity by 40% while maintaining essentially unchanged model accuracy, increasing detection speed.
[0041] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 The figure is a flow chart of the method for detecting light transmission defects in curtain fabrics of the present invention.
[0043] Figure 2 This is a structural diagram of the improved YOLOv8 model in the present invention. DETAILED DESCRIPTION
[0044] Example 1
[0045] like Figure 1 As shown, the present invention discloses a curtain fabric light transmittance defect detection method based on an improved YOLOv8 model, comprising the following steps:
[0046] S1. Illuminate the curtain fabric to be inspected with an invisible light source and capture an invisible light transmission image of the curtain fabric using an invisible light camera; perform preprocessing on the invisible light transmission image, including but not limited to noise reduction, contrast enhancement / histogram adjustment, geometric correction, and ROI cropping, etc., which can be selected based on actual conditions;
[0047] The invisible light source may be ultraviolet light (10-400 nm) or infrared light. Infrared light is preferred, and a camera suitable for capturing images is an infrared camera adapted for infrared light.
[0048] S2. Input the invisible light transmission image into an improved YOLOv8 model to detect light transmission defects. The improved YOLOv8 model includes:
[0049] Edge Information Enhancement Module (EIEM) is used to extract multi-directional edge gradient features from the input image and fuse spatial structure information;
[0050] It should be noted that convolutional neural networks are generally good at learning spatial information, but may be slightly insufficient for extracting edge information in images; the Sobel operator can effectively capture sudden changes in intensity in an image, thereby obtaining important edge information, so an edge information enhancement module is proposed.
[0051] The structure of edge information enhancement module EIEM is as follows Figure 2 As shown in , the input of this module first undergoes ordinary convolution processing, and the processing results are passed to the Sobel convolution branch that extracts edge information and the pooling convolution branch that extracts spatial information. Through the two Sobel convolution branches, the horizontal and vertical edge features of the image are explicitly extracted;
[0052] Sobel convolution uses two specific 3x3 convolution kernels to perform neighborhood convolution calculations on the image in two directions at the same time to detect vertical and horizontal edges in the image;
[0053] Horizontal gradient kernel (Sx / Gx) - detects vertical edges (horizontal changes): Sx = [-1, 0, 1]
[0054] [-2, 0, 2]
[0055] [-1, 0, 1];
[0056] Used to calculate the gradient component (Gx) of the image in the x (horizontal) direction; it responds most strongly to vertical edges (i.e., there is a difference in grayscale between the left and right sides).
[0057] Vertical gradient kernel (Sy / Gy) - detects horizontal edges (vertical changes):
[0058] Sy=[-1,-2,-1]
[0059] [0, 0, 0]
[0060] [1, 2, 1];
[0061] Used to calculate the gradient component (Gy) of the image in the y (vertical) direction.
[0062] The response to horizontal edges (i.e., differences in grayscale above and below) is strongest.
[0063] Taking the horizontal direction as an example, applying the template to a point I(x,y) on the image obtains the horizontal edge response G x (I), G x (I)=I*G x ;
[0064] Finally, we can get the total edge strength at each pixel in the image by calculating the corresponding modulus of the horizontal and vertical edges:
[0065] In addition to edge information, spatial information in the image is equally important, so an additional pooling branch is used to extract and retain important spatial information. Unlike the Sobel convolution branch, the pooling branch extracts features of the original image and can retain rich spatial details. The features extracted from the Sobel convolution branch and the pooling branch are then fused and continued. This fusion operation ensures that the learned feature representation contains both rich edge information and spatial information, which can more comprehensively characterize the image content.
[0066] In summary, the edge information enhancement module (EIEM) includes: a Sobel operator branch for extracting edge gradient features through horizontal and vertical convolution kernels; a pooling branch for retaining the spatial structure information of the input image; and a feature fusion unit for weighted fusion of edge gradient features and spatial structure information and outputting them.
[0067] In this embodiment, the improved YOLOv8 model also includes:
[0068] The backbone network includes the C2f_Star module, which is used to implement lightweight feature extraction of the input feature X through star operation. The C2f_Star module uses the StarNet structure to replace the Darknet Bottleneck structure and includes the following processing steps:
[0069] Step 1: Perform layer normalization on the output of the previous layer;
[0070] Step 2: Apply depthwise separable convolution to the normalized output of the layer.
[0071] Step 3: Feed the output of the depthwise separable convolution into at least two linear transformation layers.
[0072] Step 4: Pass one branch of the output of step 3 through the GELU activation function and perform element-wise addition or multiplication operation with the other branch;
[0073] Step 5: Perform element-wise addition operation on the output of step 4 and the input features of step 1.
[0074] It should be noted that due to the fast production speed of fabrics and the larger fabric width compared to other defect detection methods, the number of images that need to be detected is extremely large. Therefore, it is crucial to reduce the number of parameters and computational complexity and improve detection efficiency.
[0075] StarNet introduces star operation (element-wise multiplication), the formula is as follows As shown in the figure, while keeping the computational complexity low, the mapping of high-dimensional feature space is achieved, solving the trade-off problem between computational complexity and performance in traditional efficient network design.
[0076] The formula In , W and B represent the weight matrix and bias respectively, which can be written in matrix form as follows: Where W = [W, B] T , X=[X,1] T X is the input data matrix, which represents the data input to the network, usually a feature matrix. In fabric detection, X is the feature data of a batch of images (for example, the feature map obtained by preprocessing).
[0077] The C2f_Star module structure is as follows Figure 2 As shown in the figure, StarNet replaces the Darknet Bottleneck structure. Specifically, first, layer normalization is applied to the output of the previous layer, which helps to accelerate the training process and improve the generalization ability of the model; then a depth-wise separable convolution kernel is used to convolve the input, and then it passes through two linear transformation layers, which are used to increase the nonlinear expression ability of the network and change the number of feature channels. After the left branch passes through the GELU (Gaussian Error Linear Unit) activation function, it performs element-wise addition or multiplication operations with the right branch, which increases the flexibility and diversity of the network; finally, it is added to the input, so that not only the deep feature information is obtained through the network layer transformation, but also the original information of the input is retained.
[0078] In this embodiment, the improved YOLOv8 model also includes:
[0079] The improved YOLOv8 model adopts the joint optimization training of NWD loss function and CIoU loss function to improve the accuracy of small object defect detection;
[0080] It should be noted that the traditional YOLOv8 regression loss function is the CIOU loss function. However, this traditional evaluation indicator based on intersection-over-union is sensitive to small objects. When allocating positive and negative samples, it may cause the features of positive and negative samples to be similar, making it difficult for the network to converge. In addition, insufficient information about the small target features extracted during model training causes the model to focus only on the features of medium and large targets, while ignoring the learning of the features of small targets.
[0081] Therefore, this paper proposes a loss function based on Wasserstein distance. Specifically, the bounding box is first modeled as a two-dimensional Gaussian distribution. Then, a new indicator, denoted as NWD, is proposed to calculate the similarity between them by comparing the corresponding Gaussian distributions. The derivation formula of the loss function based on NWD is as follows:
[0082]
[0083] Where: W is the Gaussian distribution N of the two bounding boxes a and b a and N bThe Wasserstein distance between them, where (cx, cy) is the center point coordinate, w and h are the height and width of the bounding box respectively;
[0084] By the formula (where C is a constant related to the data set) the normal distribution horizontal distance NWD (N a ,N b );
[0085] As can be seen from the above formula, NWD mainly focuses on the relationship between the center point coordinates and width and height between the two bounding boxes. The CIOU loss function originally used considers the consistency of the aspect ratio of the predicted box and the true box. Therefore, the regression loss function used in this paper is as follows: Loss = 0.5*(1-NWD(N a ,N b ))+0.5*Loss CIOU As shown in the figure, by performing a weighted combination of the NWD loss function and the CIOU loss function and comprehensively evaluating the bounding box relationship, the bounding box prediction can be more effectively optimized during the training process.
[0086] In summary, the calculation of the NWD loss function includes: modeling the predicted box and the true box as a two-dimensional Gaussian distribution; calculating the normalized Wasserstein distance between the two as the loss term, and weighted summing it with the CIoU loss.
[0087] S3. Output the inspection results with the location and category of defects to the ERP system, where the defects include holes, thin spots and / or areas with uneven light transmission.
[0088] In this embodiment, before the model is deployed, the following steps are also included:
[0089] The LAMP pruning algorithm is used to perform layer-adaptive pruning on the model, pruning parameters whose absolute weight values are lower than the dynamic threshold; the pruned model is fine-tuned to restore accuracy.
[0090] It should be noted that LAMP (Layer-Adaptive Magnitude-Based Pruning) is a deep learning model pruning algorithm that reduces model complexity and computational cost by selectively removing unimportant parameters in the neural network. Its core idea is to adaptively prune parameters based on the importance of each layer (that is, the absolute value of the weight), rather than uniformly pruning the entire network.
[0091] Specifically, the LAMP pruning algorithm first calculates unique importance thresholds for each layer. These thresholds are determined based on the absolute value of the weights within the layer, and a threshold is selected based on a preset pruning rate. Next, LAMP determines the pruning weights, marking the weights with an absolute value less than or equal to the threshold as the weights to be pruned and setting them to zero, while retaining the remaining weights. Finally, the pruned model usually requires fine-tuning training to restore or improve the performance before pruning; the formula is as follows:
[0092]
[0093] Where W represents the convolution kernel in the convolutional neural network, W[u] represents the weight corresponding to the convolution kernel index u, and when u≤v, w[u]≤W[v].
[0094] Example 2
[0095] A second aspect of the present invention discloses a curtain fabric light transmittance defect detection system, comprising:
[0096] An invisible light imaging unit, used for collecting invisible light transmission images of curtain fabrics through an invisible light source and a camera;
[0097] A processing unit, running the improved YOLOv8 model as described in Example 1;
[0098] Output unit for visualizing defect detection results and generating quality reports.
[0099] Furthermore, the invisible light imaging unit includes:
[0100] Invisible light LED array light source with a wavelength range of 850-1550nm;
[0101] High-resolution CMOS camera with invisible light filter, frame rate ≥60fps.
[0102] It should be noted that the system workflow is as follows:
[0103] Image acquisition stage: The invisible light LED array illuminates the moving curtain fabric in pulse mode (duty cycle 50%), and the camera is triggered to shoot synchronously at 60fps, with a single frame exposure time of ≤1ms.
[0104] Preferably, the invisible light is infrared light, and the camera is an infrared camera;
[0105] Real-time processing stage: Improve the YOLOv8 model to process images frame by frame, with inference latency ≤ 15ms (meeting the real-time requirements of the production line).
[0106] Result output stage: The GUI interface updates the test results in real time, and a quality label (including QR code traceability information) is automatically printed after each roll of curtain fabric is tested.
[0107] Example 3
[0108] A third aspect of the present invention discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements the method steps described in Example 1 when executing the computer program in the memory.
[0109] Example 4
[0110] A fourth aspect of the present invention discloses a computer-readable storage medium storing computer instructions, which implement the method steps described in Example 1 when executed by a processor.
[0111] Example 5
[0112] The fifth aspect of the present invention discloses a curtain fabric production line quality control system, which integrates the detection system as described in Example 2 and is linked with the correction device of the production line to adjust the production process parameters in real time according to the detection results.
[0113] It should be noted that the detection system is integrated into the rear section of the drying process of the production line, and the deviation correction device is a guide roller driven by a high-precision servo motor. When this embodiment is working, take the production of blackout cloth as an example (transmission speed 1.5m / s):
[0114] Step 1, detection stage: The invisible light imaging unit found a group of thread end defects (density 7 / m) in position P1 for three consecutive frames. 2 );
[0115] Step 2, decision stage: the processing unit calls the improved YOLOv8 model to determine that it is a "continuous distribution defect" (confidence level 96%);
[0116] Step 3, Execution phase: The central platform completes within 200ms: the traction roller speed is reduced to 0.75m / s; the drying zone temperature is increased from 130°C to 140°C; the correction device moves 15cm to the right to push the defect group to the edge cutting area.
[0117] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any simple modification, change and equivalent structural change made to the above embodiment based on the technical essence of the present invention shall still fall within the scope of protection of the technical solution of the present invention.
Claims
1. A curtain fabric light transmittance defect detection method based on an improved YOLOv8 model, characterized in that: The following steps are involved: S1. Illuminate the curtain fabric to be inspected with an invisible light source, and capture an invisible light transmission image of the curtain fabric using an invisible light camera; S2. Input the invisible light transmission image into an improved YOLOv8 model to detect light transmission defects. The improved YOLOv8 model includes: Edge Information Enhancement Module (EIEM) is used to extract multi-directional edge gradient features from the input image and fuse spatial structure information; The backbone network includes the C2f_Star module, which is used to perform lightweight feature extraction of the input feature X through the star operation; The improved YOLOv8 model adopts the joint optimization training of NWD loss function and CIoU loss function to improve the accuracy of small object defect detection; S3. Output the detection result with the location and category of the defect, where the defect includes a hole, a thin spot and / or an uneven light transmission area.
2. The method according to claim 1, characterized in that The edge information enhancement module EIEM includes: Sobel operator branch, used to extract edge gradient features through horizontal and vertical convolution kernels; Pooling branch, used to preserve the spatial structure information of the input image; The feature fusion unit performs weighted fusion of edge gradient features and spatial structure information and outputs them.
3. The method according to claim 1, characterized in that The C2f_Star module replaces the Darknet Bottleneck structure with the StarNet structure, including the following processing steps: Step 1: Perform layer normalization on the output of the previous layer; Step 2: Apply depthwise separable convolution to the normalized output of the layer. Step 3: Feed the output of the depthwise separable convolution into at least two linear transformation layers. Step 4: Pass one branch of the output of step 3 through the GELU activation function and perform element-wise addition or multiplication operation with the other branch; Step 5: Perform element-wise addition operation on the output of step 4 and the input features of step 1.
4. The method according to claim 1, wherein The calculation of the NWD loss function includes: Model the predicted box and the true box as a two-dimensional Gaussian distribution; The normalized Wasserstein distance between the two is calculated as the loss term and weighted summed with the CIoU loss.
5. The method according to claim 1, wherein Before model deployment, it also includes: The LAMP pruning algorithm is used to perform layer-adaptive pruning on the model, pruning parameters whose absolute weight values are lower than the dynamic threshold; The pruned model is fine-tuned to restore accuracy.
6. A curtain fabric light transmittance defect detection system, characterized in that: include: An invisible light imaging unit, used for collecting invisible light transmission images of curtain fabrics through an invisible light source and a camera; A processing unit, running the improved YOLOv8 model according to any one of claims 1 to 5; Output unit for visualizing defect detection results and generating quality reports.
7. The system according to claim 6, characterized in that The invisible light imaging unit includes: Invisible light LED array light source with a wavelength range of 850-1550nm; High-resolution CMOS camera with invisible light filter, frame rate ≥60fps.
8. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein when the processor executes the computer program in the memory, the method steps according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium, characterized in that Computer instructions are stored, and when the instructions are executed by a processor, the method steps according to any one of claims 1 to 5 are implemented.
10. A curtain fabric production line quality control system, characterized in that: The detection system as claimed in claim 6 or 7 is integrated and linked with the deviation correction device of the production line to adjust the production process parameters in real time according to the detection results.