A method and system for rapid detection of textile defects

By adaptively sampling and analyzing the surface images of textiles to generate an image pyramid and setting constraints, the problems of missed detection and false detection in traditional textile inspection are solved, achieving efficient and accurate defect detection.

CN120747121BActive Publication Date: 2025-11-18SCIENCE & TECHNOLOGY RESEARCH CENTER OF CHINA CUSTOMS +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511275934.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-08
Publication Date
2025-11-18
Estimated Expiration
2045-09-08

AI Technical Summary

Technical Problem

Traditional textile quality inspection relies on manual inspection, which is prone to missed or false detections. Furthermore, existing automated inspection methods are unable to effectively handle defects of different sizes, resulting in insufficient inspection accuracy and efficiency.

Method used

By dividing the surface image of textiles into sub-regions, analyzing the arrangement patterns of warp and weft yarns, generating an image pyramid with adaptive sampling size, setting grayscale and texture direction constraints, determining the control group sub-region, and analyzing the feature differences between the test area and the control group to quantify the defect area.

Benefits of technology

It enables rapid and accurate detection of textile defects, avoids loss of details, improves the accuracy and efficiency of detection, and ensures precise location of defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747121B_ABST
    Figure CN120747121B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of defect visual inspection, in particular to a fast detection method and system for textile defects, the present application divides the surface image into multiple sub-regions, analyzes the arrangement rule of the edge warp and weft yarns of the sub-regions, obtains the defect probability of the sub-regions, and performs downsampling operation on the sub-regions based on the defect probability to generate an image pyramid, which avoids detail loss, completely retains the key information of local anomalies, and ensures the accuracy of defect position detection; then, by setting constraint conditions in the same level and across levels of the image pyramid respectively, a control group sub-region is determined to ensure the reliability of the control group sub-region and improve the accuracy of subsequent comparison; then, the feature difference degree between the to-be-tested sub-region and the control group sub-region is analyzed, and the position weight of the same level and the level weight of different levels are fused to quantify the deviation degree of the to-be-tested sub-region and the control group sub-region, so as to realize accurate positioning of the defect region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual defect detection technology, specifically to a rapid detection method and system for textile defects. Background Technology

[0002] Textiles are flexible materials made from yarns or fibers through weaving, knitting, and nonwoven processes, and are widely used in clothing, home furnishings, industrial fabrics, and medical and health products. However, during the textile production process, factors such as raw material quality and production processes can cause various defects on the fabric surface, such as yarn breakage and impurity embedding. These defects not only damage the aesthetic appearance of the textiles but also impair the product's functionality and durability. Therefore, defect detection and control in textiles is a core aspect of ensuring product quality and directly affects the product's market competitiveness and customer satisfaction.

[0003] Traditional textile quality inspection relies heavily on manual checks, which not only increases production costs but also makes it prone to missed or false detections due to human negligence or fatigue, seriously affecting product quality stability and enterprise competitiveness. In recent years, with the continuous advancement of artificial intelligence, computer vision technology, and deep learning algorithms, automated inspection methods based on image processing have gradually become a research hotspot in the field of textile defect detection. Image processing technology can capture detailed information about textiles using camera equipment, and then use computer algorithms to analyze the images to accurately identify and classify various defects, such as fabric damage, stains, color differences, and pattern misalignment. Compared to traditional manual inspection methods, image processing-based defect detection systems offer advantages such as high speed, high accuracy, and a high degree of automation.

[0004] However, the size of defects in fabrics can range from extremely small millimeters to large centimeters. If a fixed single sampling size is used, details may be lost due to the scale being too large, or the global structure may be ignored due to the scale being too small, ultimately leading to the failure of defect location detection. Summary of the Invention

[0005] In order to solve the above technical problems, the purpose of this invention is to provide a rapid detection method and system for textile defects.

[0006] According to a first aspect of the present invention, a rapid detection method for textile defects is provided, the specific technical solution of which is as follows:

[0007] Acquire images of the textile surface and divide the surface images into several sub-regions;

[0008] The arrangement pattern of warp and weft yarns at the edge of the sub-region is analyzed to obtain the defect probability of the sub-region. Based on the defect probability, an adaptive sampling downsampling operation is performed on the sub-region to generate an image pyramid.

[0009] In the same level of the image pyramid, grayscale and texture direction constraints are set, and in different levels of the image pyramid, cross-level coherence constraints of grayscale and texture direction are set to determine the control group sub-region.

[0010] In the same level of the image pyramid, the difference in gray level between the sub-region under test and the sub-region under control is analyzed, the positional relationship between the sub-region under test and the sub-region under control in the same level is analyzed, and the hierarchical relationship between the level of the image pyramid where the sub-region under test is located and the total level is analyzed to obtain the global gray level anomaly score of the sub-region under test.

[0011] The actual defect area is determined based on the global grayscale anomaly score.

[0012] In some embodiments of the present invention, the arrangement pattern characteristics of the warp and weft yarns at the edge of the sub-region are analyzed to obtain the defect probability of the sub-region, and based on the defect probability, an adaptive sampling size downsampling operation is performed on the sub-region to generate an image pyramid, including:

[0013] By analyzing the integrity, curvature characteristics, and directional characteristics of the edge warp and weft yarns of the sub-regions, the defect probability of each sub-region is obtained.

[0014] Based on the defect probability of the sub-region, the clustering characteristics of defects within the sub-region are analyzed, and the sampling scale corresponding to the sub-region is obtained by combining the textile type.

[0015] Based on the sampling scale, the sub-region is downsampled with an adaptive sampling size to generate an image pyramid.

[0016] In some embodiments of the present invention, the integrity, curvature characteristics, and directional consistency of the edge warp and weft yarns of the sub-regions are analyzed to obtain the defect probability of each sub-region, including:

[0017] Extract the edge contour of the sub-region, perform Hough line transformation on the edge contour, and calculate the total length of the edge contour and the total length of the line to obtain the integrity of the warp and weft yarns at the edge of the sub-region.

[0018] Extract the single-pixel skeleton of the edge contour, and perform quadratic curve fitting on the single-pixel skeleton. Calculate the curvature value of each pixel based on the fitted curve to obtain the average curvature of the edge warp and weft yarns of the sub-region.

[0019] Extract the warp and weft yarn pixels on the edge contour, and analyze the angular deviations of the warp and weft yarn pixel directions from the standard direction to obtain the consistency of the warp and weft yarn directions at the edge of the sub-region.

[0020] The defect probability of each sub-region is obtained by combining the integrity, average curvature, and directional consistency of the edge warp and weft yarns of the sub-region.

[0021] In some embodiments of the present invention, based on the defect probability of the sub-region, the clustering characteristics of defects within the sub-region are analyzed, and combined with the textile type, the sampling scale corresponding to the sub-region is obtained, including:

[0022] The difference between the defect probabilities of the sub-region and its neighboring sub-regions is analyzed, and a spatial correlation coefficient is introduced to obtain the defect weight coefficient of the sub-region.

[0023] Based on the defect weight coefficient, combined with the textile type, and combined with the original resolution and global structural scale of the sub-region, the sampling scale corresponding to the sub-region is obtained.

[0024] In some embodiments of the present invention, grayscale and texture direction constraints are set at the same level of the image pyramid, and cross-level coherence constraints are set at different levels of the image pyramid to determine control group sub-regions, including:

[0025] In the same level of the image pyramid, grayscale fluctuation threshold and intra-layer grayscale deviation threshold are set as grayscale constraints, and main direction ratio threshold and maximum direction deviation threshold are set as texture direction constraints.

[0026] In different levels of the image pyramid, the cross-level gray mean deviation threshold and the cross-level gray variance deviation threshold are set as cross-level coherence constraints for gray levels, and the cross-level principal direction deviation threshold and the cross-level direction standard deviation deviation threshold are set as cross-level coherence constraints for texture directions.

[0027] Subregions that simultaneously satisfy both grayscale and texture direction constraints, as well as cross-layer coherence constraints of grayscale and texture direction, are designated as control group subregions.

[0028] In some embodiments of the present invention, within the same level of the image pyramid, the difference in grayscale levels between the sub-region under test and the control group sub-region is analyzed, and the positional relationship between the sub-region under test and the control group sub-region within the same level is analyzed, as well as the hierarchical relationship between the level of the image pyramid where the sub-region under test is located and the total level is analyzed, to obtain a global grayscale anomaly score for the sub-region under test, including:

[0029] In the same level of the image pyramid, the difference in grayscale fluctuation and the difference in grayscale mean between the test sub-region and the control sub-region are analyzed to obtain the degree of level grayscale difference between the test sub-region and the control sub-region in each level.

[0030] In the same level of the image pyramid, the position weight coefficient corresponding to the sub-region to be tested in each level is obtained based on the Euclidean distance between the sub-region to be tested and the sub-region to be controlled.

[0031] The difference between each level and the total level in the image pyramid is calculated, and a scaling factor and a defect size adaptation factor are introduced to obtain the level weight coefficient corresponding to the sub-region to be tested in each level.

[0032] By weighting the degree of grayscale difference between the layers using the position weight coefficient and the layer weight coefficient, the weighted degree of grayscale difference between the sub-region under test and the control group sub-region in each layer is obtained. By traversing all layers, a global grayscale anomaly score for the sub-region under test is obtained.

[0033] In some embodiments of the present invention, the method further includes:

[0034] Set a first constraint condition for the degree of grayscale difference of the weighted level, and set a second constraint condition for the level weight coefficient;

[0035] If both the first constraint and the second constraint are met simultaneously, the downsampling operation will be terminated prematurely.

[0036] In some embodiments of the present invention, a first constraint condition is set for the degree of gray-level difference of the weighted hierarchy, and a second constraint condition is set for the hierarchy weight coefficient, including:

[0037] Set a threshold for the degree of difference;

[0038] The first constraint condition is that the ratio between the weighted level grayscale difference between the current level and the bottommost level is less than the difference threshold.

[0039] Set the weighted cycle decay rate;

[0040] The second constraint condition is that the ratio between the weight coefficients of the current level and the previous level is less than the weight cycle decay rate.

[0041] According to a second aspect of the present invention, a rapid detection system for textile defects is provided, comprising: a memory and a processor, wherein:

[0042] The memory is used to store program code;

[0043] The processor is configured to read program code stored in the memory and execute the method described in the first aspect of the present invention.

[0044] In some embodiments of the present invention, the processor includes:

[0045] An image acquisition module is used to acquire images of the textile surface and divide the surface images into several sub-regions;

[0046] The image pyramid acquisition module is used to analyze the arrangement pattern characteristics of the warp and weft yarns at the edge of the sub-region, obtain the defect probability of the sub-region, and perform an adaptive sampling size downsampling operation on the sub-region based on the defect probability to generate an image pyramid.

[0047] The control group sub-region determination module is used to set grayscale and texture direction constraints in the same level of the image pyramid, and to set cross-level coherence constraints of grayscale and texture direction in different levels of the image pyramid to determine the control group sub-region.

[0048] The global grayscale anomaly scoring module is used to analyze the difference in grayscale levels between the test sub-region and the control sub-region in the same level of the image pyramid, analyze the positional relationship between the test sub-region and the control sub-region in the same level, and analyze the hierarchical relationship between the level of the image pyramid where the test sub-region is located and the total level, so as to obtain the global grayscale anomaly score of the test sub-region.

[0049] The actual defect area determination module is used to determine the actual defect area based on the global grayscale anomaly score.

[0050] Compared with existing technologies, the rapid detection method and system for textile defects provided by this invention have the following advantages:

[0051] This invention divides a surface image into several sub-regions, transforming the global "defect detection problem" into a quantitative assessment of the "degree of regularity of damage" in each sub-region. Then, by analyzing the arrangement patterns of the warp and weft yarns at the edges of the sub-regions, the defect probability of each sub-region is obtained. Based on this probability, an adaptive downsampling operation is performed on the sub-regions to generate an image pyramid. Specifically, a larger downsampling scale is used in sub-regions with low defect probabilities, allowing for rapid filtering of normal areas through sparse sampling within the image pyramid. Conversely, a smaller downsampling scale is used in sub-regions with high defect probabilities, avoiding detail loss and preserving key information about local anomalies to ensure accurate defect location detection. Furthermore, by setting constraints at both the same and different levels within the image pyramid, control group sub-regions are determined, ensuring their reliability and improving the accuracy of subsequent comparisons. Finally, by analyzing the feature differences between the tested sub-region and the control group sub-regions and integrating positional weights at the same level and hierarchical weights at different levels, a global grayscale anomaly score for the tested sub-region is obtained, quantifying the deviation between the tested and control group sub-regions and achieving precise defect location. Attached Figure Description

[0052] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a schematic diagram of the basic process of a rapid detection method for textile defects provided in one embodiment of the present invention;

[0054] Figure 2 This is a schematic diagram of the basic process of a method for generating an image pyramid by downsampling a sub-region, as provided in an embodiment of the present invention.

[0055] Figure 3 This is a schematic diagram of the basic components of a rapid detection system for textile defects provided in one embodiment of the present invention. Detailed Implementation

[0056] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a rapid detection method and system for textile defects proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. Terms such as “comprising,” “including,” or any other variations thereof are intended to cover a non-exclusive inclusion, such that a circuit structure, article, or device comprising a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such article or device. Without further limitation, an element defined by the phrase “comprising one…” does not exclude the presence of additional identical elements in the article or device that includes the element.

[0058] The following description, in conjunction with the accompanying drawings, details a specific scheme for a rapid detection method for textile defects provided by the present invention.

[0059] Please see Figure 1 This illustrates the basic process of a rapid detection method for textile defects provided by an embodiment of the present invention.

[0060] like Figure 1 As shown, an embodiment of the present invention provides a rapid detection method for textile defects, specifically including:

[0061] S100: Acquire images of the textile surface and divide the surface images into several sub-regions.

[0062] In the initial data acquisition stage of textile defect detection, a highly stable system for acquiring textile surface images needs to be constructed. Specifically, a high frame rate industrial camera should be mounted directly above the inspection platform. The camera's shooting area should completely cover the textile's operating area in width and at least accommodate a whole textile sample in length to ensure complete acquisition of a single textile surface image. The camera should be equipped with autofocus and aperture adjustment functions, and be paired with a linear array LED uniform backlight to effectively eliminate the effects of reflections on the textile surface and dynamic shadows caused by mechanical movement, so that the acquired textile surface image clearly shows the details of warp and weft yarn interlacing, color transition characteristics, and microstructural deformation.

[0063] Furthermore, to match the timeliness of textile inspection, the camera's frame rate needs to be dynamically synchronized with the textile conveying speed. Let the textile's running speed be... The length of the textile to be tested is The length of the camera's shooting area (in the direction of textile movement) is The time required for the textiles to pass through the shooting area is:

[0064] ;

[0065] In the formula, Indicates the time required for the textiles to pass through the photographed area; Indicates the length of the textile to be tested; Indicates the length of the camera's shooting area; This indicates the speed at which the textile is moving.

[0066] The minimum number of frames required within the shooting area is:

[0067] ;

[0068] In the formula, Indicates the minimum number of frames required within the shooting area; This indicates the minimum number of frames required per unit length of textile, such as 30 frames / m; This indicates the length of the area captured by the camera.

[0069] The formula for the camera's frame rate f is:

[0070] ;

[0071] In the formula, Indicates the camera's frame rate; Indicates the minimum number of frames required within the shooting area; Indicates the time required for the textiles to pass through the photographed area; The minimum number of frames required to represent a unit length of textile; Indicates the speed at which the textile moves; Indicates the length of the textile to be tested; This indicates the length of the area captured by the camera.

[0072] The surface images of textiles are dynamically and synchronously acquired at a frame rate f to ensure that the entire surface of the textiles can be captured in the shooting area, providing a time-series continuous and spatially consistent image data source for subsequent multi-scale analysis based on image pyramids.

[0073] The core quality of textiles depends on the regular arrangement of warp and weft yarns, and defects are essentially localized disruptions to this regularity. By segmenting the acquired textile surface image into multiple spatially consistent sub-regions and extracting features from each sub-region, the global "defect detection problem" can be transformed into a quantitative assessment of the "degree of disruption to regularity" in each sub-region.

[0074] Based on the above analysis, in the embodiments of the present invention, the surface image is divided into several sub-regions. Specifically, assuming the actual size of the textile surface image is H×W (height H pixels, width W pixels), it is divided into M×N sub-regions, then the height of each sub-region is... Width is .

[0075] S200: Analyze the arrangement pattern of warp and weft yarns at the edge of the sub-region to obtain the defect probability of the sub-region, and based on the defect probability, perform an adaptive sampling downsampling operation on the sub-region to generate an image pyramid.

[0076] Image pyramid technology is a classic image processing technique that constructs images using multi-resolution hierarchical structures. In this embodiment of the invention, a pyramid-shaped image sequence from bottom to top is generated by downsampling sub-regions with adaptive sampling sizes. Each level of the image pyramid presents the original content at a different scale. In textile defect detection scenarios, the warp and weft yarn structure of normal areas is highly regular, while defective areas, due to the disruption of this regularity, appear significantly different from the surrounding areas at lower levels of the image pyramid and different from the overall structure at higher levels. The image pyramid amplifies the difference between the defective target and the normal background through a multi-scale feature extraction mechanism.

[0077] Please see Figure 2 This illustrates the basic flow of a method for generating an image pyramid by downsampling a sub-region, provided by an embodiment of the present invention.

[0078] An embodiment of the present invention provides a method for generating an image pyramid by downsampling a sub-region, comprising: analyzing the arrangement pattern characteristics of warp and weft yarns at the edge of the sub-region to obtain the defect probability of the sub-region, and based on the defect probability, performing an adaptive sampling size downsampling operation on the sub-region to generate an image pyramid. Figure 2 As shown, an embodiment of the present invention provides a method for generating an image pyramid by downsampling a sub-region, which further includes:

[0079] S201: Analyze the integrity, curvature characteristics, and directional characteristics of the edge warp and weft yarns of the sub-region to obtain the defect probability of each sub-region.

[0080] The integrity, curvature, and directional characteristics of the edge warp and weft yarns of each sub-region are analyzed to obtain the defect probability of each sub-region. Further, this includes:

[0081] First, since the edges of normal yarns within a sub-region should be continuous straight lines, while the edges of defective areas may be broken or curved, the edge contours of the sub-regions are extracted using Canny edge detection. Then, a Hough straight line transform is applied to the edge contours, and the total length of the edge contours and the total length of the detected straight lines are calculated to obtain the integrity of the warp and weft yarns at the edge of the sub-region.

[0082] ;

[0083] In the formula, Indicates the integrity of the warp and weft yarns at the edge of the sub-region; This represents the total length of the lines detected at the edge contour of the sub-region; This represents the total length of the sub-region's edge contour.

[0084] Furthermore, since the curvature of normal yarn approaches 0, while the curvature of defective areas increases due to yarn breakage or twisting, a single-pixel skeleton of the edge contour is extracted, and a quadratic curve fitting is performed on the single-pixel skeleton. The form of the quadratic fitting curve is as follows:

[0085] ;

[0086] The curvature value of each pixel is calculated based on the fitted curve:

[0087] ;

[0088] In the formula, This represents the curvature value of the edge warp and weft yarn pixels of the sub-region; , , These are the coefficients of the quadratic term, the coefficients of the linear term, and the constant term in the quadratic fitted curve, respectively. This represents the independent variable in the quadratic fitted curve.

[0089] Then, by taking the average curvature of all edge pixels within the sub-region, the average curvature of the warp and weft yarns at the edge of the sub-region is obtained as follows:

[0090] ;

[0091] In the formula, This represents the average curvature of the warp and weft yarns at the edge of the sub-region; This represents the curvature value of the edge warp and weft yarn pixels of the sub-region; This represents the function for calculating the average value.

[0092] Furthermore, in normal textiles, the warp yarns are vertical and the weft yarns are horizontal, while the defective areas have chaotic orientations. Therefore, by using a Gabor filter to extract the warp and weft yarn pixels on the edge contour separately, and statistically analyzing the deviation angles of the warp and weft yarn pixel directions from the standard directions (the standard direction for warp is 90°, and for weft is 0°), the cosine average of the deviation angles of all weft yarn pixels is:

[0093] ;

[0094] In the formula, The cosine average of the deviation angle of the weft yarn pixels; This indicates the total number of pixels in the weft yarn; This indicates the angle of deviation between the direction of the weft yarn pixel and the standard direction; This represents the cosine function.

[0095] The cosine average of the deviation angles of all warp pixels is:

[0096] ;

[0097] In the formula, The cosine average of the deviation angles of the warp yarn pixels; This indicates the total number of warp yarn pixels; This indicates the angle of deviation between the warp yarn pixel direction and the standard direction; This represents the cosine function.

[0098] The consistency of the warp and weft yarn directions at the edge of the sub-region is then obtained as follows:

[0099] ;

[0100] In the formula, This indicates the consistency of the direction of the warp and weft yarns at the edge of the sub-region; The cosine average of the deviation angle of the weft yarn pixels; This represents the average cosine value of the deviation angle of the warp yarn pixels.

[0101] Finally, by combining the integrity, average curvature, and directional consistency of the edge warp and weft yarns of each sub-region, the defect probability of each sub-region is obtained. Specifically, the defect probability of each sub-region is obtained by weighted summation of integrity, average curvature, and directional consistency:

[0102] ;

[0103] In the formula, This represents the defect probability of a sub-region; Indicates the integrity of the warp and weft yarns at the edge of the sub-region; This represents the average curvature of the warp and weft yarns at the edge of the sub-region; This indicates the consistency of the direction of the warp and weft yarns at the edge of the sub-region; , , Indicates the weighting coefficient. Structural defects (such as broken yarn or holes). The changes are significant, therefore Take the larger value, such as Defects related to distorted shape (such as wrinkles). A larger value should be selected, such as Defects primarily characterized by misalignment (such as warp and weft yarn misalignment) are... A larger value should be taken, such as .

[0104] S202: Based on the defect probability of a sub-region, analyze the clustering characteristics of defects within the sub-region, and combine this with the textile type to obtain the sampling scale corresponding to the sub-region.

[0105] When downsampling different sub-regions on the surface of a textile, the sampling scale needs to be dynamically set based on the defect probability of each sub-region in order to highlight defective areas. Sub-regions with low defect probability are characterized by a regular straight-line arrangement of warp and weft yarns. These sub-regions can use a larger downsampling scale to quickly filter out normal (low defect probability) areas in the image pyramid using sparse sampling. On the other hand, sub-regions with high defect probability typically exhibit anomalies such as broken straight lines or abrupt color changes. These sub-regions can use a smaller downsampling scale to avoid losing details and to fully preserve the key information of local anomalies.

[0106] Since surface defects in textiles are usually not isolated pixel anomalies, but rather regional anomalies with spatial continuity, such as continuous yarn breakage where a broken yarn causes multiple surrounding yarns to misalign, the spatial aggregation characteristics of textile defects can be used as the weight of the sampling scale.

[0107] Based on the above analysis, in some embodiments of the present invention, the clustering characteristics of defects within a sub-region are analyzed based on the defect probability of the sub-region, and the sampling scale corresponding to the sub-region is obtained by combining the textile type. Further, this includes:

[0108] First, the difference in defect probabilities between a sub-region and its neighboring sub-regions is analyzed to obtain the defect weight coefficient. Specifically, the difference in defect probabilities between a sub-region and its 3×3 neighboring sub-regions is analyzed, and a spatial correlation coefficient is introduced. Furthermore, by combining the defect probability of the sub-region with the variance of the defect probabilities of the sub-region and its 3×3 neighboring sub-regions, the defect weight coefficient of the sub-region is obtained. The formula for calculating the defect weight coefficient is as follows:

[0109] ;

[0110] In the formula, This represents the defect weight coefficient of the sub-region; This represents the defect probability of a sub-region; This represents the mean of the defect probabilities of all sub-regions within a 3×3 neighborhood sub-region; This represents the variance of the defect probability of a subregion and all subregions within its 3×3 neighborhood subregion; Indicates spatial correlation coefficient ( (Where structural defects can take a value of 0.8, and non-structural defects can take a value of 0.3). Represented by natural constant An exponential function with base 0; This represents the maximum value function.

[0111] If the defect probability of the current sub-region The mean of the defect probability of all subregions within the high but neighboring subregion Low (e.g., isolated noise), then Lower the threshold to avoid false positives; if the defect probability of the current sub-region... The mean of the defect probability of all sub-regions within the high and neighboring sub-regions High (actual defect area), then Increase the sampling density in defective areas.

[0112] Then, based on the defect weight coefficient, combined with the textile type, and considering the original resolution and global structural scale of the sub-region, the sampling scale corresponding to the sub-region is obtained. Specifically, the downsampling step size of the sampling scale is defined. (Pixel interval), establish and The linear mapping relationship allows for large-scale sampling in sub-regions with low defect probability and small-scale sampling in sub-regions with high defect probability. Then, combining the textile type, the original resolution of the sub-region, and the global structural scale, a sampling step size is established. With defect weight coefficient The linear mapping relationship is as follows:

[0113] ;

[0114] In the formula, The downsampling step size indicates the sampling scale; This indicates the minimum step size of the sampling scale (e.g., 1 pixel, corresponding to the original resolution). This indicates the maximum step size of the sampling scale, reflecting the global structural scale of the sub-region (the global structural scale refers to the extent and size of the sub-region as a whole, and the maximum step size reflects the overall size of the sub-region). Indicates the type of textile (smooth textiles such as silk can be set to 1.2, and coarse-textured textiles such as denim can be set to 0.8). This indicates that the sampling step size is rounded down to ensure that the sampling step size is an integer and to avoid loss of details (rounding up may result in the loss of some details).

[0115] S203: Based on the sampling scale, perform downsampling operation on the sub-region with adaptive sampling size to generate an image pyramid.

[0116] Based on the dynamic setting of the sampling scale according to the defect probability, an adaptive sampling size downsampling operation is performed on each sub-region to generate an image pyramid.

[0117] S300: Set grayscale and texture direction constraints at the same level of the image pyramid, and set cross-level coherence constraints for grayscale and texture direction at different levels of the image pyramid to determine the control group sub-region.

[0118] Before performing defect detection on sub-regions of a surface image, a reliable control sub-region must first be selected. Within the same level of the image pyramid, the grayscale distribution of this control sub-region must be consistent with the global illumination level of that level, and there should be no sudden changes in local brightness. Furthermore, the texture of this control sub-region must be directionally consistent, meaning the texture direction must remain basically uniform, and the directional dispersion must be controlled at a low level. Additionally, across different levels of the image pyramid, the grayscale features of corresponding sub-regions within the control sub-region in adjacent image pyramid levels must remain stable; and the principal direction distribution of corresponding sub-regions within the control sub-region in adjacent image pyramid levels must remain consistent.

[0119] Based on the above analysis, in the embodiments of the present invention, control group sub-regions are determined by setting grayscale and texture direction constraints within the same level of the image pyramid, and by setting cross-level coherence constraints for grayscale and texture direction at different levels of the image pyramid. Further, this includes:

[0120] Within the same level of the image pyramid, since the grayscale distribution of the control group sub-region needs to be consistent with the global illumination level of its level and there should be no sudden changes in local brightness, an intra-layer grayscale fluctuation threshold and an intra-layer grayscale deviation threshold are set as grayscale constraints, specifically:

[0121] ;

[0122] In the formula, This represents the grayscale variance of all pixels within a sub-region; This indicates the grayscale fluctuation threshold (e.g., 20, which is the maximum allowable variance, excluding bright or dark spots). This represents the average grayscale value of all pixels within a sub-region. This represents the average grayscale value of all pixels within the same level of the image pyramid. This indicates the grayscale deviation threshold within the layer (e.g., 10, which is the allowable mean difference, excluding global illumination unevenness).

[0123] Within the same level of the image pyramid, since the texture of the control group sub-region needs to be regular and uniform in direction (i.e., the texture direction needs to be basically uniform) and the texture direction dispersion needs to be controlled at a low level, a main direction ratio threshold and a maximum direction deviation threshold are set as texture direction constraints, specifically:

[0124] ;

[0125] In the formula, It represents the set of gradient directions of pixels within a sub-region, reflecting the texture direction; This indicates the direction in which the gradients occur most frequently, i.e., the principal direction; Indicates the number of pixels in the main direction; This represents the total number of pixels in all directions within the same level of the image pyramid; This represents the threshold for the proportion of stray pixels in directions other than the main direction (e.g., 0.1, allowing 10% of pixels to be in non-main directions). It represents the standard deviation of all directions within a sub-region, reflecting the degree of dispersion of directions; This represents the standard deviation threshold for direction, i.e., the maximum allowable direction deviation threshold (e.g., 15°, the maximum allowable direction deviation).

[0126] By comparing the feature coherence of the control group sub-regions in adjacent levels of the image pyramid, possible spurious feature interference from a single level can be effectively eliminated, ensuring that the control group sub-regions can truly reflect the features of flawless regions at multiple scales. Therefore, a cross-level constraint mechanism is introduced.

[0127] In different levels of the image pyramid, since the gray-level features of the control group sub-regions need to remain stable in the adjacent levels of the image pyramid, that is, the current level sub-region and its corresponding parent region in the upper level and the corresponding sub-region in the lower level of the image pyramid need to satisfy the fact that the variation range of gray-level mean and variance in each level is within a preset threshold, the cross-level gray-level mean deviation threshold and the cross-level gray-level variance deviation threshold are set as cross-level coherence constraints for gray-level, specifically:

[0128] ;

[0129] In the formula, This represents the average grayscale value of all pixels within the sub-region of the current level; This represents the average grayscale value of all pixels within the corresponding sub-region in adjacent layers (upper and lower layers); This indicates the threshold for cross-layer grayscale mean deviation (e.g., 15). This represents the grayscale variance of all pixels within the sub-region at the current level; This represents the grayscale variance of all pixels within the corresponding sub-region in adjacent layers (upper and lower layers); This represents the threshold for cross-layer grayscale variance deviation (e.g., 25).

[0130] In different levels of the image pyramid, since the distribution of the control group sub-regions in the main direction of adjacent levels of the image pyramid needs to be consistent, a cross-level main direction deviation threshold and a cross-level direction standard deviation deviation threshold are set as cross-level coherence constraints for texture direction, specifically:

[0131] ;

[0132] In the formula, This indicates the gradient direction of the principal direction within the sub-region of the current level; This indicates the gradient direction of the main direction within the corresponding sub-region in adjacent layers (upper and lower layers); This indicates the threshold for cross-layer principal direction deviation (e.g., 10°). This represents the standard deviation of the gradient direction in all directions within the sub-region at the current level; This represents the standard deviation of the gradient direction in all directions within the corresponding sub-region in adjacent layers (upper and lower layers); This indicates the threshold for the standard deviation of the cross-layer direction (e.g., 8°).

[0133] In summary, the sub-regions that simultaneously satisfy the same-layer grayscale stability, directional consistency, and cross-layer feature coherence are used as the control group for comparison. That is, the sub-regions that simultaneously satisfy the grayscale and texture direction constraints as well as the cross-layer coherence constraints of grayscale and texture direction are determined as the control group sub-regions.

[0134] It should be noted that an optimal control group sub-region needs to be determined in each level of the image pyramid. However, in each level, there may be no sub-region that simultaneously satisfies the constraints of grayscale stability within the same level, directional consistency, and cross-level feature coherence. There may be one or more such sub-regions. For some levels where no sub-regions satisfy the constraints of the control group sub-region, the texture correlation between adjacent levels of the image pyramid (e.g., the high correlation of structural features between the bottom and upper layers) is used to interpolate and map the control group sub-regions of adjacent levels to the current level as an approximate benchmark. For example, if there is no control group in the third level, the control group features (grayscale, orientation) of the second level can be interpolated and scaled up to the third level scale as an approximate benchmark (because the structural differences between adjacent levels are small, the error is controllable). For cases where multiple sub-regions in a certain level meet the constraints of the control group sub-region, a typical sub-region is selected from these sub-regions. Specifically, the sub-region with the closest gray-level mean to the global gray-level mean, the smallest gray-level variance (optimal gray-level stability), the smallest deviation between the main direction and the standard direction (90° for warp, 0° for weft), the smallest standard deviation of the direction (optimal direction consistency), and the smallest difference in gray-level and direction from the control group sub-regions of adjacent levels (optimal cross-level continuity) is selected as the control group sub-region for that level.

[0135] S400: In the same level of the image pyramid, analyze the difference in gray level between the test sub-region and the control sub-region, analyze the positional relationship between the test sub-region and the control sub-region in the same level, and analyze the hierarchical relationship between the level of the image pyramid where the test sub-region is located and the total level to obtain the global gray level anomaly score of the test sub-region.

[0136] After obtaining the control group sub-region, the test sub-region is compared with the control group sub-region to quantify the degree of deviation between the test sub-region and the control group sub-region, that is, to quantitatively assess the "degree of disruption of regularity" of the test sub-region.

[0137] Within the same level of the image pyramid, when comparing features between each sub-region and the control group sub-region, different position weighting coefficients are assigned according to their physical location in the textile. In cross-level feature comparison of the image pyramid, the bottom layer of the image pyramid retains more local details, and its feature differences are more indicative of defects, so it is assigned a higher level weighting coefficient.

[0138] Based on the above analysis, in the embodiments of the present invention, by analyzing the difference in grayscale levels between the tested sub-region and the control group sub-region within the same level of the image pyramid, analyzing the positional relationship between the tested sub-region and the control group sub-region within the same level, and analyzing the hierarchical relationship between the level of the image pyramid where the tested sub-region is located and the total level, a global grayscale anomaly score for the tested sub-region is obtained. Further, this includes:

[0139] First, within the same level of the image pyramid, the differences in grayscale fluctuation and mean grayscale between the test sub-region and the control sub-region are analyzed to obtain the degree of grayscale difference between the test sub-region and the control sub-region at each level:

[0140] ;

[0141] ;

[0142] In the formula, Indicates the first position in the image pyramid In each level, the sub-region to be tested Compared with the control group sub-region The degree of difference in grayscale levels; Indicates the first position in the image pyramid The sub-regions to be tested in each level The variance of all pixel grayscale values ​​in the dataset; Indicates the first position in the image pyramid Control group sub-regions in each level The variance of all pixel grayscale values ​​in the dataset; Indicates the first position in the image pyramid The sub-regions to be tested in each level The mean grayscale value of all pixels in the image; Indicates the first position in the image pyramid Control group sub-regions in each level The mean grayscale value of all pixels in the image; and Indicates weight, Adjustable according to the type of defect Increase when detecting texture unevenness For example, structural defects (such as broken yarns or holes), When there are defects such as distorted shapes (e.g., wrinkles), When the defect is mainly due to misalignment (such as warp and weft yarn misalignment), .

[0143] Then, based on the spatial coherence of textile texture, the control group sub-regions that are closer to the test sub-region are more relevant (adjacent sub-regions are more likely to belong to the same lighting and texture conditions). Therefore, within the same level of the image pyramid, based on the Euclidean distance between the test sub-region and the control group sub-regions, the positional weight coefficient corresponding to the test sub-region in each level is obtained as follows:

[0144] ;

[0145] In the formula, Indicates the first position in the image pyramid In each level, the positional weight coefficients corresponding to the sub-regions to be tested; Indicates the first The Euclidean distance between the centroid of the test sub-region and the centroid of the control sub-region in each level.

[0146] The degree of difference in grayscale level after weighting by position weight coefficient is:

[0147] ;

[0148] In the formula, Indicates the first position in the image pyramid Within each level, the degree of grayscale difference of the sub-region under test after weighting by the position weight coefficient; Indicates the first position in the image pyramid In each level, the positional weight coefficients corresponding to the sub-regions to be tested; Indicates the first position in the image pyramid The degree of difference in gray level between the tested sub-region and the control group sub-region within each level.

[0149] Furthermore, because deeper levels of the image pyramid retain more detail, their layer-level grayscale differences are more sensitive to small-sized defects, thus different levels have different weights. Therefore, by calculating the layer difference between each level and the total number of levels in the image pyramid, and introducing scaling and defect size adaptation coefficients, the layer weight coefficient corresponding to each level is obtained as follows:

[0150] ;

[0151] In the formula, Indicates the first position in the image pyramid In each level, the level weight coefficient corresponding to the sub-region to be tested; This represents the total number of levels in the image pyramid; Indicates the first The number of levels in each hierarchy; This represents the scaling factor (e.g., 0.1, used to adjust the weights to a reasonable range and avoid excessively large values). Indicates the defect size fit coefficient. The smallest defect size that can be detected at the current level (such as a broken yarn in a smooth cotton fabric). It can be set to 1.2).

[0152] By weighting the degree of grayscale difference at each level using both location and level weighting coefficients, the weighted degree of grayscale difference between the tested sub-region and the control group sub-region at each level is obtained. That is, the weighted degree of grayscale difference at each level obtained after double weighting using both location and level weighting coefficients is:

[0153] ;

[0154] In the formula, Indicates the first position in the image pyramid In each level, the weighted level grayscale difference of the sub-region under test is obtained by weighting it with both position weight coefficient and level weight coefficient; Indicates the first position in the image pyramid In each level, the level weight coefficient corresponding to the sub-region to be tested; Indicates the first position in the image pyramid Within each level, the degree of grayscale difference of the sub-region under test is calculated by weighting the position weight coefficient.

[0155] In the image pyramid, the weighted difference at each level represents the degree of deviation between the tested sub-region and the control sub-region at that scale. The tested sub-region does not exist only at a specific level, but rather in all levels of the image pyramid. It needs to be compared with the control sub-region at each level, and the global score is obtained by accumulating the differences across levels. Therefore, by traversing all levels, the global grayscale anomaly score of the tested sub-region is obtained. Specifically, the weighted grayscale difference levels obtained after double weighting at all levels are summed to obtain the global grayscale anomaly score of the tested sub-region:

[0156] ;

[0157] In the formula, This represents the global grayscale anomaly score of the sub-region under test; Indicates the first position in the image pyramid In each level, the weighted level grayscale difference of the sub-region under test is obtained by weighting it with both position weight coefficient and level weight coefficient; This represents the total number of levels in the image pyramid.

[0158] Furthermore, to achieve rapid detection, unlimited downsampling should be avoided during image pyramid construction. When high-level downsampling leads to a significant decrease in detection accuracy, a termination strategy can be used to promptly stop layer expansion and reduce computation time. Therefore, it is set here that if the weighted grayscale difference of a certain layer is less than a certain proportion of the bottom layer, and the weights of subsequent layers decrease, then it is considered that continuing downsampling cannot effectively improve detection accuracy, and early termination is possible. Therefore, after obtaining the weighted grayscale difference, the following is also included:

[0159] The system sets a first constraint on the degree of grayscale difference between weighted levels and a second constraint on the weight coefficients of each level. Specifically, it sets a threshold for the degree of difference; the first constraint is that the ratio of the grayscale difference between the current level and the bottom-most level is less than this threshold. The second constraint is a weight decay rate; the second constraint is that the ratio of the weight coefficients between the current level and the previous level is less than this decay rate. That is:

[0160] ;

[0161] In the formula, Indicates the first position in the image pyramid The degree of weighted hierarchical grayscale difference in the sub-region under test within each level; Indicates the percentage threshold (e.g., 0.2); This represents the weighted level grayscale difference of the sub-region under test in the lowest level of the image pyramid; Indicates the first position in the image pyramid In each level, the level weight coefficient corresponding to the sub-region to be tested; Indicates the first position in the image pyramid In each level, the level weight coefficient corresponding to the sub-region to be tested; This represents the weight decay rate threshold (e.g., 0.8 indicates that the weight decays by more than 20% month-on-month).

[0162] If both the first and second constraints are met, and continuing downsampling cannot effectively improve detection accuracy, then the downsampling operation can be terminated early.

[0163] S500: Determine the actual defect area based on the global grayscale anomaly score.

[0164] By combining the above-mentioned position-weighted and hierarchical-weighted modulation, the system obtains a global gray-scale anomaly score by combining the degree of hierarchical gray-scale difference between the sub-region and the control group sub-region with position-weighted and hierarchical weighted values. The larger the value, the higher the degree of deviation between the sub-region under test and the normal region (control group sub-region).

[0165] Therefore, the actual defect area is finally determined based on the global grayscale anomaly score. Specifically, an anomaly score threshold is set (a value of 0.8 can be used); it is then determined whether the global grayscale anomaly score of the sub-region is greater than the anomaly score threshold; if so, i.e. If the score is high, then the high-scoring sub-region is determined as a real defect region. Traverse all sub-regions to identify all real defect regions.

[0166] Based on the same inventive concept as the above method, this embodiment also provides a rapid detection system for textile defects.

[0167] Please see Figure 3 This illustrates the basic components of a rapid detection system for textile defects provided by an embodiment of the present invention.

[0168] like Figure 3 As shown, a rapid detection system for textile defects includes: a memory 10 and a processor 20, wherein:

[0169] Memory 10 is used to store program code;

[0170] The processor 20 is used to read the program code stored in the memory 10 and execute it. First, it acquires an image of the textile surface and divides the surface image into several sub-regions. Then, it analyzes the arrangement characteristics of the warp and weft yarns at the edges of the sub-regions to obtain the defect probability of the sub-regions. Based on the defect probability, it performs an adaptive sampling downsampling operation on the sub-regions to generate an image pyramid. Then, in the same level of the image pyramid, it sets grayscale and texture direction constraints, and in different levels of the image pyramid, it sets cross-level coherence constraints for grayscale and texture direction to determine the control group sub-regions. Then, in the same level of the image pyramid, it analyzes the difference in grayscale between the test sub-region and the control group sub-regions, analyzes the positional relationship between the test sub-region and the control group sub-regions in the same level, and analyzes the hierarchical relationship between the level of the image pyramid where the test sub-region is located and the total level to obtain the global grayscale anomaly score of the test sub-region. Finally, based on the global grayscale anomaly score, it determines the real defect area.

[0171] Furthermore, the processor 20 includes an image acquisition module 21, an image pyramid acquisition module 22, a control group sub-region determination module 23, a global grayscale anomaly scoring module 24, and a true defect region determination module 25. Wherein:

[0172] Image acquisition module 21 is used to acquire images of the textile surface and divide the surface images into several sub-regions;

[0173] The image pyramid acquisition module 22 is used to analyze the arrangement pattern characteristics of warp and weft yarns at the edge of the sub-region, obtain the defect probability of the sub-region, and perform an adaptive sampling downsampling operation on the sub-region based on the defect probability to generate an image pyramid.

[0174] The control group sub-region determination module 23 is used to set grayscale and texture direction constraints in the same level of the image pyramid, and to set cross-level coherence constraints of grayscale and texture direction in different levels of the image pyramid to determine the control group sub-region.

[0175] The global grayscale anomaly scoring module 24 is used to analyze the difference in grayscale between the test sub-region and the control sub-region in the same level of the image pyramid, analyze the positional relationship between the test sub-region and the control sub-region in the same level, and analyze the hierarchical relationship between the level of the image pyramid where the test sub-region is located and the total level, so as to obtain the global grayscale anomaly score of the test sub-region.

[0176] The real defect area determination module 25 is used to determine the real defect area based on the global grayscale anomaly score.

[0177] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0178] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A rapid detection method for defects in textiles, characterized in that, The method includes: Acquire images of the textile surface and divide the surface images into several sub-regions; The arrangement pattern of warp and weft yarns at the edge of the sub-region is analyzed to obtain the defect probability of the sub-region. Based on the defect probability, an adaptive sampling downsampling operation is performed on the sub-region to generate an image pyramid. In the same level of the image pyramid, grayscale and texture direction constraints are set, and in different levels of the image pyramid, cross-level coherence constraints of grayscale and texture direction are set to determine the control group sub-region. In the same level of the image pyramid, the difference in gray level between the sub-region under test and the sub-region under control is analyzed, the positional relationship between the sub-region under test and the sub-region under control in the same level is analyzed, and the hierarchical relationship between the level of the image pyramid where the sub-region under test is located and the total level is analyzed to obtain the global gray level anomaly score of the sub-region under test. The actual defect area is determined based on the global grayscale anomaly score; Specifically, within the same level of the image pyramid, the difference in grayscale levels between the tested sub-region and the control group sub-region is analyzed, along with the positional relationship between the tested sub-region and the control group sub-region within the same level. Furthermore, the hierarchical relationship between the level of the image pyramid containing the tested sub-region and the overall level is analyzed to obtain a global grayscale anomaly score for the tested sub-region, including: In the same level of the image pyramid, the difference in grayscale fluctuation and the difference in grayscale mean between the test sub-region and the control sub-region are analyzed to obtain the degree of level grayscale difference between the test sub-region and the control sub-region in each level. In the same level of the image pyramid, the position weight coefficient corresponding to the sub-region to be tested in each level is obtained based on the Euclidean distance between the sub-region to be tested and the sub-region to be controlled. The difference between each level and the total level in the image pyramid is calculated, and a scaling factor and a defect size adaptation factor are introduced to obtain the level weight coefficient corresponding to the sub-region to be tested in each level. By weighting the degree of grayscale difference between the layers using the position weight coefficient and the layer weight coefficient, the weighted degree of grayscale difference between the sub-region under test and the control group sub-region in each layer is obtained. By traversing all layers, a global grayscale anomaly score for the sub-region under test is obtained.

2. The rapid detection method for textile defects according to claim 1, characterized in that, Analyzing the arrangement pattern of warp and weft yarns at the edge of the sub-region, the defect probability of the sub-region is obtained. Based on the defect probability, an adaptive downsampling operation is performed on the sub-region to generate an image pyramid, including: By analyzing the integrity, curvature characteristics, and directional characteristics of the edge warp and weft yarns of the sub-regions, the defect probability of each sub-region is obtained. Based on the defect probability of the sub-region, the clustering characteristics of defects within the sub-region are analyzed, and the sampling scale corresponding to the sub-region is obtained by combining the textile type. Based on the sampling scale, the sub-region is downsampled with an adaptive sampling size to generate an image pyramid.

3. The rapid detection method for textile defects according to claim 2, characterized in that, Analyzing the integrity, curvature characteristics, and directional consistency of the edge warp and weft yarns of the sub-regions yields the defect probability of each sub-region, including: Extract the edge contour of the sub-region, perform Hough line transformation on the edge contour, and calculate the total length of the edge contour and the total length of the line to obtain the integrity of the warp and weft yarns at the edge of the sub-region. Extract the single-pixel skeleton of the edge contour, and perform quadratic curve fitting on the single-pixel skeleton. Calculate the curvature value of each pixel based on the fitted curve to obtain the average curvature of the edge warp and weft yarns of the sub-region. Extract the warp and weft yarn pixels on the edge contour, and analyze the angular deviations of the warp and weft yarn pixel directions from the standard direction to obtain the consistency of the warp and weft yarn directions at the edge of the sub-region. The defect probability of each sub-region is obtained by combining the integrity, average curvature, and directional consistency of the edge warp and weft yarns of the sub-region.

4. The rapid detection method for textile defects according to claim 2 or 3, characterized in that, Based on the defect probability of the sub-region, the clustering characteristics of defects within the sub-region are analyzed, and combined with the textile type, the sampling scale corresponding to the sub-region is obtained, including: The difference between the defect probabilities of the sub-region and its neighboring sub-regions is analyzed, and a spatial correlation coefficient is introduced to obtain the defect weight coefficient of the sub-region. Based on the defect weight coefficient, combined with the textile type, and combined with the original resolution and global structural scale of the sub-region, the sampling scale corresponding to the sub-region is obtained.

5. The rapid detection method for textile defects according to claim 1, characterized in that, Within the same level of the image pyramid, grayscale and texture direction constraints are set; and across different levels of the image pyramid, cross-level coherence constraints for grayscale and texture direction are set to determine control group sub-regions, including: In the same level of the image pyramid, grayscale fluctuation threshold and intra-layer grayscale deviation threshold are set as grayscale constraints, and main direction ratio threshold and maximum direction deviation threshold are set as texture direction constraints. In different levels of the image pyramid, the cross-level gray mean deviation threshold and the cross-level gray variance deviation threshold are set as cross-level coherence constraints for gray levels, and the cross-level principal direction deviation threshold and the cross-level direction standard deviation deviation threshold are set as cross-level coherence constraints for texture directions. Subregions that simultaneously satisfy both grayscale and texture direction constraints, as well as cross-layer coherence constraints of grayscale and texture direction, are designated as control group subregions.

6. The rapid detection method for textile defects according to claim 1, characterized in that, The method further includes: Set a first constraint condition for the degree of grayscale difference of the weighted level, and set a second constraint condition for the level weight coefficient; If both the first constraint and the second constraint are met simultaneously, the downsampling operation will be terminated prematurely.

7. The rapid detection method for textile defects according to claim 6, characterized in that, The first constraint condition for setting the degree of gray-level difference in the weighted hierarchy, and the second constraint condition for setting the hierarchy weight coefficient, include: Set a threshold for the degree of difference; The first constraint condition is that the ratio between the weighted level grayscale difference between the current level and the bottommost level is less than the difference threshold. Set the weighted cycle decay rate; The second constraint condition is that the ratio between the weight coefficients of the current level and the previous level is less than the weight cycle decay rate.

8. A rapid detection system for textile defects, characterized in that, The system includes: a memory and a processor, wherein: The memory is used to store program code; The processor is configured to read program code stored in the memory and execute the method as described in any one of claims 1 to 7.

9. The rapid detection system for textile defects according to claim 8, characterized in that, The processor includes: An image acquisition module is used to acquire images of the textile surface and divide the surface images into several sub-regions; The image pyramid acquisition module is used to analyze the arrangement pattern characteristics of the warp and weft yarns at the edge of the sub-region, obtain the defect probability of the sub-region, and perform an adaptive sampling size downsampling operation on the sub-region based on the defect probability to generate an image pyramid. The control group sub-region determination module is used to set grayscale and texture direction constraints in the same level of the image pyramid, and to set cross-level coherence constraints of grayscale and texture direction in different levels of the image pyramid to determine the control group sub-region. The global grayscale anomaly scoring module is used to analyze the difference in grayscale levels between the test sub-region and the control sub-region in the same level of the image pyramid, analyze the positional relationship between the test sub-region and the control sub-region in the same level, and analyze the hierarchical relationship between the level of the image pyramid where the test sub-region is located and the total level, so as to obtain the global grayscale anomaly score of the test sub-region. The actual defect area determination module is used to determine the actual defect area based on the global grayscale anomaly score.

Citation Information

Patent Citations

  • Defective needle flaw detection method of circular knitting machine

    CN107016664A

  • Surface defect detection method based on generative adversarial network

    CN118864342A