A cloth defect processing method based on machine vision

By using a pre-trained fabric defect detection model and segmented scoring algorithm, combined with conveyor belt track changing and template supplementation, the problems of defect type identification and insufficient intelligence in cutting schemes in fabric defect detection are solved, achieving efficient processing and high-value recycling of fabric defects.

CN116482125BActive Publication Date: 2026-07-24GUILIN UNIV OF ELECTRONIC TECH
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUILIN UNIV OF ELECTRONIC TECH
Filing Date
2023-05-04
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing fabric defect detection and treatment solutions cannot accurately distinguish defect types and make targeted annotations in actual industrial environments. The entire piece of fabric is treated as a whole to be processed, the cutting scheme has a low degree of intelligence, and the problem of scrapping caused by large-area textile defects has not been effectively solved.

Method used

A pre-trained fabric defect detection model identifies defect categories and locations. Combined with segmented scoring and the maximum rectangle area algorithm, targeted cutting is performed. A threshold is set to trigger a shutdown alarm. Combined with conveyor belt track changing and template replenishment, defective fabrics are processed efficiently.

Benefits of technology

It improves the accuracy and visualization of fabric defect detection, reduces large-scale defect scrapping caused by equipment failure, and realizes high-value recycling of fabrics and intelligent production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116482125B_ABST
    Figure CN116482125B_ABST
Patent Text Reader

Abstract

The application discloses a kind of cloth defect detection processing methods based on machine vision, comprising the following steps: step 1, defect detection;Step 2, large-area defect shutdown judgment;Step 3, defect recovery;Step 4, template supplement;Step 5, cloth segmentation score;Step 6, targeted cutting division;By this, the overall process is completed.Have the following technical effects:1, improve the efficiency of cloth defect detection processing in cloth production link;2, realize the standardization of subsequent processing flow of defective cloth;3, promote the high-value recycling of cloth containing defects in cloth production process.Change the existing actual production, solve the problem that the segmentation and targeted cutting of cloth in cloth defect review link rely on artificial discrimination, and the standardization degree is low;Realize cloth production intelligentization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fabric defect detection and processing, and specifically to a fabric defect processing method based on machine vision. Background Technology

[0002] In the textile industry, there is a so-called acceptable level for defects in a piece of fabric. It is not that the presence of a defect automatically means rejection and recycling. Within the acceptable range, the fabric is considered a qualified product. If the defect exceeds the acceptable range, the defective fabric needs to be processed. For example, targeted cutting and segmented scoring can be used to cut the defective fabric to reduce unnecessary costs. Existing defective fabric processing solutions are relatively immature, and there are few similar reference solutions. Therefore, it is necessary to explore a reasonable processing solution after fabric defect detection. Traditional fabric defect processing solutions mainly involve automatically labeling the defect after the type and location information of the defect is detected by target detection equipment.

[0003] For example, prior art 1 (patent number CN111929327A) provides a method and apparatus for detecting fabric defects. The method includes the following steps: acquiring a sample dataset, wherein the sample dataset contains multiple sample product images with fabric defects and multiple sample product images without fabric defects; determining the fabric type corresponding to the sample dataset; training a neural network using the sample dataset in a corresponding training method according to the fabric type to obtain a corresponding fabric defect detection model; acquiring a product image to be detected and determining the fabric type in the product image to be detected; inputting the product image to be detected with the determined fabric type into the corresponding fabric defect detection model to determine whether a fabric defect exists. The above technical solution uses a target detection method to detect corresponding fabric defects based on the type of fabric to be detected. Through targeted training, it can adapt to various fabric types to a certain extent. However, the detected defects are not labeled, thus failing to provide information for subsequent defective fabric processing.

[0004] To address the aforementioned issues, prior art 2 (patent number CN114529549A) proposes a machine vision-based method and system for labeling fabric defects. Specifically, it involves acquiring a surface image including the fabric texture, obtaining a corresponding grayscale image, and then obtaining a frequency domain image containing edge information from the grayscale image. Further, it acquires the periodic direction and texture direction of the texture in the grayscale image. Based on the grayscale co-occurrence matrix corresponding to the periodic direction and texture direction, it selects each pair of pixels in the grayscale co-occurrence matrix whose frequency exceeds a preset threshold as a texture unit. It acquires the co-occurrence run matrix corresponding to each texture unit in the periodic direction and texture direction, obtains abnormal texture units based on the grayscale co-occurrence matrix and co-occurrence run matrix, obtains interrupted pixel pairs based on the abnormal texture units, and obtains defective pixels based on the interrupted pixel pairs. This method avoids errors caused by noise points in the image itself, improving the efficiency and accuracy of fabric defect detection. The above technical solution uses image processing to annotate defects and return the planar location information of the defects. It achieves defect annotation through grayscale images. However, the method does not provide a solution on how to interact with the hardware system and implement defect annotation in actual production.

[0005] Therefore, in response to the above problems, prior art 3 (CN108593680A) proposes a cutting and sorting device for handling defective fabrics, including a frame, an operating platform, a fabric feeding roller, a cutting mechanism, a fabric pulling mechanism, a control mechanism, and a photoelectric sensor for detecting hole-like defects on the fabric. The control mechanism can control the fabric feeding roller, the cutting mechanism, the fabric pulling mechanism, the robotic arm, and the photoelectric sensor to perform the functions of feeding, cutting, pulling, adjusting the position of the action, and detecting hole-like defects, respectively. The control mechanism can also adjust the cutting mechanism to immediately cut the pulled fabric along its width direction when the photoelectric sensor does not detect hole-like defects and the fabric pulling mechanism has completed the preset pulling length, and when the photoelectric sensor detects hole-like defects. This technology can complete the detection, cutting and removal of fabric defects, pre-garment cutting, and sorting of defective and finished fabric pieces in one go. It has a high degree of automation, which helps to improve garment quality and fabric utilization and save production costs. However, this technology is only applicable to hole-like defects, which will have certain limitations in actual textile industrial production. Furthermore, this technology does not record the specific details of the cutting method, meaning that those skilled in the art cannot achieve cutting using this existing technology.

[0006] Based on the above technical analysis, it can be seen that existing fabric defect detection and treatment solutions have the following three characteristics:

[0007] 1. Existing defect detection and handling methods rely on labeling for defect labeling;

[0008] 2. Most existing solutions treat the entire piece of fabric as a single unit to be processed;

[0009] 3. Existing technologies have addressed the targeted cutting and processing of defective fabrics, but the cutting schemes have a low level of intelligence.

[0010] Based on the characteristics of the above-mentioned solutions, the application of existing fabric defect detection and treatment solutions faces the following difficulties:

[0011] 1. Due to the large variety of fabric defects and the similar appearance of different types of defects, the existing solutions mentioned above cannot accurately distinguish different defect types and make targeted defect markings in the actual complex industrial environment. This will also increase the training pressure and difficulty of operators in the subsequent defect review process.

[0012] 2. In actual industrial production, fabrics are wound up using roller devices, and the defect density in different areas of the entire fabric is not uniform. Treating the entire fabric as a whole to be processed does not meet the actual production needs. Therefore, how to segment and score the defects of fabrics containing defects is a problem that needs to be solved.

[0013] 3. The targeted cutting scheme for defective fabrics in the above technical solutions is relatively simple. However, in actual industrial production, the type, size, direction of the defects, and the density of defects in the current area will affect the yield of the fabric. How to use a more reasonable targeted cutting scheme to cut defective fabrics is also a problem that needs to be solved.

[0014] 4. When large-scale textile defects occur in the current production process due to inherent defects in the knitting and weaving equipment, how to automatically stop the production line and trigger alarms to avoid more serious losses is also a problem that needs to be solved. Summary of the Invention

[0015] The purpose of this invention is to provide a machine vision-based method for detecting and processing fabric defects. To address the aforementioned problems in the prior art and improve the accuracy, reliability, and visualization of the defect review process, the following principles are employed:

[0016] A pre-trained fabric defect detection model is used to identify defect categories and acquire location information. Fabric defect information is saved in the form of logs. When a defect is detected, the defect detection video stream is saved in three formats: screenshot, video, and GIF for subsequent defect review. This solves the problems of the inability to distinguish defect types in detail and the difficulty of defect review in the existing solution.

[0017] Furthermore, the entire defective fabric is scored in segments based on the principles of whether it contains defects and the defect density, providing a basis for targeted cutting of the defective fabric in the future.

[0018] Meanwhile, to address the issue of relatively simple cutting schemes, the system intelligently returns targeted cutting suggestions for defective fabrics in the form of long screenshots, based on segmented scoring and the maximum rectangle area algorithm.

[0019] In addition, to prevent serious losses caused by large-area textile defects, a method based on single defect, area, continuity judgment and total defect score per unit area is used, and corresponding thresholds are set. If the preset threshold is exceeded, a defect alarm is triggered and the machine is shut down, so as to significantly reduce the scrapping of fabrics caused by equipment failure.

[0020] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:

[0021] A machine vision-based method for detecting and processing fabric defects includes the following steps:

[0022] Step 1, Defect Detection: The video stream of an industrial camera is acquired by connecting to a host computer and fed into a pre-trained fabric defect detection model based on Faster R-CNN. The model can detect the category, confidence, and location information of fabric defects in each frame of the input video stream for use in subsequent steps.

[0023] Step 2, Large-area defect shutdown judgment: Process the fabric defect information in each frame of the video stream returned from the defect detection in Step 1 above, and simultaneously judge the length and area of ​​a single defect and the defect score density per unit area. If the preset threshold of the above judgment is exceeded, a defect shutdown alarm command is sent to the fabric production line and waits for the operator to check and reset. If the threshold is not exceeded, proceed to the next step.

[0024] The decision to halt operation due to large-area defects in step 2 is based on two parallel steps: determining the length and area of ​​a single defect, and determining the total defect score per unit area. Specifically:

[0025] Parallel step 2.1: Determine the length and area of ​​a single defect by using a pre-trained additional model to calculate the actual length and area of ​​the defect and determine its continuity.

[0026] If the detected defect exceeds the preset thresholds for defect length and area and is determined to be a continuous defect by the defect continuity judgment model, a defect shutdown alarm command is issued. If the thresholds are not exceeded, the above judgment is repeated.

[0027] Parallel step 2.2: Defect total score per unit area is judged. If it exceeds the preset defect score density threshold, a defect shutdown command is issued. If it does not exceed the threshold, the above judgment is repeated.

[0028] The automated judgment of large-area defect shutdown is achieved through parallel steps 2.1 and 2.2;

[0029] Taking a defective fabric that meets the criteria for large-area defect shutdown in the above steps as an example, after detecting that it meets the criteria for large-area defect shutdown, the host computer sends an audible and visual alarm and a shutdown command to the hardware system. The audible and visual alarm device will sound an alarm, and the fabric production line will shut down.

[0030] Step 3, Defect Recovery: If a large-area defect shutdown judgment was not issued in Step 2, then the defective fabric needs to be recovered. A schematic diagram of the defect recovery module is shown below. Figure 3 As shown, it includes a controllable track-changing device, a defective fabric recycling conveyor belt, a defective fabric recycling station that exceeds the threshold, and a bottom conveyor belt.

[0031] When performing defect recycling operations, the host computer sends a track-changing command to the controllable track-changing device of the hardware system, which transfers the defective fabric on the bottom conveyor belt to the defective fabric recycling conveyor belt. The defective fabric recycling conveyor belt then sends the fabric that needs to be recycled to the defective fabric recycling station that exceeds the threshold.

[0032] The aforementioned steps enable the recycling of defective fabrics after inspection.

[0033] Step 4, Template Supplementation: Since defective fabrics were recycled in the above steps, the fabrics to be tested in actual production are stored in stacks. In order to avoid disorder of the overall fabric stacking after the defective fabrics are recycled, template supplementation is required for the defective fabrics recycled in the above steps.

[0034] After the host computer issues a defect handling command, it retrieves a screenshot of the defective fabric after defect detection, taken from the pre-process, and obtains the template RGB histogram information loaded when the supplementary module is enabled. Then, it calculates the corresponding Bartholin's distance, correlation, and chi-square value (R²). 2 The average value is taken as the similarity of each template, and the maximum value is taken to return the corresponding template number.

[0035] Then, the host computer sends a template replenishment command to the template replenishment module of the hardware system. The template replenishment library releases the corresponding template's defect-free fabric into the replenishment conveyor belt, and the replenished template fabric is sent into the normal fabric recycling library through the replenishment conveyor belt.

[0036] The specific steps for supplementing the template in step 4 are as follows:

[0037] Step 4.1, Load Model Information: Load the RGB channel information of the defect-free template image of the fabric produced by the current production line for use in subsequent steps.

[0038] Step 4.2, Template Similarity Calculation: When the defect score of the current defect detection model exceeds a predetermined threshold, the host computer takes a screenshot of the current frame of the video stream and compares the histogram of the RGB channels of the current screenshot with the pre-stored templates in the template library to obtain the corresponding Bach distance, correlation, and chi-square value (R²). 2 It calculates the template similarity and returns the template number with the highest similarity.

[0039] Step 4.3: Based on the fabric template number identified in Step 4.2, the host computer sends an enable command and the corresponding fabric template number to be supplemented to the template supplementation module of the hardware system.

[0040] Step 4.4: The fabric replenishment module replenishes fabric templates. The template replenishment library of the fabric replenishment module refers to the fabric template library produced in the current production line. The fabric template library needs to maintain a certain number of normal, defect-free fabrics. When the detection system issues a defect handling instruction, based on the defective fabric template identified by the detection system, the servo motor of the template library corresponding to the current template is enabled. The servo motor drives the corresponding replenishment library baffle, releasing the normal, defect-free fabric of the corresponding template in the template library as replenishment template fabric into the normal recycling library. When fabric defect handling is performed, after the host computer issues a processing instruction, the hardware system enables the servo motor of the corresponding template in the fabric replenishment library to replenish the template fabric.

[0041] Step 4.5: When defective fabrics reach the defective fabric recycling station exceeding the threshold, supplementary template fabrics are transported by the supplementary conveyor belt so that they are added to the normal fabric recycling warehouse in sequence, and the template replenishment process is completed.

[0042] Step 5, Fabric Segmentation and Scoring: For the defective fabrics recovered above, preliminary area division is carried out through fabric segmentation and scoring for reference in subsequent in-depth processing of defective fabrics.

[0043] After the host computer issues a defect handling instruction, the fabric segmentation scoring algorithm divides the area according to the principle of whether it contains defects, dividing the defective area and the non-defective area for the targeted cutting division in the subsequent step 6.

[0044] The defective fabrics were marked and the defective areas were divided.

[0045] Step 6, targeted cutting and division: For the defective areas identified in Step 5 after segmentation and scoring of the fabric, the cutting area is divided and the fabric segments are graded.

[0046] The specific steps for dividing the cutting area and grading the fabric segments are as follows:

[0047] Step 6.1, dividing the cutting area, obtaining the pre-loaded scoring density standard, calculating the total defect score and defect density of the above-mentioned defective area through the standard, and dividing the current fabric segment into cuttable area and unrecommended cutting area according to the above standard.

[0048] Step 6.2, fabric segment grading: For areas where cutting is not recommended, further subdivision can be made according to the quality requirements of the actual production line.

[0049] Once the cutting area is divided, the fabric segmentation algorithm evaluates the current fabric segment based on the area ratio of the unrecommended cutting area to the recommended cutting area and the defect density of the overall defective D area.

[0050] Step 6.3, Multi-format result recording: After completing the above, the host computer writes the partition information of the current fabric segment to the log and generates a long screenshot of the partition of the current fabric segment.

[0051] This completes the entire process.

[0052] The present invention can achieve the following technical effects:

[0053] 1. Improve the efficiency of fabric defect detection and handling in the fabric production process;

[0054] 2. Standardize the subsequent processing procedures for defective fabrics;

[0055] 3. Promote the high-value recycling and utilization of defective fabrics during the fabric production process.

[0056] Therefore, the present invention has the following advantages over the prior art:

[0057] 1. In response to the need to process defective fabrics after defect detection, this work proposes a defective fabric processing solution based on conveyor belt track changing and template replenishment, which combines existing industrial solutions. Without affecting the subsequent garment manufacturing process, it can efficiently and stably process defective fabrics and replenish the corresponding normal template fabrics.

[0058] 2. In response to the problem of large-area defects leading to fabric scrapping in automated production due to damage to knitted or woven fabrics and their own inherent defects in actual industrial production, this work innovatively proposes an abnormal alarm scheme based on defect continuity assessment. When the detection system identifies large-area continuous defects or exceeds the alarm threshold of defect scoring, it sends a stop command to the production line control system through the host computer and provides audible and visual alarms through the alarm system.

[0059] In industrial production, while automated production improves production efficiency, it also brings uncertainties. The cost of a roll of fabric can reach several thousand yuan. This function can minimize the occurrence of large-area defects caused by the knitting and weaving machines themselves during the textile process, and reduce the additional textile production costs caused by uncertainties.

[0060] 3. For defective fabrics in industrial production, discarding the entire piece of fabric would violate the green and environmentally friendly principles of fabric production and increase unnecessary costs in the fabric production process, resulting in significant economic losses for enterprises.

[0061] Therefore, the machine vision-based fabric defect detection and processing method provided by this invention changes the existing actual production, solves the problems of relying on manual judgment for fabric segmentation and targeted cutting in the fabric defect review process, and the low degree of standardization; and realizes intelligent fabric production. Attached image description:

[0062] Figure 1 This is a flowchart illustrating the overall workflow of the fabric defect detection and processing method in this embodiment.

[0063] Figure 2 This is the logic diagram for determining the shutdown due to large-area defects in step 2 of the embodiment.

[0064] Figure 3 This is a schematic diagram of the defect recovery module in step 3 of the embodiment;

[0065] Figure 4 This is a schematic diagram of the template identification and defect supplementation algorithm logic in step 4 of the embodiment;

[0066] Figure 5 This is a schematic diagram of the similarity calculation process for the defective yellow fabric template in step 4 of the embodiment.

[0067] Figure 6 This is a schematic diagram of the fabric replenishment module in step 4 of the embodiment.

[0068] Figure 7 This is a schematic diagram of the fabric replenishment module processing the template of the defective yellow fabric in step 4 of the embodiment;

[0069] Figure 8 This is a schematic diagram illustrating the division of fabric defect areas in step 5 of the embodiment.

[0070] Figure 9 This is a schematic diagram illustrating the targeted cutting and grading of fabric segments in step 6 of the embodiment. Detailed Implementation

[0071] The present invention will be further described in detail through embodiments and with reference to the accompanying drawings, but this is not intended to limit the scope of the invention.

[0072] Example 1

[0073] A machine vision-based method for detecting and processing fabric defects, the overall workflow of which is as follows: Figure 1 As shown, it includes the following 6 steps:

[0074] Step 1, Defect Detection: The video stream of an industrial camera is acquired by connecting to a host computer and fed into a pre-trained fabric defect detection model based on Faster R-CNN. The model can detect the category, confidence, and location information of fabric defects in each frame of the input video stream for use in subsequent steps: Step 2, Large-area Defect Shutdown Judgment; Step 3, Defect Recovery; and Step 4, Template Supplementation.

[0075] Step 2, large-area defect shutdown judgment, the logic of step 2 is as follows: Figure 3 As shown, the relevant information of fabric defects in each frame of the video stream returned in the defect detection of step 1 above is processed. At the same time, the length and area of ​​a single defect are judged and the defect score density per unit area is judged. If the preset threshold of the above judgment is exceeded, a defect stop alarm command is sent to the fabric production line and waits for the operator to check and reset. If the threshold is not exceeded, the subsequent steps are entered.

[0076] In step 2, the decision to halt operation due to large-area defects is based on two parallel steps: determining the length and area of ​​a single defect, and determining the total defect score per unit area. Specifically:

[0077] Parallel step 2.1: Determine the length and area of ​​a single defect. Calculate the actual length and area of ​​the defect and determine its continuity using a pre-trained additional model. If the detected defect exceeds the preset thresholds for both length and area and is determined to be a continuous defect by the defect continuity judgment model, a defect shutdown alarm command is issued. If the thresholds are not exceeded, the above judgment is repeated.

[0078] Parallel step 2.2: Defect total score per unit area is judged. If it exceeds the preset defect score density threshold, a defect shutdown command is issued. If it does not exceed the threshold, the above judgment is repeated.

[0079] The automated judgment of large-area defect shutdown is achieved through parallel steps 2.1 and 2.2;

[0080] Taking a defective fabric that meets the criteria for large-area defect shutdown in the above steps as an example, after detecting that it meets the criteria for large-area defect shutdown, the host computer sends an audible and visual alarm and equipment shutdown command to the hardware system. The audible and visual alarm device will sound an alarm, and the fabric production line will shut down.

[0081] Step 3, Defect Recovery: If a large-area defect shutdown judgment was not issued in Step 2, then the defective fabric needs to be recovered. A schematic diagram of the defect recovery module is shown below. Figure 3 As shown, it includes a controllable track-changing device, a defective fabric recycling conveyor belt, a defective fabric recycling station that exceeds the threshold, and a bottom conveyor belt.

[0082] When performing defect recycling operations, the host computer sends a track-changing command to the controllable track-changing device of the hardware system, which transfers the defective fabric on the bottom conveyor belt to the defective fabric recycling conveyor belt. The defective fabric recycling conveyor belt then sends the fabric that needs to be recycled to the defective fabric recycling station that exceeds the threshold.

[0083] The aforementioned steps enable the recycling of defective fabrics after inspection.

[0084] Step 4, Template Supplementation: Since defective fabrics were recycled in the previous steps, and in actual production, the fabrics to be inspected are stored in stacks, template supplementation is needed to avoid disordered stacking after the defective fabrics are recycled. A schematic diagram of the template identification and defect supplementation algorithm logic is shown below. Figure 4 As shown;

[0085] After the host computer issues a defect handling command, it obtains a screenshot of the defective fabric after defect detection, captured in the pre-process. It then obtains the template RGB histogram information loaded when the supplementary module is enabled, and calculates the corresponding Bartholin's distance, correlation, and chi-square value (R²). 2 The average value is taken as the similarity of each template, and the maximum value is taken to return the corresponding template number.

[0086] Then, the host computer sends a template replenishment command to the template replenishment module of the hardware system. The template replenishment library releases the corresponding template's defect-free fabric into the replenishment conveyor belt, which then sends the replenished template fabric into the normal fabric recycling library.

[0087] In step 4, the specific steps for template supplementation are as follows:

[0088] Step 4.1, Load Model Information: Load the RGB channel information of the defect-free template image of the fabric produced by the current production line for use in subsequent steps.

[0089] Step 4.2, Template Similarity Calculation: When the defect score of the current defect detection model exceeds a predetermined threshold, the host computer takes a screenshot of the current frame of the video stream and compares the histogram of the RGB channels of the current screenshot with the pre-stored templates in the template library to obtain the corresponding Bach distance, correlation, and chi-square value (R²). 2 It calculates the template similarity and returns the template number with the highest similarity.

[0090] Taking a defective yellow fabric as an example, the template similarity calculation process is as follows: Figure 5 As shown:

[0091] Step 4.3: Based on the fabric template number identified in Step 4.2, the host computer sends an enable command and the corresponding fabric template number to be supplemented to the template supplementation module of the hardware system.

[0092] Step 4.4: The fabric replenishment module replenishes fabric templates. The template replenishment library of the fabric replenishment module refers to the fabric template library currently produced on the production line. The fabric template library needs to maintain a certain number of normal, defect-free fabrics. When the detection system issues a defect handling command, based on the defective fabric template identified by the detection system, the servo motor of the template library corresponding to the current template is enabled. The servo motor drives the corresponding replenishment library baffle, releasing the normal, defect-free fabric of the corresponding template in the template library as replenished template fabric into the normal recycling library. The workflow of the fabric replenishment module is as follows: Figure 6 As shown;

[0093] Taking the aforementioned defective yellow fabric as an example, when processing the fabric defects, the hardware workflow of the supplementary module is as follows: Figure 7 As shown, after the host computer issues a processing command, the hardware system enables the servo motor of the corresponding template in the fabric replenishment library to replenish the template fabric.

[0094] Step 4.5: When defective fabrics reach the defective fabric recycling station exceeding the threshold, supplementary template fabrics are transported by a supplementary conveyor belt so that they are added to the normal fabric recycling warehouse in sequence, and the template replenishment process is completed.

[0095] Step 5, Fabric Segmentation and Scoring: For the defective fabrics recovered above, preliminary area division can be carried out through fabric segmentation and scoring for reference in subsequent in-depth processing of defective fabrics.

[0096] After the host computer issues a defect handling instruction, the fabric segmentation scoring algorithm divides the area according to the principle of whether it contains defects, dividing the defective area and the non-defective area for the targeted cutting division in the subsequent step 6.

[0097] Taking defective red fabric, defective yellow fabric, and defective green fabric as examples, denoted as fabric No. 1, fabric No. 2, and fabric No. 3 respectively, the actual division of the defective areas of the fabrics is as follows: Figure 8 As shown, from left to right, the fabrics are numbered 1, 2, and 3. After the defect area is divided, fabric number 1 is divided into one defective D area and one non-defective S area; fabric number 2 is divided into one defective D area and one non-defective S area; and fabric number 3 is divided into two defective D areas and one non-defective S area.

[0098] Step 6: Targeted cutting and division. Based on the defective areas identified in Step 5 through fabric segmentation and scoring, the cutting area is divided and the fabric segments are graded.

[0099] Taking the defective D area of ​​fabric pieces 1, 2, and 3 after the fabric segmentation and scoring in step 5 above as an example, targeted cutting and division are carried out. The targeted cutting and division process and fabric segment grading are illustrated as follows. Figure 9 As shown,

[0100] In step 6, the specific steps for dividing the cutting area and grading the fabric segments are as follows:

[0101] Step 6.1, dividing the cutting area, obtaining the pre-loaded scoring density standard, calculating the total defect score and defect density of the above-mentioned defective area through the standard, and dividing the current fabric segment into cuttable area and unrecommended cutting area according to the above standard.

[0102] Based on the above principles, area D of fabric No. 1 is divided into 5 recommended cutting areas, and the remaining areas are not recommended cutting areas.

[0103] Based on the above principles, area D of fabric No. 2 is divided into two recommended cutting areas, and the remaining areas are not recommended cutting areas.

[0104] Based on the above principles, area D of fabric No. 3 is divided into 3 recommended cutting areas, and the remaining areas are not recommended cutting areas.

[0105] Step 6.2, fabric segment grading: For areas where cutting is not recommended, further subdivision can be made according to the quality requirements of the actual production line.

[0106] Once the cutting area is divided, the fabric segmentation algorithm evaluates the current fabric segment based on the area ratio of the unrecommended cutting area to the recommended cutting area and the defect density of the overall defective D area.

[0107] The fabric section of No. 1 is rated as Grade A and will be sent to a good production line for targeted cutting.

[0108] Fabric section #2 is rated as grade C and will be sent to a medium-sized production line for targeted cutting.

[0109] Fabric section No. 3 is rated as Grade B and will be sent to a less desirable production line for targeted cutting.

[0110] Step 6.3, Multi-format result recording: After completing the above, the host computer writes the partition information of the current fabric segment to the log and generates a long screenshot of the partition of the current fabric segment.

[0111] At this point, the entire process is complete.

Claims

1. A method for detecting and processing fabric defects based on machine vision, characterized in that... Includes the following steps: Step 1, Defect Detection: The video stream of an industrial camera is acquired by connecting to a host computer and fed into a pre-trained fabric defect detection model based on Faster R-CNN. The model can detect the category, confidence, and location information of fabric defects in each frame of the input video stream for use in subsequent steps. Step 2, Large-area defect shutdown judgment: Process the fabric defect information in each frame of the video stream returned from the defect detection in Step 1 above, and judge the length and area of ​​a single defect as well as the defect score density per unit area. If the preset threshold of the above judgment is exceeded, a defect shutdown alarm command is sent to the fabric production line and waits for the operator to check and reset. If it is not exceeded, proceed to the next step. In step 2, the decision to halt operation due to large-area defects is based on two parallel steps: determining the length and area of ​​a single defect, and determining the total defect score per unit area. Specifically: Parallel step 2.1: Determine the length and area of ​​a single defect by using a pre-trained additional model to calculate the actual length and area of ​​the defect and determine the continuity of the defect. If the detected defect exceeds the preset thresholds for defect length and area and is determined to be a continuous defect by the defect continuity judgment model, a defect shutdown alarm command is issued. If the thresholds are not exceeded, the above judgment is repeated. Parallel step 2.2: Defect total score per unit area is judged. If it exceeds the preset defect score density threshold, a defect shutdown command is issued. If it does not exceed the threshold, the above judgment is repeated. The automated judgment of large-area defect shutdown is achieved through parallel steps 2.1 and 2.2; After detecting that the criteria for large-area defect shutdown are met, the host computer sends an audible and visual alarm and equipment shutdown command to the hardware system. The audible and visual alarm device will sound an alarm, and the fabric production line will shut down. Step 3, Defect Recovery: If a large-area defect shutdown judgment is not issued in Step 2, the defective fabric needs to be recovered. The defect recovery method includes a controllable track changing device, a defective fabric recovery conveyor belt, a defective fabric recovery station exceeding the threshold, and a bottom conveyor belt. When performing defect recycling operations, the host computer sends a track-changing command to the controllable track-changing device of the hardware system, which transfers the defective fabric on the bottom conveyor belt to the defective fabric recycling conveyor belt. The defective fabric recycling conveyor belt then sends the fabric that needs to be recycled to the defective fabric recycling station that exceeds the threshold. The above steps can be used to recycle defective fabrics after they have been inspected. Step 4, Template Supplementation: Since defective fabrics were recycled in the above steps, the fabrics to be tested in actual production are stored in stacks. In order to avoid disorder of the overall fabric stacking after the defective fabrics are recycled, template supplementation is required for the defective fabrics recycled in the above steps. After the host computer issues a defect handling command, it retrieves a screenshot of the defective fabric after defect detection, taken from the pre-process, and obtains the RGB histogram information of the template fabric loaded during the initialization of the supplementary module. Then, it calculates the corresponding Bartholin's distance, correlation, and chi-square value R. 2 The average value is taken as the similarity of each template, and the maximum value is taken to return the corresponding template number. Then, the host computer sends a template replenishment command to the template replenishment module of the hardware system. The template replenishment library releases the corresponding template's defect-free fabric into the replenishment conveyor belt, and the replenished template fabric is sent into the normal fabric recycling library through the replenishment conveyor belt. Step 5, Fabric Segmentation and Scoring: For the recycled defective fabric, the fabric segmentation and scoring is used to make preliminary area divisions for subsequent in-depth processing of defective fabric. After the host computer issues a defect handling instruction, the fabric segmentation scoring algorithm divides the area according to the principle of whether it contains defects, dividing the defective area and the non-defective area for the targeted cutting division in the subsequent step 6. The defective fabrics were marked and the defective areas were divided. Step 6, targeted cutting and division: For the defective areas identified in Step 5 through fabric segmentation and scoring, the cutting area is divided and the fabric segments are graded. In step 6, the specific steps for dividing the cutting area and grading the fabric segments are as follows: Step 6.1, dividing the cutting area, obtaining the pre-loaded scoring density standard, calculating the total defect score and defect density of the above-mentioned defective area through the standard, and dividing the current fabric segment into cuttable area and unrecommended cutting area according to the above standard. Step 6.2, fabric segment grading, further subdividing areas that are not recommended for cutting according to the quality requirements of the actual production line used; Once the cutting area is divided, the fabric segmentation algorithm assesses the current fabric segment's grade based on the area ratio of the discouraged cutting area to the recommended cutting area and the defect density. Step 6.3, Multi-format result recording: After completing the above steps, the host computer writes the partition information of the current fabric segment into the log and generates a long screenshot of the partition of the current fabric segment. This completes the entire process.

2. The fabric defect detection and processing method based on machine vision according to claim 1, characterized in that: In step 4, the specific steps for template supplementation are as follows: Step 4.1, Load Model Information: Load the RGB channel information of the defect-free template image of the fabric produced by the current production line for use in subsequent steps. Step 4.2, Template Similarity Calculation: When the defect score of the current defect detection model exceeds a predetermined threshold, the host computer takes a screenshot of the current frame of the video stream and compares the histogram of the RGB channels of the current screenshot with the pre-stored templates in the template library to obtain the corresponding Bach distance, correlation, and chi-square value R. 2 It also calculates the template similarity and returns the template number with the highest similarity. Step 4.3: Based on the fabric template number identified in Step 4.2, the host computer sends an enable command to the template replenishment module of the hardware system and specifies the fabric template number that needs to be replenished. Step 4.4: The fabric replenishment module replenishes fabric templates. The template replenishment library of the fabric replenishment module refers to the fabric template library produced in the current production line. The fabric template library needs to maintain a certain number of normal, defect-free fabrics. When the detection system issues a defect handling instruction, based on the defective fabric template identified by the detection system, the servo motor of the template library corresponding to the current template is activated. The servo motor drives the corresponding replenishment library baffle, releasing the normal, defect-free fabric of the corresponding template in the template library as replenishment template fabric into the normal recycling library. When fabric defect handling is performed, after the host computer issues a processing instruction, the hardware system activates the servo motor of the corresponding template in the fabric replenishment library to replenish the template fabric. Step 4.5: When defective fabrics reach the defective fabric recycling station exceeding the threshold, supplementary template fabrics are transported by a supplementary conveyor belt so that they are added to the normal fabric recycling warehouse in sequence, and the template replenishment process is completed.