Fabric surface defect feature detection method and system based on YOLOv5-Fibre
Through the YOLOv5-Fibre-based fabric surface defect feature detection method, the traditional manual detection speed and low accuracy are solved, and automated, fast and accurate fabric defect detection is realized, which improves production efficiency and product quality.
Patent Information
- Application Number
- CN202411445248.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-03-11
AI Technical Summary
The traditional textile industry relies on manual detection of fabric defects, resulting in slow detection speed, low accuracy, and damage to workers' health.
Using YOLOv5-Fibre-based fabric surface defect feature detection method, the YOLOv5-Fibre network model is established to train and detect the warp-knitted fabric defect data set to achieve automated, fast and accurate defect recognition.
Improves the efficiency and accuracy of fabric defect detection, reduces the health risks brought by manual testing, and reduces production costs.
Smart Images

Figure CN119600326A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of fabric surface defect feature detection, and in particular to a fabric surface defect feature detection method and system based on YOLOv5-Fibre. Background Art
[0002] The textile industry has a long history in my country. It is a traditional advantage enterprise in my country's economic development and has an important impact on my country's economy and employment. In the manufacturing process of textiles, various factors such as human, machine, and material can cause various fabric defects, such as scratches, stains, sparseness, shrinkage, etc. Fabric defect detection is an important means to control the quality of textiles. It has a great role in improving the production efficiency and product quality of the textile industry. At the same time, it can also reduce production costs and promote the development of the textile industry. The traditional textile industry has always relied on manual fabric defect detection. Human work fatigue and subjective judgment can lead to problems such as false detection and missed detection. In addition, the speed of manual detection is slow, which is both inefficient and costly for large-scale industrial production. In order to solve the problems caused by manual fabric detection and realize automatic, fast and accurate identification of fabric defects, a fabric surface defect feature detection method based on YOLOv5-Fibre is proposed. Summary of the invention
[0003] In view of the above existing problems, the present invention is proposed.
[0004] Therefore, the present invention provides a fabric surface defect feature detection method based on YOLOv5-Fibre to solve the problems of slow manual detection speed and low accuracy. At the same time, it can also avoid the damage to workers' health in a humid and noisy environment for a long time.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions, a method for detecting fabric surface defects based on YOLOv5-Fibre, comprising:
[0006] Select the warp knitted fabric pictures with defects from all the collected pictures;
[0007] Select defective images and good fabric images with different substrates from the obtained warp knitted fabric images to form a warp knitted fabric defect dataset, and then use the annotation tool to annotate them. Then use the mosaic data augmentation, random image fusion enhancement, and random image cropping enhancement to expand the warp knitted fabric defect dataset and obtain the training set and test set.
[0008] Establish a YOLOv5-Fibre network model;
[0009] The established YOLOv5-Fibre network model is used to train the dataset;
[0010] Input the image to be tested, use the trained YOLOv5-Fibre network model to test it, and output the test result;
[0011] The obtained test set is used to evaluate the model.
[0012] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the selecting of defective warp knitted fabric images includes using a camera acquisition device that does not affect production conditions, adjusting and controlling the light source brightness parameters, and acquiring warp knitted fabric images on an actual production line when the camera can acquire images.
[0013] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the obtaining of the training set and the test set includes selecting pictures containing defect information and cloth pictures containing different substrate information from the original warp knitted fabric defect pictures obtained, using the selected pictures to form a warp knitted fabric defect data set, and at the same time using mosaic data addition, random picture fusion enhancement, and picture random cropping enhancement to enhance the warp knitted fabric defect information and expand the data set;
[0014] Use annotation tools to annotate the warp knitted fabric dataset. The marking content includes the name of the warp knitted fabric defect, accurate coordinate information, the size of the warp knitted fabric image, and the storage path information. The marking information is generated into a ######.xml file and finally converted into the txt format required by YOLO to obtain the training set and test set samples of warp knitted fabric defects.
[0015] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the establishment of the YOLOv5-Fibre network model includes a MobileNet feature extraction network, which is mainly composed of a deep separable convolution, an inverse residual structure, and a SENet attention mechanism; the deep separable convolution uses point-by-point convolution to ensure the feature extraction ability of the network while performing deep convolution on the input image to reduce the number of parameters and improve the calculation efficiency; the use of the inverse residual structure reduces the phenomenon of key feature information loss during network feature extraction caused by the increase in network depth; the introduction of the SENet attention mechanism establishes a relationship between channels in the network, and improves the feature expression ability of the network;
[0016] The clustering algorithm D-Kmeans++ is obtained by replacing the Euclidean distance calculation method with the DIOU distance calculation method. The D-Kmeans++ clustering algorithm randomly selects a sample point from the annotation information of the warp knitted fabric defect data set as the first initial clustering sample point, calculates the shortest distance D(z) between each sample point and the current cluster center, and then calculates the probability P(z) of each sample point being selected as the next cluster center:
[0017]
[0018]
[0019] Where IoU represents the intersection-over-union ratio of two labeled boxes, b and b gt represents the center coordinates of the two annotation frames of the fabric defect, ρ 2 (b,b gt ) represents the square of the Euclidean distance between the two center coordinates, c 2 It represents the square of the diagonal distance of the minimum closure area that can contain two annotation boxes at the same time. A and B represent the area enclosed by the fabric defect annotation box. A∩B represents the intersection between the two boxes, and A∪B represents the union between the two boxes.
[0020] The RepLKDeXt network module is composed of a large convolution kernel RepLKBlock combined with an inverse residual structure. According to the effective receptive field theory, the larger the convolution kernel, the larger the effective receptive field of the network. A larger receptive field can obtain a wider range of feature information in the image, which can more effectively understand the global structure and semantic information in the image, and can also improve the network's attention to shape deviations.
[0021] The PWConv convolution module consists of partial convolution PConv and point-by-point convolution. PConv first divides the input channels and only performs convolution on a part of the input channels to extract their spatial features. This reduces the network's repeated calculation of redundant input features, reduces the network's calculation amount, and improves the network's reasoning speed. After PConv, point-by-point convolution is used to communicate the input feature information in all channels.
[0022] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the training of the data set includes, during training, first initializing the model parameters, then preprocessing the warp knitted fabric data set, and then inputting the preprocessed warp knitted fabric data set into the backbone feature extraction network optimized by MobileNet and RepLKDeXt, obtaining the extracted feature map and inputting it into the neck network module optimized by RepLKDeXt and PWConv for feature fusion, and finally inputting the feature maps of different scales into the detect part of the head layer, using the loss function to back propagate and update the relevant weight parameters therein, and finally using the verification set to verify the model of each stage to obtain the trained YOLOv5 warp knitted fabric detection model;
[0023] The YOLOv5 network includes: input, backbone, neck and head.
[0024] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the detection using the trained YOLOv5-Fibre network model includes:
[0025] Use the loss function Loss to back propagate the training model at each stage. The loss function in YOLOv5 is mainly composed of the confidence loss function L obj , classification loss function L cls , rectangular box loss function L box composition:
[0026]
[0027] L obj = -ylog(p)-(1-y)log(1-p)
[0028] L cls = -ylog(p)-(1-y)log(1-p)
[0029]
[0030] In the formula, α, The role of δ is to balance the weights of the three losses of confidence loss, classification loss, and rectangular box loss in the total loss. y represents the true label and p represents its corresponding confidence. p , B gt Represent the coordinates of the center points of the predicted box and the real box respectively, Represents the Euclidean distance between the center point of the predicted box and the true box, wc 、h c They represent the width and height of the minimum outer rectangle of the prediction box and the target box, respectively. p 、w gt are the width and height of the prediction box, h p 、h gt The decibels are the width and height of the real box.
[0031] As a preferred solution of the fabric surface defect feature detection method based on YOLOv5-Fibre described in the present invention, wherein: the test set evaluates the model including using precision P, recall rate R and average detection accuracy mAP as evaluation indicators to verify the optimized YOLOv5 model;
[0032]
[0033] In the above formula, TP represents the number of correctly predicted positive samples, FP represents the number of negative samples predicted as positive samples, AP refers to the accuracy of the network model in identifying each category to be detected, R refers to the recall rate, which refers to the proportion of all true positive samples that are correctly predicted as positive samples by the model, and FN refers to the number of positive samples that are incorrectly predicted as negative samples;
[0034] Use an industrial camera to obtain warp knitted fabric defect images, then input the acquired images into the network for defect detection, and use a meter to accurately record the defect location for feedback.
[0035] As a preferred solution of the fabric surface defect feature detection system based on YOLOv5-Fibre described in the present invention, the system includes a warp knitted fabric data acquisition module, which uses a camera to collect original pictures of the warp knitted fabric and construct a warp knitted fabric defect data set;
[0036] The training module inputs the constructed warp knitted fabric defect dataset into the optimized YOLOv5-Fibre network for training to obtain a detection model;
[0037] The detection module identifies defects in warp knitted fabric images based on the trained YOLOv5-Fibre detection model;
[0038] The defect feedback module uses an encoder and a single-chip microcomputer to form the hardware part of the meter. The host computer serial communication part is combined with the hardware part to realize the metering device, which can accurately record the location of the defect and feed it back to the subsequent processing program.
[0039] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, steps of a method for detecting surface defects of fabrics based on YOLOv5-Fibre are implemented.
[0040] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of a method for detecting surface defects of fabrics based on YOLOv5-Fibre are implemented.
[0041] The beneficial effects of the present invention are as follows: First, the fabric surface defect feature detection method based on YOLOv5-Fibre can enable the fabric inspection machine to stably maintain a constant fabric inspection speed of 100m / min, thereby ensuring the efficiency of fabric inspection and improving production capacity. Secondly, the accuracy of manual inspection will decrease with the fatigue caused by the increase in working time. The fabric surface defect feature detection method based on YOLOv5-Fibre can stably guarantee the accuracy of detection, and at the same time accurately identify defects that are not easily detected by the human eye, thereby improving the quality of the product. Finally, working in a humid and noisy working environment for a long time will cause damage to the health of workers, and the use of the fabric surface defect feature detection method based on YOLOv5-Fibre can avoid these problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0043] Figure 1 A schematic flow chart of a method for detecting fabric surface defect features based on YOLOv5-Fibre is provided for one embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0045] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0046] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0047] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0048] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0049] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0050] Example 1, reference Figure 1 , which is the first embodiment of the present invention, provides a fabric surface defect feature detection method based on YOLOv5-Fibre, comprising:
[0051] Step 1: Select the warp knitted fabric images with defects from all the collected images;
[0052] Step 2: Select defective images and good fabric images with different substrates from the warp knitted fabric images obtained in step 1 to form a warp knitted fabric defect dataset, and then use the annotation tool to annotate them. Then, the annotated defect dataset is enhanced by mosaic data addition, random image fusion enhancement, and random image cropping enhancement to expand the warp knitted fabric defect dataset, and finally obtain the training set and test set;
[0053] Step 3: Establish a YOLOv5-Fibre network model;
[0054] Step 4: Use the YOLOv5-Fibre network model established in step 3 to train the data set;
[0055] Step 5: Input the image to be detected, detect it using the YOLOv5-Fibre network model trained in step 4, and output the detection result;
[0056] Step 6: Evaluate the model using the test set obtained in step 2. The present invention realizes the rapid and accurate function of fabric defect detection;
[0057] In the step 1, a clear and complete picture of the original warp knitted fabric is obtained, which is specifically implemented as follows: using a camera acquisition device that does not affect the production conditions, adjusting and controlling the light source brightness parameters when the camera can obtain a clear picture, and collecting the warp knitted fabric picture on the actual production line.
[0058] The step 2 is implemented according to the following process: select pictures containing defect information and good cloth pictures containing different substrate information from the original warp knitted fabric defect pictures obtained in step 1, use the selected pictures to form a warp knitted fabric defect data set, and the warp knitted fabric pictures of different categories of substrates without any defects slow down the phenomenon that the same defect information presents different features on different substrates and the defect features are difficult to accurately extract when the substrate features are similar to the warp knitted fabric defects, thereby enhancing the feature recognition ability of the network, and using mosaic data increase, random picture fusion enhancement, and picture random cropping enhancement to enhance the warp knitted fabric defect information, expand the data set, and enhance data diversity. Use a labeling tool to label the warp knitted fabric data set, and the labeling content includes the name of the warp knitted fabric defect, accurate coordinate information, the size of the warp knitted fabric picture, and the information of the storage path, and generate the labeling information into a ######.xml file, and finally convert it into the txt format required by yolo to obtain the training set and test set samples of the warp knitted fabric defects.
[0059] The step 3 establishes a YOLOv5-Fibre network model and is implemented according to the following process:
[0060] Step 31: MobileNet feature extraction network, which is mainly composed of depthwise separable convolution, inverse residual structure, and SENet attention mechanism. While depthwise separable convolution performs deep convolution on the input image to reduce the number of parameters and improve computational efficiency, it uses point-by-point convolution to ensure the network's feature extraction capability. The use of inverse residual structure alleviates the phenomenon of key feature information loss during network feature extraction caused by increased network depth. The introduction of SENet attention mechanism establishes the relationship between channels in the network and improves the network's feature expression capability;
[0061] Step 32: The clustering algorithm D-Kmeans++ is obtained by replacing the Euclidean distance calculation method with the DIOU distance calculation method. The introduction of the DIOU distance calculation method solves the problem that when the width and height of the warp knitted fabric defect annotation information are large, large errors are easily generated during clustering. The D-Kmeans++ clustering algorithm randomly selects a sample point from the annotation information of the warp knitted fabric defect data set as the first initial clustering sample point, calculates the shortest distance D(z) between each sample point and the current cluster center, and then calculates the probability P(z) of each sample point being selected as the next cluster center:
[0062]
[0063] In formula (1), IoU represents the intersection-over-union ratio of two labeled boxes, b and b gt represents the center coordinates of the two annotation frames of the fabric defect, ρ 2 (b,b gt ) represents the square of the Euclidean distance between the two center coordinates, c 2 It represents the square of the diagonal distance of the minimum closure area that can contain two annotation boxes at the same time. In formula (2), A and B represent the area enclosed by the fabric defect annotation box, A∩B represents the intersection between the two boxes, and A∪B represents the union between the two boxes.
[0064] Step 33: The RepLKDeXt network module is composed of a large convolution kernel RepLKBlock combined with an inverse residual structure. According to the effective receptive field theory, the larger the convolution kernel, the larger the effective receptive field of the network. A larger receptive field can obtain a wider range of feature information in the image, which can more effectively understand the global structure and semantic information in the image, and can also increase the network's attention to shape deviations. The use of the inverse residual structure reduces the loss of key feature information during network feature extraction due to the increase in network depth.
[0065] Step 34: The PWConv convolution module consists of partial convolution (PConv) and point-by-point convolution. PConv first divides the input channels and only performs convolution on a part of the input channels to extract their spatial features. This reduces the network's repeated calculation of redundant input features, reduces the network's calculation amount, and improves the network's reasoning speed. After PConv, point-by-point convolution is used to communicate the input feature information in all channels, ensuring feature diversity and improving the network's spatial feature extraction capability.
[0066] The YOLOv5 network includes: input, backbone, neck, and head. During training, the model parameters are initialized first, and then the warp knitted fabric dataset is preprocessed. The preprocessed warp knitted fabric dataset is input into the backbone feature extraction network optimized by MobileNet and RepLKDeXt. The extracted feature maps are input into the neck network module optimized by RepLKDeXt and PWConv for feature fusion. Finally, the feature maps of different scales are input into the detect part of the head layer, and the loss function is back-propagated to update the relevant weight parameters. Finally, the model of each stage is verified using the validation set to obtain the trained YOLOv5 warp knitted fabric detection model.
[0067] Use the loss function (Loss) to back propagate the training model at each stage. The loss function in YOLOv5 is mainly composed of the confidence loss function (L obj ), classification loss function (L cls ), rectangular box loss function (L box )composition:
[0068]
[0069] L obj =-ylog(p)-(1-y)log (1-p) (5)
[0070] L cls = -ylog(p)-(1-y)log(1-p) (6)
[0071]
[0072] In the formula, α, The role of δ is to balance the weights of the three losses, namely, confidence loss, classification loss, and rectangular box loss, in the total loss. In formulas (5) and (6), y represents the true label, and p represents its corresponding confidence. p , B gt Represent the coordinates of the center points of the predicted box and the real box respectively. Represents the Euclidean distance between the center point of the predicted box and the true box, w c 、h c They represent the width and height of the minimum outer rectangle of the prediction box and the target box, respectively. p 、w gt are the width and height of the prediction box, h p 、h gt The decibels are the width and height of the real box.
[0073] The method for verifying the model at each stage mainly uses: precision P, recall rate R and average detection accuracy mAP as evaluation indicators to verify the optimized YOLOv5 model.
[0074]
[0075] In the above formula, TP represents the number of samples correctly predicted as positive, and FP represents the number of negative samples predicted as positive. AP refers to the accuracy of the network model in identifying each category to be detected, R refers to the recall rate, which refers to the proportion of all true positive samples that are correctly predicted as positive by the model, and FN refers to the number of positive samples that are incorrectly predicted as negative.
[0076] The method for performing defect detection on a warp knitted fabric according to a trained YOLOv5-Fibre network model includes: using an industrial camera to obtain a warp knitted fabric defect image, then inputting the obtained image into a network for defect detection, and accurately recording the defect position through a meter for feedback.
[0077] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
[0078] Embodiment 2, the second embodiment of the present invention, provides a fabric surface defect feature detection system based on YOLOv5-Fibre, including:
[0079] The warp knitted fabric data acquisition module uses a camera to collect original pictures of the warp knitted fabric and construct a warp knitted fabric defect dataset;
[0080] The training module inputs the constructed warp knitted fabric defect dataset into the optimized YOLOv5-Fibre network for training to obtain a detection model;
[0081] The detection module identifies defects in warp knitted fabric images based on the trained YOLOv5-Fibre detection model;
[0082] The defect feedback module uses encoders and single-chip microcomputers to form the hardware part of the meter. The host computer serial communication part is combined with the hardware part to realize the meter device, which can accurately record the location of the defect and feedback it to the subsequent processing program.
[0083] Example 3
[0084] The third embodiment of the present invention is different from the first two embodiments in that:
[0085] 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 a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0086] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0087] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0088] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0089] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0090] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A fabric surface defect feature detection method based on YOLOv5-Fibre, characterized by: include, Select the warp knitted fabric pictures with defects from all the collected pictures; Select defective images and good fabric images with different substrates from the obtained warp knitted fabric images to form a warp knitted fabric defect dataset, and then use the annotation tool to annotate them. Then use the mosaic data augmentation, random image fusion enhancement, and random image cropping enhancement to expand the warp knitted fabric defect dataset and obtain the training set and test set. Establish a YOLOv5-Fibre network model; The established YOLOv5-Fibre network model is used to train the dataset; Input the image to be tested, use the trained YOLOv5-Fibre network model to test it, and output the test result; The obtained test set is used to evaluate the model.
2. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 1, characterized in that: The method of selecting defective warp knitted fabric images includes using a camera acquisition device that does not affect production conditions, adjusting and controlling light source brightness parameters, and acquiring warp knitted fabric images on an actual production line when the camera is able to acquire images.
3. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 2, characterized in that: The obtaining of the training set and the test set comprises selecting pictures containing defect information and cloth pictures containing different substrate information from the original warp knitted fabric defect pictures, using the selected pictures to form a warp knitted fabric defect data set, and simultaneously using mosaic data addition, random picture fusion enhancement, and picture random cropping enhancement to perform data enhancement on the warp knitted fabric defect information, thereby expanding the data set; Use annotation tools to annotate the warp knitted fabric dataset. The marking content includes the name of the warp knitted fabric defect, accurate coordinate information, the size of the warp knitted fabric image, and the storage path information. The marking information is generated into a ######.xml file and finally converted into the txt format required by YOLO to obtain the training set and test set samples of warp knitted fabric defects.
4. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 3, characterized in that: The YOLOv5-Fibre network model is established, including a MobileNet feature extraction network, which is mainly composed of a deep separable convolution, an inverse residual structure, and a SENet attention mechanism; the deep separable convolution uses point-by-point convolution to ensure the feature extraction capability of the network while performing deep convolution on the input image to reduce the number of parameters and improve the computational efficiency; the use of the inverse residual structure reduces the phenomenon of key feature information loss during network feature extraction caused by the increase in network depth; the introduction of the SENet attention mechanism establishes a relationship between channels in the network, and improves the feature expression capability of the network; The clustering algorithm D-Kmeans++ is obtained by replacing the Euclidean distance calculation method with the DIOU distance calculation method. The D-Kmeans++ clustering algorithm randomly selects a sample point from the annotation information of the warp knitted fabric defect data set as the first initial clustering sample point, calculates the shortest distance D(z) between each sample point and the current cluster center, and then calculates the probability P(z) of each sample point being selected as the next cluster center: In the formula, IoU represents the intersection-over-union ratio of two labeled boxes, b and b gt represents the center coordinates of the two annotation frames of the fabric defect, ρ 2 (b,b gt ) represents the square of the Euclidean distance between the two center coordinates, c 2 It represents the square of the diagonal distance of the minimum closure area that can contain two annotation boxes at the same time. A and B represent the area enclosed by the fabric defect annotation box. A∩B represents the intersection between the two boxes, and A∪B represents the union between the two boxes. The RepLKDeXt network module is composed of a large convolution kernel RepLKBlock combined with an inverse residual structure. According to the effective receptive field theory, the larger the convolution kernel, the larger the effective receptive field of the network. A larger receptive field can obtain a wider range of feature information in the image, which can more effectively understand the global structure and semantic information in the image, and can also improve the network's attention to shape deviations. The PWConv convolution module consists of partial convolution PConv and point-by-point convolution. PConv first divides the input channels and only performs convolution on a part of the input channels to extract their spatial features. This reduces the network's repeated calculation of redundant input features, reduces the network's calculation amount, and improves the network's reasoning speed. After PConv, point-by-point convolution is used to communicate the input feature information in all channels.
5. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 4, characterized in that: The training of the data set includes, during the training, first initializing the model parameters, then preprocessing the warp knitted fabric data set, and then inputting the preprocessed warp knitted fabric data set into the backbone feature extraction network optimized by MobileNet and RepLKDeXt, obtaining the extracted feature map and inputting it into the neck network module optimized by RepLKDeXt and PWConv for feature fusion, and finally inputting the feature maps of different scales into the detect part of the head layer, using the loss function to back propagate and update the relevant weight parameters therein, and finally using the verification set to verify the model of each stage to obtain the trained YOLOv5 warp knitted fabric detection model; The YOLOv5 network includes: input, backbone, neck and head.
6. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 5, characterized in that: The detection using the trained YOLOv5-Fibre network model includes: Use the loss function Loss to back propagate the training model at each stage. The loss function in YOLOv5 is mainly composed of the confidence loss function L obj , classification loss function L cls , rectangular box loss function L box composition: L obj =-ylog(p)-(1-y)log(1-p) L cls =-ylog(p)-(1-y)log(1-p) In the formula, α, The role of δ is to balance the weights of the three losses of confidence loss, classification loss, and rectangular box loss in the total loss. y represents the true label and p represents its corresponding confidence. p , B gt Represent the coordinates of the center points of the predicted box and the real box respectively, Represents the Euclidean distance between the center point of the predicted box and the true box, w c 、h c They represent the width and height of the minimum outer rectangle of the prediction box and the target box, respectively. p 、w gt are the width and height of the prediction box, h p 、h gt The decibels are the width and height of the real box.
7. The fabric surface defect feature detection method based on YOLOv5-Fibre according to claim 6, characterized in that: The test set evaluates the model by using precision P, recall R and mean average detection accuracy mAP as evaluation indicators to verify the optimized YOLOv5 model; In the above formula, TP represents the number of correctly predicted positive samples, FP represents the number of negative samples predicted as positive samples, AP refers to the accuracy of the network model in identifying each category to be detected, R refers to the recall rate, which refers to the proportion of all true positive samples that are correctly predicted as positive samples by the model, and FN refers to the number of positive samples that are incorrectly predicted as negative samples; Use an industrial camera to obtain warp knitted fabric defect images, then input the acquired images into the network for defect detection, and use a meter to accurately record the defect location for feedback.
8. A system using the fabric surface defect feature detection method based on YOLOv5-Fibre as claimed in any one of claims 1 to 7, characterized in that: The system includes, The warp knitted fabric data acquisition module uses a camera to collect original pictures of the warp knitted fabric and construct a warp knitted fabric defect data set; The training module inputs the constructed warp knitted fabric defect dataset into the optimized YOLOv5-Fibre network for training to obtain a detection model; The detection module identifies defects in warp knitted fabric images based on the trained YOLOv5-Fibre detection model; The defect feedback module uses an encoder and a single-chip microcomputer to form the hardware part of the meter. The host computer serial communication part is combined with the hardware part to realize the metering device, which can accurately record the location of the defect and feed it back to the subsequent processing program.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.