Fabric defect detection method and system

Through the combination of feature extraction backbone network and feature strengthening neck network, the problem of insufficient feature extraction capability in fabric defect detection is solved, the accuracy of detection of small defects is improved, missed and missed detection is reduced, and the implementation of More efficient fabric defect detection.

CN118691617BActive Publication Date: 2024-11-22SHAOXING DA GAMA TEXTILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411181266.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-11-22
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

The YOLO series algorithm has weak feature extraction capabilities in fabric defect detection, resulting in a low detection rate of micro-scale defects and prone to missed detection.

Method used

The feature extraction backbone network and feature strengthening neck network combination is used to extract primary feature maps through feature extraction backbone network, and the feature strengthening neck network is used to enhance feature expression capabilities, and detect it in combination with defect detection heads.

Benefits of technology

It improves the detection accuracy of small-scale fabric defects, reduces the probability of missed and missed inspections, and improves the comprehensiveness and accuracy of inspections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691617B_ABST
    Figure CN118691617B_ABST
Patent Text Reader

Abstract

The present invention provides a fabric defect detection method and system, which relates to the field of image processing technology. The method comprises: connecting a feature extraction backbone network, a feature enhancement neck network and a defect detection head in series in sequence to construct a fabric defect detection model based on a neural network; obtaining a fabric image; preprocessing the fabric image; extracting a primary feature map of the fabric image through the feature extraction backbone network; performing feature enhancement processing on the primary feature map through the feature enhancement neck network to obtain an enhanced feature map; and detecting a defect area in the fabric image according to the enhanced feature map through the defect detection head. The present invention can enhance the expressive power of features, better capture details and tiny defects in images, improve the detection accuracy of tiny-scale fabric defects, and reduce the probability of missed detection and false detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a fabric defect detection method and system. Background Art

[0002] Various defects can form on the fabric surface due to yarn problems, improper handling, and overstretching. These defects not only affect the appearance and quality of the textiles, but can also lead to product returns or customer complaints, increasing production costs and reputation risks. Therefore, fabric defect detection is an important part of textile manufacturing quality control. By promptly discovering and repairing these defects, product quality can be ensured, customer satisfaction can be improved, and economic losses can be reduced.

[0003] With the rising labor costs and improved automation in the textile industry, fabric defect detection has become a hot research area in recent years. Traditional manual detection methods are not only inefficient, but also limited by human eye fatigue and subjective factors, and are prone to missed or false detections. In order to improve detection efficiency and accuracy, more and more researchers and companies are beginning to explore the use of computer vision and machine learning technologies to achieve automated detection. This can not only reduce costs, but also improve production efficiency and product quality.

[0004] In the prior art, there are methods for realizing automatic fabric defect detection using the YOLO series of algorithms. The YOLO (You Only Look Once) algorithm performs well in many applications due to its fast and efficient target detection capabilities.

[0005] However, the YOLO series of algorithms also have some limitations in fabric defect detection. Due to YOLO's weak feature extraction ability, the detection rate of tiny defects is low and it is easy to miss detections. Summary of the invention

[0006] In order to solve the current technical problem that due to the weak feature extraction ability of YOLO, the detection rate of tiny-scale defects is low and missed detection is easy to occur, the present invention provides a fabric defect detection method and system.

[0007] The technical solution provided by the embodiment of the present invention is as follows:

[0008] First aspect:

[0009] A fabric defect detection method provided by an embodiment of the present invention includes:

[0010] S1: Connect the feature extraction backbone network, feature enhancement neck network and defect detection head in series to build a fabric defect detection model based on neural network;

[0011] S2: Get fabric image;

[0012] S3: preprocessing the fabric image;

[0013] S4: extracting a primary feature map of the fabric image through the feature extraction backbone network;

[0014] S5: performing feature enhancement processing on the primary feature map through the feature enhancement neck network to obtain an enhanced feature map;

[0015] S6: Detecting defect areas in the fabric image according to the enhanced feature map through the defect detection head.

[0016] Second aspect:

[0017] A fabric defect detection system provided by an embodiment of the present invention includes:

[0018] processor;

[0019] A memory having computer-readable instructions stored therein, wherein when the computer-readable instructions are executed by the processor, the fabric defect detection method as described in the first aspect is implemented.

[0020] The third aspect:

[0021] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the fabric defect detection method as described in the first aspect is implemented.

[0022] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0023] In the present invention, a primary feature map of a fabric image is extracted through a feature extraction backbone network, and then a feature enhancement neck network is used to perform feature enhancement processing on the primary feature map to obtain an enhanced feature map, thereby enhancing the expressiveness of features and better capturing details and tiny defects in the image. Then, based on the enhanced feature map, a defect detection head is used to detect defect areas in the fabric image, thereby improving the detection accuracy of tiny-scale fabric defects and reducing the probability of missed detection and false detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.

[0025] Figure 1 A schematic flow chart of a fabric defect detection method provided by an embodiment of the present invention;

[0026] Figure 2 A schematic diagram of a feature fusion structure provided by an embodiment of the present invention;

[0027] Figure 3 A structural schematic diagram of a fabric defect detection system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0029] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.

[0030] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.

[0031] In the embodiments of the present invention, sometimes the subscripts such as W 1 It may be mistakenly written as a non-subscript form such as W1. When the difference is not emphasized, the meanings they express are the same.

[0032] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0033] Reference Manual Attached Figure 1 , showing a flow chart of a fabric defect detection method provided by an embodiment of the present invention.

[0034] The embodiment of the present invention provides a fabric defect detection method, which can be implemented by a fabric defect detection device, and the fabric defect detection device can be a terminal or a server. The processing flow of the fabric defect detection method can include the following steps:

[0035] S1: The feature extraction backbone network, feature enhancement neck network and defect detection head are connected in series to build a fabric defect detection model based on neural network.

[0036] Among them, the feature extraction backbone network is the basic part of the fabric defect detection model, which is responsible for extracting primary feature maps from the input image. Commonly used backbone networks include ResNet, DenseNet, VGG, EfficientNet, etc.

[0037] Among them, the feature enhancement neck network is located between the backbone network and the detection head. Its main function is to further process and enhance the primary feature map so that it contains more useful information, especially for the detection of minor defects. Common feature enhancement network structures include FPN (Feature Pyramid Network) and PANet (Path Aggregation Network).

[0038] The defect detection head is the final part of the model, responsible for specific defect detection and location based on the enhanced feature map. It consists of two parts: classification and regression, which are used to predict the category and precise location of the defect.

[0039] In the present invention, through the close cooperation of the feature extraction backbone network, the feature enhancement neck network and the defect detection head, the constructed fabric defect detection model can efficiently and accurately detect and locate various defects on the fabric, especially tiny defects, thereby improving the comprehensiveness and accuracy of detection.

[0040] S2: Acquire fabric image.

[0041] S3: Preprocess the fabric image.

[0042] In a possible implementation, S3 specifically includes: performing filtering and denoising, brightness balancing, contrast balancing, and cropping processing on the fabric image.

[0043] It should be noted that filtering denoising is to reduce the noise in the image by applying various filtering techniques (such as Gaussian filtering, median filtering, etc.). Brightness equalization is to adjust the overall brightness of the image to make it more uniform. Contrast equalization is to adjust the contrast of the image to make the details of the image clearer. Cropping is to crop the image to retain the area of ​​interest and remove unnecessary background.

[0044] S4: Extract the primary feature map of the fabric image through the feature extraction backbone network.

[0045] In a possible implementation, S4 specifically includes sub-steps S401 to S406:

[0046] S401: Extract the initial feature map of the fabric image through the first 3×3 convolution unit:

[0047]

[0048] in, X 1 represents the initial feature map, RELU represents the RELU activation function, Conv 1 represents the first convolutional unit, X Represents a fabric image.

[0049] It should be noted that the 3×3 convolution kernel can effectively capture the basic local features of the image, such as edges, corners, and textures. The RELU activation function introduces nonlinearity, enabling the network to learn more complex features.

[0050] S402: Copy the initial feature map into two copies, namely a first initial feature map and a second initial feature map.

[0051] S403: Convolution processing is performed on the first initial feature map through a second 7×7 convolution unit, a 5×5 deformable dilated convolution unit with a dilation rate of 1, and a third 3×3 convolution unit in sequence to obtain a convolution feature map:

[0052]

[0053] in, X 2 Represents the convolution feature map, Conv 2 represents the second convolution unit, DConv represents the deformable hole convolution unit, Conv 3 Represents the third convolutional unit.

[0054] It should be noted that the larger 7×7 convolution kernel can capture a wider range of contextual information and help understand global features. By introducing dilated convolution and deformable convolution, the network can adaptively adjust the shape and position of the convolution kernel to capture more complex and subtle features.

[0055] S404: Symmetrically flip the second initial feature map to obtain a flipped feature map:

[0056]

[0057] in, X 3 represents the flipped feature map, SF Represents a symmetric flip operation.

[0058] It should be noted that many fabric defects are symmetrical, and these symmetrical features can be better captured through symmetric flipping. Symmetric flipping is equivalent to data enhancement, which can increase the diversity of features and improve the robustness of the model.

[0059] S405: Perform element-by-element multiplication on the convolution feature map and the flip feature map, and perform convolution processing through the fourth 3×3 convolution unit to obtain a multiplied feature map:

[0060]

[0061] in, X 4 Represents the multiplication feature map, Conv 4 represents the fourth convolutional unit, Represents an element-wise multiplication operation.

[0062] It should be noted that the element-by-element multiplication operation can capture the interactive information between the convolution feature map and the flipped feature map and enhance the expression of the features.

[0063] S406: Add the multiplied feature map and the initial feature map, and perform convolution processing through the fifth 3×3 convolution unit to obtain a primary feature map:

[0064]

[0065] in, X 5 Represents the primary feature map, Conv 5 Represents the fifth convolutional unit.

[0066] In the present invention, the feature extraction backbone network can effectively extract rich, diverse and multi-scale primary feature maps from fabric images. These feature maps contain the global context information, detail information and symmetry features of the image, laying a solid foundation for subsequent feature enhancement and defect detection. Overall, these steps not only enhance the ability of feature extraction, but also improve the robustness and detection accuracy of the model.

[0067] S5: The primary feature map is feature enhanced through the feature enhancement neck network to obtain an enhanced feature map.

[0068] In a possible implementation, S5 specifically includes sub-steps S501 to S504:

[0069] S501: The primary feature map is convolved through a 9×9 large kernel convolution unit to obtain a large receptive area feature map:

[0070]

[0071] in, X 6 Represents a large receptive area feature map. BConv represents a large kernel convolution unit. X 5 Represents the primary feature map.

[0072] It should be noted that the 9×9 large kernel convolution can capture a wider range of contextual information, which helps to more comprehensively understand the global features in the image. Large kernel convolution can integrate more local features and enhance the recognition ability of complex structures and large-scale features.

[0073] S502: Introduce the channel dimension attention mechanism and the spatial dimension attention mechanism, add the attention weight to the large receptive area feature map, and obtain the spatial attention feature map:

[0074]

[0075] in, X 7 represents the channel attention feature map, M c represents the channel attention weight function, represents element-wise multiplication operation, X 8 represents the spatial attention feature map, M s represents the spatial attention weight function.

[0076] It should be noted that the channel dimension attention mechanism can highlight important feature channels and suppress irrelevant or redundant channel information by weighting different channels. The spatial dimension attention mechanism can highlight important feature areas and reduce background and noise interference by weighting different spatial positions. The attention mechanism can dynamically adjust the weight of the feature map, so that the model can focus more on useful features and improve the accuracy and distinguishing ability of feature expression.

[0077] S503: Perform convolution processing on the spatial attention feature map through a depth-wise separable convolution unit to obtain an intermediate feature map:

[0078]

[0079] in, X 9 represents the intermediate feature map and DWConv represents the depthwise separable convolutional unit.

[0080] It should be noted that the depthwise separable convolution decomposes the standard convolution into depthwise convolution and pointwise convolution, which significantly reduces the amount of calculation and parameters and improves the calculation efficiency. The depthwise convolution focuses on the spatial features of each channel, and the pointwise convolution integrates the information across channels, which helps to better preserve the image details and local features.

[0081] S504: Add the intermediate feature map to the primary feature map to obtain an enhanced feature map:

[0082]

[0083] in, X 10 Represents the enhanced feature map.

[0084] In the present invention, through these steps of feature enhancement neck network, the primary feature map is significantly enhanced. Large kernel convolution expands the receptive field, the attention mechanism highlights important features, the depthwise separable convolution improves computational efficiency and retains detail information, and the final feature fusion enhances the feature expression ability, better captures the details and minor defects in the image, and can improve the detection accuracy of minor fabric defects.

[0085] S6: Detect defect areas in the fabric image based on the enhanced feature map through the defect detection head.

[0086] Reference Manual Attached Figure 2 , showing a structural schematic diagram of a feature fusion provided by the present invention.

[0087] In a possible implementation, S6 specifically includes:

[0088] S601: The enhanced feature maps outputted at different levels are fused through the transmission connection unit to obtain a fused feature map.

[0089] Among them, the TCB (Transfer Connection Block) transfer connection unit is a module used for feature fusion and transmission in neural networks, and is often used for the integration and information transmission of multi-scale feature maps. TCB can effectively combine feature maps from different levels to improve the network's feature expression ability and detection performance.

[0090] It should be noted that feature maps at different levels contain information of different scales and depths. Through fusion processing, these multi-level information can be comprehensively utilized to enhance the expressiveness of feature maps.

[0091] Optionally, the transmission connection unit includes a first transmission connection unit and a second transmission connection unit, and S601 specifically includes:

[0092] S6011: Perform primary fusion of enhanced feature maps output from different levels through the first transmission connection unit:

[0093]

[0094] in, Z 1 Represents the primary fusion feature map of the first level, TCB 1 represents the first transmission connection unit, Y 1 represents the enhanced feature map of the first level output, nonerepresents a blank image, Z i Indicates i The primary fusion feature map of the level, Z i-1 Indicates i -1 level primary fusion feature map, Y i Indicates i The enhanced feature map of the layer output, , n Indicates the total level.

[0095] It should be noted that, through the first transmission connection unit, information can be smoothly transmitted between layers to reduce the inconsistency between feature maps. Through layer-by-layer fusion, feature maps of different layers can be gradually integrated to ensure that the feature information of each layer can be fully utilized, so that the model can capture large-scale global information and pay attention to small-scale local details.

[0096] S6012: Through the full convolution unit, the primary fusion feature maps of each level are convolved to obtain the full convolution feature maps of each level:

[0097]

[0098] in, U i Indicates i The fully convolutional feature map of the layer, FConv represents the fully convolutional unit.

[0099] It should be noted that by further convolution processing of the primary fusion feature map through the full convolution unit, more detailed and useful features can be extracted.

[0100] S6013: Advanced fusion of fully convolutional feature maps at different levels through the second transmission connection unit:

[0101]

[0102] in, V 1 Represents the high-level fusion feature map of the first level, TCB 2 represents the second transmission connection unit, U 1 represents the first-level fully convolutional feature map, V i Indicates i Hierarchical high-level fusion feature maps, V i-1 Indicates i -1 level of high-level fusion feature maps.

[0103] It should be noted that the second transmission connection unit can further enhance the information interaction between feature maps of different levels and improve the comprehensive expression ability of feature maps. Advanced fusion helps to integrate the information of feature maps of each layer, so that the final fused feature map contains more context information and detailed features.

[0104] In the present invention, feature information of different scales can be integrated through layer-by-layer and multi-level fusion, so that the model can focus on both global and local features at the same time.

[0105] S602: Summarize the fused feature maps of each level through a fully connected layer to obtain a summarized feature map.

[0106] It should be noted that the fully connected layer can integrate the features of each level to generate a comprehensive feature vector that represents the global information in the image.

[0107] Optionally, S602 specifically includes: aggregating primary fusion feature maps and high-level fusion feature maps of each level through a fully connected layer to obtain a summary feature map.

[0108] S603: Calculate the probability of each pixel belonging to the defect category according to the summary feature map:

[0109]

[0110] in, P represents the probability of belonging to the defect category, Softmax represents the Softmax activation function, W represents the weight matrix, V tot represents the summary feature map, b Represents the bias term.

[0111] It should be noted that the output of the network can be converted into a probability distribution through the Softmax activation function, thereby obtaining the probability that each pixel belongs to the defect category.

[0112] S604: Determine a defect area in the fabric image according to the probability that each pixel point belongs to a defect category.

[0113] Specifically, the defect probability of each pixel can be compared with the threshold value by thresholding to generate a binary mask. The processed binary mask is subjected to connected region analysis to identify and mark each connected defect region. For each connected region, its minimum bounding box is calculated as the bounding box to obtain the location information and size of the defect region.

[0114] In the present invention, the defect detection head can make full use of the enhanced feature maps at different levels, integrate the feature information of each layer, integrate them through the fully connected layer, and calculate the defect probability of each pixel through Softmax, and finally determine the defect area in the fabric image. This processing method has multiple advantages such as multi-level feature fusion, precise positioning, reduction of false detection and missed detection, improvement of detection accuracy and fine-grained detection, ensuring the efficiency and accuracy of fabric defect detection.

[0115] In a possible implementation, the fabric defect detection model is trained in the following manner:

[0116] Construct the loss function for the fabric defect detection model.

[0117] Optionally, the loss function of the fabric defect detection model is specifically:

[0118]

[0119] in, L represents the loss function, L C represents the cross entropy loss, l 1 represents the weight coefficient of cross entropy loss, L conf represents the confidence loss, l 2 Represents the weight coefficient of confidence loss, L IOU represents the detection box loss, l 3 Represents the weight coefficient of the detection box loss, i represents the model parameters, represents the calculation of the second norm, represents the regularization term, l 4 Represents the weight coefficient of the regularization term.

[0120] It should be noted that the cross entropy loss is used to optimize the classification accuracy and ensure that the model can correctly distinguish between defect and non-defect areas. The confidence loss is used to optimize the confidence score of the detection result, so that the model can effectively evaluate the confidence of the detection result when outputting the prediction. The detection box loss is used to optimize the position and size of the prediction box and increase the overlap between the prediction box and the true box, thereby enhancing the positioning accuracy of the model. The regularization term is used to prevent the model from overfitting and ensure that the model performs well on both training data and test data.

[0121] In the present invention, a multi-objective loss function is constructed by integrating cross entropy loss, confidence loss, detection box loss and regularization term, which can comprehensively optimize the performance of the fabric defect detection model. This method not only improves the accuracy of classification and positioning, but also enhances the robustness and generalization ability of the model, ensuring the stable performance of the model in different application scenarios.

[0122] Among them, those skilled in the art can set the weight coefficient of the cross entropy loss according to actual conditions. l 1 , the weight coefficient of confidence loss l 2 , weight coefficient of detection box loss l 3 And the weight coefficient of the regularization term l 4 The present invention does not limit the size.

[0123] Optionally, the cross entropy loss is specified as:

[0124]

[0125] in, m represents the number of samples, , S represents the number of categories, , p ij Indicates i The samples belong to j The classification of the categories, when the i The samples belong to j When the category ,otherwise, , q ij Indicates i The samples belong to j The predicted probability of each class.

[0126] Optionally, the confidence loss is specifically:

[0127]

[0128] in, m represents the number of samples, , S represents the number of categories, , q ij Indicates i The samples belong to j The predicted probability of each category, β represents the hyperparameter for balancing the number of positive and negative samples, cA hyperparameter that represents the balance between the prediction accuracy of positive and negative samples.

[0129] Optionally, the detection box loss is specifically:

[0130]

[0131] in, IOU Represents the intersection-over-union ratio of the predicted box and the true box, d Represents the Euclidean distance between the center point of the predicted box and the true box, c Represents the diagonal length of the minimum closure between the real box and the predicted box, α represents the trade-off parameter, v represents the consistency parameter, r () represents the center point Euclidean distance calculation function, b represents the prediction box, b gt represents the real frame, w gt Indicates the width of the real box, h gt Indicates the height of the real frame, w Indicates the width of the prediction box, h Indicates the height of the prediction box.

[0132] According to the loss function of the fabric defect detection model, the fabric defect detection model is trained by the gradient descent method.

[0133] Specifically, the model parameters are optimized by gradient descent method:

[0134]

[0135] in, i t+1 Indicates t +Model parameters at 1 iteration, i t Indicates t The model parameters at the iteration, or t Indicates t The adaptive learning rate at the iteration, Represents the loss function L Network parameters i t The gradient of β represents the momentum coefficient.

[0136] It should be noted that the introduction of the momentum term helps to reduce the oscillation of parameter updates during training, especially when faced with noisy gradients or complex loss surfaces, and can provide a smoother optimization path.

[0137] Optionally, the adaptive learning rate is calculated as:

[0138]

[0139] in, or min represents the minimum learning rate, or max represents the maximum learning rate, T max represents the maximum number of iterations, and cos represents the cosine function.

[0140] In the present invention, in the early stages of training, a higher learning rate helps to quickly find the convergence direction. In the later stages of training, a lower learning rate helps to carefully optimize the model parameters. By dynamically adjusting the learning rate, the model can be exposed to different learning rate ranges during the training process, which helps to improve the generalization ability of the model and reduce the risk of overfitting.

[0141] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0142] In the present invention, a primary feature map of a fabric image is extracted through a feature extraction backbone network, and then a feature enhancement neck network is used to perform feature enhancement processing on the primary feature map to obtain an enhanced feature map, thereby enhancing the expressiveness of features and better capturing details and tiny defects in the image. Then, based on the enhanced feature map, a defect detection head is used to detect defect areas in the fabric image, thereby improving the detection accuracy of tiny-scale fabric defects and reducing the probability of missed detection and false detection.

[0143] Reference Manual Attached Figure 3 , showing a structural schematic diagram of a fabric defect detection system provided by the present invention.

[0144] The present invention further provides a fabric defect detection system 20, which is applied to the above-mentioned fabric defect detection method, comprising:

[0145] Processor 201;

[0146] The memory 202 stores computer-readable instructions, and when the computer-readable instructions are executed by the processor 201, the fabric defect detection method described in the method embodiment is implemented.

[0147] The fabric defect detection system 20 provided by the present invention can execute the above-mentioned fabric defect detection method and achieve the same or similar technical effects. To avoid repetition, the present invention will not go into details.

[0148] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0149] In the present invention, a primary feature map of a fabric image is extracted through a feature extraction backbone network, and then a feature enhancement neck network is used to perform feature enhancement processing on the primary feature map to obtain an enhanced feature map, thereby enhancing the expressiveness of features and better capturing details and tiny defects in the image. Then, based on the enhanced feature map, a defect detection head is used to detect defect areas in the fabric image, thereby improving the detection accuracy of tiny-scale fabric defects and reducing the probability of missed detection and false detection.

[0150] It should be understood that the processor in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0151] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0152] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0153] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.

[0154] In the present invention, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0155] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0156] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0157] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0158] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0160] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0161] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0162] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the fabric defect detection method as described in the method embodiment is implemented.

[0163] A computer-readable storage medium provided by the present invention can implement the steps and effects of the fabric defect detection method of the above method embodiment. To avoid repetition, the present invention will not go into details.

[0164] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0165] In the present invention, a primary feature map of a fabric image is extracted through a feature extraction backbone network, and then a feature enhancement neck network is used to perform feature enhancement processing on the primary feature map to obtain an enhanced feature map, thereby enhancing the expressiveness of features and better capturing details and tiny defects in the image. Then, based on the enhanced feature map, a defect detection head is used to detect defect areas in the fabric image, thereby improving the detection accuracy of tiny-scale fabric defects and reducing the probability of missed detection and false detection.

[0166] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0167] There are a few points to note:

[0168] (1) The drawings of the embodiments of the present invention only involve structures related to the embodiments of the present invention. Other structures may refer to conventional designs.

[0169] (2) For the sake of clarity, in the drawings used to describe the embodiments of the present invention, the thickness of the film or region is exaggerated or reduced, that is, these drawings are not drawn according to the actual scale. It is understood that when an element such as a film, a region or a substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element or there may be intermediate elements.

[0170] (3) In the absence of conflict, the embodiments of the present invention and the features therein may be combined with each other to obtain new embodiments.

[0171] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A fabric defect detection method, characterized in that: include: S1: Connect the feature extraction backbone network, feature enhancement neck network and defect detection head in series to build a fabric defect detection model based on neural network; S2: Get fabric image; S3: preprocessing the fabric image; S4: extracting a primary feature map of the fabric image through the feature extraction backbone network; S5: performing feature enhancement processing on the primary feature map through the feature enhancement neck network to obtain an enhanced feature map; S6: Detecting a defect area in the fabric image according to the enhanced feature map by the defect detection head; The S4 specifically includes: S401: Extracting the initial feature map of the fabric image through the first 3×3 convolution unit: in, X 1 represents the initial feature map, RELU represents the RELU activation function, Conv1 represents the first convolution unit, X Represents a fabric image; S402: Copying the initial feature map into two copies, namely a first initial feature map and a second initial feature map; S403: Convolution processing is performed on the first initial feature map through a 7×7 second convolution unit, a 5×5 deformable hole convolution unit with a hole rate of 1, and a 3×3 third convolution unit in sequence to obtain a convolution feature map: in, X 2 represents the convolution feature map, Conv2 represents the second convolution unit, DConv represents the deformable hole convolution unit, and Conv3 represents the third convolution unit; S404: symmetrically flip the second initial feature map to obtain a flipped feature map: in, X 3 represents the flip feature map, SF Represents a symmetric flip operation; S405: performing element-by-element multiplication on the convolution feature map and the flip feature map, and performing convolution processing through a 3×3 fourth convolution unit to obtain a multiplied feature map: in, X 4 represents the multiplication feature map, Conv4 represents the fourth convolution unit, Represents element-by-element multiplication operation; S406: Add the multiplied feature map and the initial feature map, and perform convolution processing through a 3×3 fifth convolution unit to obtain the primary feature map: in, X 5 represents the primary feature map, Conv5 represents the fifth convolution unit; Wherein, the S5 specifically includes: S501: Perform convolution processing on the primary feature map through a 9×9 large kernel convolution unit to obtain a large receptive area feature map: in, X 6 represents a large receptive area feature map; BConv represents a large kernel convolution unit, X 5 represents the primary feature map; S502: Introduce the channel dimension attention mechanism and the spatial dimension attention mechanism, add the attention weight to the large receptive area feature map, and obtain the spatial attention feature map: in, X 7 represents the channel attention feature map, M c represents the channel attention weight function, represents element-wise multiplication operation, X 8 represents the spatial attention feature map, M s represents the spatial attention weight function; S503: Perform convolution processing on the spatial attention feature map through a depth-wise separable convolution unit to obtain an intermediate feature map: in, X 9 represents the intermediate feature map, DWConv represents the depthwise separable convolution unit; S504: Add the intermediate feature map to the primary feature map to obtain the enhanced feature map: in, X 10 represents the enhanced feature map; Wherein, the S6 specifically includes: S601: fusing enhanced feature maps outputted at different levels through a transmission connection unit to obtain a fused feature map; S602: Summarize the fusion feature maps of each level through a fully connected layer to obtain a summary feature map; S603: Calculate the probability of each pixel belonging to a defect category according to the summary feature map: in, P represents the probability of belonging to the defect category, Softmax represents the Softmax activation function, W represents the weight matrix, V tot represents the summary feature map, b represents the bias term; S604: Determine a defect area in the fabric image according to the probability that each pixel point belongs to a defect category; The transmission connection unit includes a first transmission connection unit and a second transmission connection unit, and S601 specifically includes: S6011: Performing primary fusion of enhanced feature maps outputted at different levels through the first transmission connection unit: in, Z 1 represents the primary fusion feature map of the first level, TCB1 represents the first transmission connection unit, Y 1 represents the enhanced feature map output by the first level, none represents a blank image, Z i Indicates i The primary fusion feature map of the level, Z i-1 Indicates i -1 level primary fusion feature map, Y i Indicates i The enhanced feature map of the layer output, , n Indicates the total level; S6012: Through the full convolution unit, the primary fusion feature maps of each level are convolved to obtain the full convolution feature maps of each level: in, U i Indicates i The fully convolutional feature map of the layer, FConv represents the fully convolutional unit; S6013: Performing advanced fusion of fully convolutional feature maps at different levels through the second transmission connection unit: in, V 1 represents the high-level fusion feature map of the first level, TCB2 represents the second transmission connection unit, U 1 represents the first-level fully convolutional feature map, V i Indicates i Hierarchical high-level fusion feature maps, V i-1 Indicates i -1 level of high-level fusion feature maps.

2. The fabric defect detection method according to claim 1, characterized in that: The S3 is specifically: The fabric image is subjected to filtering and denoising, brightness balancing, contrast balancing and cropping processing.

3. The fabric defect detection method according to claim 1, characterized in that: The S602 is specifically as follows: The primary fusion feature maps and the high-level fusion feature maps of each level are summarized through a fully connected layer to obtain the summarized feature map.

4. The fabric defect detection method according to claim 1, characterized in that: The training method of the fabric defect detection model is specifically as follows: Constructing a loss function of the fabric defect detection model; According to the loss function of the fabric defect detection model, the fabric defect detection model is trained by the gradient descent method.

5. The fabric defect detection method according to claim 4, characterized in that: The loss function of the fabric defect detection model is specifically: in, L represents the loss function, L C represents the cross entropy loss, λ 1 represents the weight coefficient of cross entropy loss, L conf represents the confidence loss, λ 2 represents the weight coefficient of confidence loss, L IOU represents the detection box loss, λ 3 represents the weight coefficient of the detection box loss, θ represents the model parameters, represents the calculation of the second norm, represents the regularization term, λ 4 represents the weight coefficient of the regularization term.

6. A fabric defect detection system, characterized in that: include: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the fabric defect detection method according to any one of claims 1 to 5 is implemented.