A method for detecting defects in a jacquard knit
By constructing prior data of jacquard structure and coil phase correction, combined with structural residual image comparison and time-series verification, the problem of high false detection rate in defect detection of high-density jacquard knitted fabrics is solved, and stable and accurate detection is achieved in complex backgrounds, which is suitable for small-batch customized production.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG QIHUI INTELLIGENT TECH CO LTD
- Filing Date
- 2026-04-15
- Publication Date
- 2026-07-17
AI Technical Summary
Existing defect detection technologies for jacquard knitted fabrics struggle to distinguish complex jacquard backgrounds from actual defects in high-density, multi-color jacquard knitted fabrics. Furthermore, the images are unstable during online detection, leading to a high false detection rate. General algorithms and models cannot achieve stable and accurate detection.
By acquiring prior data on jacquard structure, a desired pattern structure diagram is constructed. Combined with coil phase correction and period alignment, structural residual images are compared to screen high-risk abnormal areas. False defects are eliminated through continuous frame tracking and time-series verification, and finally, defect types are classified.
It achieves stable and accurate detection of minute defects in complex jacquard backgrounds, reduces the false detection rate, is suitable for small-batch, multi-variety customized production, and reduces the recalibration and retraining costs of switching to new patterns.
Smart Images

Figure CN122415476A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, specifically a method for detecting defects in jacquard knitted fabrics. Background Technology
[0002] With the rapid development of knitting manufacturing towards intelligentization, high-density patterns, and personalized customization, jacquard knitted fabrics, with their complex patterns and rich color schemes, are widely used in the textile industry. Online defect detection has become a key link in ensuring product quality and production efficiency. High-density, multi-color jacquard knitted fabrics are prone to defects such as missed needles, loose threads, broken yarns, mismatched patterns, and misaligned colored yarns during production. The fabric's own periodic patterns, loop relief shadows, tension fluctuations, row and column phase shifts, and local lighting changes significantly increase the difficulty of defect identification. Traditional manual inspection is inefficient, inaccurate, and cannot meet the needs of high-speed online production, thus requiring stable and reliable automatic inspection technology.
[0003] Existing defect detection technologies for jacquard knitted fabrics mainly fall into two categories: traditional image processing and deep learning detection. Traditional image processing methods rely on template comparison, background suppression, frequency domain analysis, texture statistics, and morphological processing to extract defect features by removing the fabric background, and are applicable to general fabric detection to a certain extent. Deep learning methods use network models such as CNN, YOLO, and Transformer to directly detect, classify, and segment defects, improving the automation and real-time performance of detection. Both types of technologies perform well in solid-color or low-complexity fabric scenarios, but are difficult to adapt to the complex detection environment of high-density jacquard knitted fabrics.
[0004] However, existing jacquard knitted fabric defect detection technologies have significant technical shortcomings in practical applications: On the one hand, the periodic structure, color block boundaries, and loop shadows of complex jacquard patterns can create a large number of false edges, leading to misjudgment of normal patterns and missed detection of small and weak defects. General algorithms and models cannot effectively distinguish between normal pattern variations and real defects. On the other hand, in online production, fabrics are affected by tension, speed, sway, and lighting fluctuations, resulting in unstable image phase and morphology. Fixed template matching errors are large, and pure deep learning models rely on a large number of identical defect samples. They have weak generalization ability across patterns, and the cost of recalibration and retraining is high when switching to new patterns, making it impossible to achieve stable and accurate online detection of defects in complex jacquard backgrounds. Summary of the Invention
[0005] The purpose of this invention is to provide a method for detecting defects in jacquard knitted fabrics, thereby addressing the problems mentioned in the background. This method can effectively distinguish between complex jacquard backgrounds and real defects, overcome image instability factors during online detection, and achieve stable and accurate detection of minute defects without relying on a large number of defect samples.
[0006] The objective of this invention can be achieved through the following technical solution: a method for detecting defects in jacquard knitted fabrics, comprising the following steps:
[0007] Acquire prior data of jacquard structure, which includes theoretical pattern prior data and real-time detection input data;
[0008] Construct the desired pattern structure diagram based on the theoretical pattern prior data;
[0009] The real-time detection input data is subjected to coil phase correction and period alignment to obtain an alignment image;
[0010] The alignment image is compared with the desired pattern structure image to obtain a structural residual image; high-risk abnormal regions are screened from the structural residual image to obtain a defect residual image.
[0011] The defect residual map is subjected to continuous frame tracking and timing verification to eliminate false defects caused by instantaneous interference, and the final defect judgment result is obtained.
[0012] Based on the final defect determination result, the defect type is classified to obtain the defect classification result.
[0013] As a further aspect of the present invention, the acquisition of prior data on jacquard tissue includes:
[0014] Obtain the jacquard structure file, pattern design drawing, yarn color matching table, machine size parameters and needle pitch parameters corresponding to the jacquard knitted fabric to be tested, and obtain the theoretical pattern prior data;
[0015] Collect online fabric image sequences and device encoder pulses and fabric roll data to obtain real-time detection input data;
[0016] Based on the equipment encoder pulses and fabric roll data, the theoretical pattern prior data is spatially aligned with the real-time detection input data according to the production travel length to obtain the jacquard structure prior data.
[0017] As a further aspect of the present invention, the step of constructing the desired pattern structure diagram based on the theoretical pattern prior data specifically includes:
[0018] Based on the arrangement relationship of each organizational unit, the distribution relationship of colored yarns, and the repetition period relationship in the jacquard structure file, a theoretical pattern topology diagram is obtained;
[0019] Collect images of a standard sample fabric without defects using the same process, and calibrate the basic magnification ratio; the basic magnification ratio is the number of image pixels corresponding to a unit physical length, which is calculated by the pixel distance of feature points with known physical distances on the standard sample fabric.
[0020] Based on the basic magnification, the fabric design width and design height, the target pixel size of the theoretical pattern topology map is calculated, and bilinear interpolation is used to scale the theoretical pattern topology map to the target size to generate the initial expected pattern structure map.
[0021] Based on batch shrinkage differences, images of the first roll of standard fabric were collected, the actual width and actual height were measured, and the horizontal and vertical scaling factors were calculated.
[0022] Based on the horizontal scaling factor and the vertical scaling factor, the initial desired pattern structure diagram is subjected to an affine scaling transformation to obtain the desired pattern structure diagram.
[0023] As a further aspect of the present invention, the step of obtaining a theoretical pattern topology diagram based on the arrangement relationship, yarn distribution relationship, and repetition period relationship of each weave unit in the jacquard weave file includes:
[0024] The jacquard weave file is parsed to extract the needle position weave status data column by column and row by row to obtain the original weave data matrix with the columns as rows and the columns as columns. Each element in the matrix records the weave type of the corresponding needle position in the corresponding column. The weave type includes one or more of the following: loop, tufted loop, floating thread, and shifted loop.
[0025] Read the yarn color matching table, establish the corresponding mapping relationship between color number, yarn feeder number and needle position, match the mapping relationship position by position to the original structure data matrix, generate a structure matrix with color yarn allocation information, so that each element in the matrix contains both structure type and corresponding color number information;
[0026] Autocorrelation is performed on the organization matrix with colored yarn allocation information along the horizontal longitudinal direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the horizontal direction; autocorrelation is also performed along the vertical column direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the vertical direction. The area defined by the minimum repeating period in the horizontal direction and the minimum repeating period in the vertical direction is marked as the minimum jacquard cycle unit.
[0027] Based on the smallest jacquard cycle unit, the relative positional relationship of each weaving point within the unit, the connection relationship of adjacent weaving points, and the continuity and boundary relationship of colored yarn distribution are extracted. Data of ground line and padding yarn that do not participate in the pattern formation are removed, while retaining the effective jacquard structure and colored yarn topology information.
[0028] Record the relative column and column numbers of all weaving points within the smallest jacquard repeat unit in relative coordinate form, establish the adjacency topology of weaving points, and obtain the theoretical pattern topology diagram.
[0029] As a further aspect of the present invention, the step of performing coil phase correction and periodic alignment on the real-time detection input data to obtain an alignment image includes:
[0030] Preprocess the online fabric image of the current frame to obtain the preprocessed online fabric image of the current frame;
[0031] Based on the structural tensor algorithm, the main texture direction of the preprocessed online fabric image in the current frame is extracted;
[0032] Based on frequency domain analysis, the coil period information of the preprocessed online fabric image of the current frame is extracted;
[0033] The main texture direction and periodic information of the preprocessed online fabric image of the current frame are matched with the desired pattern structure diagram to obtain the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction and deflection angle.
[0034] Based on the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction, and deflection angle, the current frame preprocessed online fabric image is geometrically transformed to obtain an alignment image that is precisely aligned with the desired pattern structure diagram.
[0035] As a further aspect of the present invention, the step of comparing the alignment image with the desired pattern structure image to obtain a structural residual image includes:
[0036] Based on the alignment image and the desired pattern structure map, a spatially corresponding region is established. Gradient consistency comparison, texture distribution comparison and grayscale distribution comparison are performed on the spatially corresponding region to generate structural difference information.
[0037] A structural residual image is generated based on the structural difference information.
[0038] As a further aspect of the present invention, the step of screening high-risk abnormal regions in the structural residual image to obtain a defect residual image includes:
[0039] The prior information of the organization in the desired pattern structure image is called to perform pattern boundary suppression and periodic background suppression on the structural residual image to obtain the suppressed residual information;
[0040] The suppressed residual information is binarized and connected component analysis is performed to extract candidate abnormal regions that meet the physical scale of the defects;
[0041] Based on the candidate anomaly regions, a defect scoring model is constructed and defect score values are calculated to screen high-risk anomaly regions.
[0042] Based on the structural residual image and the high-risk anomaly region, a defect residual map constrained by organizational priors is generated.
[0043] As a further aspect of the present invention, the specific steps of constructing a defect scoring model based on the candidate anomaly regions and calculating defect score values to screen high-risk anomaly regions include:
[0044] Constructing a defect scoring model ,in, This indicates the defect score. For structural residuals, For phase anomaly terms, For time-series continuous terms, These are weighting coefficients;
[0045] The defect score is calculated for each candidate abnormal region according to the defect scoring model. A defect score threshold is preset. When the defect score of a candidate abnormal region is greater than or equal to the preset defect score threshold, it is judged as a high-risk abnormal region. When the defect score of a candidate abnormal region is less than the preset defect score threshold, it is judged as a low-risk or normal interference region and is removed.
[0046] This process identifies high-risk anomaly areas.
[0047] As a further aspect of the present invention, the step of performing continuous frame tracking and timing verification on the defect residual map to eliminate false defects caused by transient interference and obtain the final defect judgment result includes:
[0048] For high-risk abnormal regions in the defect residual map of multiple consecutive frames, position tracking and shape tracking are performed by target tracking algorithm to establish the temporal trajectory of each high-risk abnormal region on the time axis;
[0049] Based on the temporal trajectory, the stability index of each high-risk anomaly region in consecutive frames is calculated. The stability index includes the number of continuous frames, area fluctuation rate and grayscale stability, to obtain the temporal consistency result.
[0050] By integrating the temporal consistency results with the defect score, false defects caused by transient interference are eliminated, and the final defect judgment result is obtained.
[0051] As a further aspect of the present invention, the step of classifying defect types based on the final defect determination result to obtain defect classification results includes:
[0052] Based on the final defect judgment result, the defect location, area, length, direction and confidence level are output to obtain the defect detection result;
[0053] Based on the defect detection results, combined with structural residual features, temporal continuity features, and pattern prior deviation types, a lightweight classifier is used to classify the defects, resulting in defect classification results.
[0054] The beneficial effects of this invention are:
[0055] This invention constructs a desired pattern structure diagram by introducing prior data on jacquard weave structure. Using the standard appearance of the design state as the detection benchmark, prior knowledge such as the jacquard weave structure, yarn distribution, and loop period of the design state is incorporated into the detection process. In subsequent comparisons, this prior information is used to perform boundary suppression and periodic background suppression on the structural residuals. This effectively filters out interference from normal pattern variations, yarn boundary gradients, and loop shadows, allowing the generated residual diagram to focus on real defects inconsistent with the prior weave information. This fundamentally solves the problem of high false detection rates in complex jacquard backgrounds.
[0056] This invention automatically corrects lateral offset, longitudinal offset, scale deviation, and texture deflection of images through coil phase correction and periodic alignment, eliminating alignment deviations caused by tension fluctuations, mechanical vibrations, and fabric stretching during online production. This achieves sub-pixel-level precise alignment between the online image and the desired pattern structure image, ensuring continuous and stable detection in high-speed, dynamic production environments.
[0057] In the comparison stage, this invention not only employs traditional grayscale comparison but also introduces gradient consistency comparison and texture distribution comparison to quantify the structural differences between the actual image and the desired pattern from multiple dimensions, generating a structural residual map. Based on this, prior organizational information, such as yarn color masks and coil periods, is further utilized to weight and weaken the residuals and perform frequency domain filtering, enabling the residual map to accurately characterize structural anomalies rather than simply reflecting texture complexity. This strategy, combining multi-dimensional comparison with prior constraints, achieves high detection capability even for minor defects (such as broken yarns or misaligned patterns).
[0058] This invention uses jacquard structure prior as its core, eliminating the need to collect a large number of identical defective samples or to train a deep model. When switching to a new pattern, it is only necessary to import the jacquard structure file and calibrate the basic sample fabric to quickly reconstruct the desired pattern structure diagram and alignment parameters, which significantly reduces the cost of recalibration and retraining when switching to a new pattern. It is particularly suitable for small-batch, multi-variety, and customized intelligent knitting production. Attached Figure Description
[0059] The invention will now be further described with reference to the accompanying drawings.
[0060] Figure 1 This is a flowchart of the method of the present invention.
[0061] Figure 2 This is a comparison diagram of the effects of the present invention and the prior art. Detailed Implementation
[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] Please see Figure 1 As shown, the present invention is a method for detecting defects in jacquard knitted fabrics, comprising the following steps:
[0064] Step 1: Obtain the prior data of jacquard structure, which includes theoretical pattern prior data and real-time detection input data.
[0065] Furthermore, prior data on the jacquard weave structure were obtained, including:
[0066] Obtain the jacquard structure file, pattern design drawing, yarn color matching table, machine size parameters and needle pitch parameters corresponding to the jacquard knitted fabric to be tested, and obtain the theoretical pattern prior data;
[0067] Collect online fabric image sequences and device encoder pulses and fabric roll data to obtain real-time detection input data;
[0068] Based on the equipment encoder pulses and fabric roll data, the theoretical pattern prior data is spatially aligned with the real-time detection input data according to the production travel length to obtain the jacquard structure prior data.
[0069] In a specific embodiment, the jacquard structure file corresponding to the jacquard knitted fabric to be tested is obtained. The jacquard structure file includes a pattern diagram file, a structure point matrix file, or a pattern instruction file for the knitting machine. The arrangement relationship of each structure unit, the distribution relationship of colored yarns, and the pattern repetition cycle are extracted from the jacquard structure file. The machine size parameter and the needle pitch parameter are obtained from the production process sheet. The machine size parameter represents the number of needles per inch or per centimeter, and the needle pitch parameter represents the center distance between adjacent needles. The yarn color matching table is obtained. The yarn color matching table contains the color code, yarn count, and distribution position of each colored yarn in the jacquard structure. The above data together constitute the theoretical pattern prior data describing the fabric in the "design state", which is used to characterize the structure and pattern layout of the fabric in the ideal design state.
[0070] During online fabric production, industrial cameras, such as line scan or area scan cameras, mounted above the fabric continuously capture a sequence of online fabric images. Simultaneously, synchronization signals related to fabric movement are acquired from the control system of circular knitting machines or flat knitting machines. These include encoder pulse signals mounted on the tension rollers or roll-up rollers, as well as the current roll-up speed data. The image sampling frequency needs to be set according to the production speed and detection accuracy requirements. A preferred setting rule is to ensure that the fabric's longitudinal (running direction) displacement between two adjacent frames does not exceed half the height of a coil (i.e., loop height) to guarantee the continuity of subsequent time-series analysis. This data constitutes the real-time detection input data reflecting the fabric in its "production state."
[0071] Based on the encoder pulse count or the cumulative length of the fabric roll, the information such as the weave points and yarn distribution of the theoretical pattern is mapped to the current production position of the fabric. A one-to-one correspondence between online fabric image frames and corresponding production positions is established, so that the prior data of the theoretical pattern can be accurately matched to the image area acquired in real time. This provides a benchmark for the subsequent construction of the desired pattern and image alignment, completes the association and matching of design state data and production state data, and obtains the prior data of jacquard weave.
[0072] Step 2: Construct the desired pattern structure diagram based on the theoretical pattern prior data;
[0073] Furthermore, based on the aforementioned theoretical pattern prior data, a desired pattern structure diagram is constructed, specifically including:
[0074] Based on the arrangement relationship of each organizational unit, the distribution relationship of colored yarns, and the repetition period relationship in the jacquard structure file, a theoretical pattern topology diagram is obtained;
[0075] Collect images of a standard sample fabric without defects using the same process, and calibrate the basic magnification ratio; the basic magnification ratio is the number of image pixels corresponding to a unit physical length, which is calculated by the pixel distance of feature points with known physical distances on the standard sample fabric.
[0076] Based on the basic magnification, the fabric design width and design height, the target pixel size of the theoretical pattern topology map is calculated, and bilinear interpolation is used to scale the theoretical pattern topology map to the target size to generate the initial expected pattern structure map.
[0077] Based on batch shrinkage differences, images of the first roll of standard fabric were collected, the actual width and actual height were measured, and the horizontal and vertical scaling factors were calculated.
[0078] Based on the horizontal scaling factor and the vertical scaling factor, the initial desired pattern structure diagram is subjected to an affine scaling transformation to obtain the desired pattern structure diagram.
[0079] In one specific embodiment, the jacquard tissue file is parsed in format, and the needle position tissue status data is extracted column by column and row by row to obtain the original tissue data matrix with the horizontal column as the row and the vertical column as the column. Each element in the matrix records the tissue type of the corresponding needle position in the corresponding horizontal column. The tissue type includes one or more of the following: loop, clump, floating thread, and shifted loop.
[0080] Read the yarn color matching table, establish the corresponding mapping relationship between color number, yarn feeder number and needle position, match the mapping relationship position by position to the original structure data matrix, generate a structure matrix with color yarn allocation information, so that each element in the matrix contains both structure type and corresponding color number information;
[0081] Autocorrelation is performed on the organization matrix with colored yarn allocation information along the horizontal longitudinal direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the horizontal direction; autocorrelation is also performed along the vertical column direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the vertical direction. The area defined by the minimum repeating period in the horizontal direction and the minimum repeating period in the vertical direction is marked as the minimum jacquard cycle unit.
[0082] Based on the smallest jacquard cycle unit, the relative positional relationship of each weaving point within the unit, the connection relationship of adjacent weaving points, and the continuity and boundary relationship of colored yarn distribution are extracted. Data of ground line and padding yarn that do not participate in the pattern formation are removed, while retaining the effective jacquard structure and colored yarn topology information.
[0083] Record the relative column and column numbers of all weaving points in the smallest jacquard cycle unit in relative coordinate form, establish the adjacency topology of weaving points, and obtain a theoretical pattern topology diagram that only represents the structure and yarn arrangement and does not contain physical size and pixel information.
[0084] Obtain the current width parameters of the fabric to be tested, retrieve a defect-free standard sample fabric to complete the calibration, and obtain the basic magnification. The standard sample fabric is a qualified fabric produced by the same process, and the calibration method is to select a known physical distance from the standard sample fabric image. Two feature points are used to measure their pixel distance in the image. Calculate the basic magnification. The calculation formula is: It should be noted that the base magnification represents the number of image pixels per unit physical length.
[0085] Based on the basic magnification Fabric design width Fabric design width and height Calculate the target pixel size of the theoretical pattern topology map. The calculation formula is: The theoretical pattern topology map was scaled down using bilinear interpolation. The pixel size is adjusted while maintaining the position of the fabric points, the distribution of colored yarns, and the adjacency relationship during scaling. An initial desired pattern structure diagram is generated so that it perfectly matches the resolution of the online image.
[0086] Due to potential differences in fabric shrinkage between different batches or during production, actual images of the fabric are captured during the initial standard sample run on the production line to obtain the actual width of the current batch of fabric. and actual height Through formula Calculate the horizontal scaling factor and vertical scaling factor ;
[0087] Subsequently, an affine scaling transformation is performed on the initial desired pattern structure diagram to eliminate the size deviation caused by batch shrinkage, generating a desired pattern structure diagram with the same scale and coordinate system as the actual image; the desired pattern structure diagram includes the theoretical coil position, theoretical yarn distribution, and theoretical jacquard boundary.
[0088] It should be noted that in step two, by parsing and converting the jacquard fabric file, a visual reference image with the same coordinate system, pixel size, and physical proportion as the online acquired image is constructed. This image is denoted as the expected pattern structure diagram. The expected pattern structure diagram is used to characterize the standard appearance of the jacquard knitted fabric in a defect-free state and to provide a reference for subsequent structural comparison with the actual captured image.
[0089] Step 3: Perform coil phase correction and period alignment on the real-time detection input data to obtain an alignment image;
[0090] Furthermore, the real-time detection input data is subjected to coil phase correction and periodic alignment to obtain an alignment image, including:
[0091] Preprocess the online fabric image of the current frame to obtain the preprocessed online fabric image of the current frame;
[0092] Based on the structural tensor algorithm, the main texture direction of the preprocessed online fabric image in the current frame is extracted;
[0093] Based on frequency domain analysis, the coil period information of the preprocessed online fabric image of the current frame is extracted;
[0094] The main texture direction and periodic information of the preprocessed online fabric image of the current frame are matched with the desired pattern structure diagram to obtain the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction and deflection angle.
[0095] Based on the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction, and deflection angle, the current frame preprocessed online fabric image is geometrically transformed to obtain an alignment image that is precisely aligned with the desired pattern structure diagram.
[0096] In one specific embodiment, the current frame's online fabric image is converted into a grayscale image, and a 5×5 Gaussian filter is used to remove image noise. Then, directional filter kernels are applied along the horizontal and vertical directions of the coils to enhance the coherence of the coil row and column edges. Grayscale normalization is achieved through histogram equalization to eliminate the influence of uneven lighting on texture feature extraction. Invalid areas of the image edges are cropped, and the effective detection area of the fabric is retained to enhance the texture clarity of the coil row and column structure, resulting in a preprocessed image.
[0097] Iterate through all pixels of the preprocessed image and calculate the horizontal and vertical gradients of each pixel using the Sobel gradient operator; construct the local structure tensor matrix. ,in, For the sum of squared horizontal gradients, It is the sum of the products of the horizontal and vertical gradients. It is the sum of squared vertical gradients; this matrix can accurately represent the texture distribution trend of local regions; eigenvalue decomposition is performed on the structural tensor matrix, and the eigenvector corresponding to the largest eigenvalue is taken as the main texture direction;
[0098] The preprocessed image is subjected to a fast Fourier transform to convert the spatial domain texture information into a frequency domain signal. The periodic information of the fabric, such as the transverse and longitudinal periods of the coil, is determined based on the position of the main peak in the spectrum.
[0099] The main texture direction and period information of the preprocessed online fabric image of the current frame are matched with the desired pattern structure image generated in step two. A phase correlation algorithm is used to calculate the horizontal and vertical phase offsets. The horizontal phase offset refers to the horizontal misalignment (pixels) of the preprocessed online fabric image of the current frame relative to the desired pattern structure image, and the vertical phase offset refers to the vertical misalignment (pixels) of the preprocessed online fabric image of the current frame relative to the desired pattern structure image. It should be noted that, to ensure matching accuracy, the phase search range is preferably limited to within half the size of a jacquard repeating unit to avoid cross-period mismatches. Simultaneously, by comparing the coil period extracted from the preprocessed online fabric image of the current frame with the theoretical period in the desired pattern structure image, horizontal and vertical scale corrections are calculated. The horizontal scale correction refers to the ratio of the actual horizontal period of the preprocessed online fabric image of the current frame to the theoretical horizontal period in the desired pattern structure image, and the vertical scale correction refers to the ratio of the actual vertical period of the preprocessed online fabric image of the current frame to the theoretical vertical period in the desired pattern structure image.
[0100] The current image is translated based on the horizontal and vertical phase offsets, scaled based on the horizontal and vertical scale corrections, and rotated based on the deflection angle of the main texture direction. It should be noted that the deflection angle can be obtained by comparing the main texture direction of the current frame preprocessed fabric image with the main texture direction of the desired structure image. The deflection angle is the result of calculating the difference between the current image's main texture direction and the desired structure image's main texture direction.
[0101] After geometric transformation correction, affine transformation is performed through bilinear interpolation to achieve pixel-level precise alignment between the online image and the desired pattern structure image, resulting in a aligned image.
[0102] It should be noted that the fabric may shift and deform in the position of the pattern in the image relative to the ideal state due to tension fluctuations, mechanical vibrations, etc. Step 3 aims to eliminate these interferences and make the online image and the desired pattern structure diagram accurately aligned in space, so as to provide a misaligned and distortion-free alignment image for subsequent defect residual generation.
[0103] Step 4: Compare the alignment image with the desired pattern structure image to obtain a structural residual image; perform high-risk anomaly region screening on the structural residual image to obtain a defect residual image;
[0104] Furthermore, the alignment image is compared with the desired pattern structure image to obtain a structural residual image; high-risk anomaly regions are screened from the structural residual image to obtain a defect residual image, including:
[0105] Based on the alignment image and the desired pattern structure map, a spatially corresponding region is established. Gradient consistency comparison, texture distribution comparison and grayscale distribution comparison are performed on the spatially corresponding region to generate structural difference information.
[0106] Based on the structural difference information, a structural residual image is generated, and the tissue prior information in the desired pattern structure image is called to perform pattern boundary suppression and periodic background suppression on the structural residual image to obtain the suppressed residual information.
[0107] The suppressed residual information is binarized and connected component analysis is performed to extract candidate abnormal regions that meet the physical scale of the defects;
[0108] Based on the candidate anomaly regions, a defect scoring model is constructed and defect score values are calculated to screen high-risk anomaly regions.
[0109] Based on the structural residual image and the high-risk anomaly region, a defect residual map constrained by organizational priors is generated.
[0110] In one specific embodiment, based on the desired pattern structure diagram, corresponding local areas with completely consistent positions and sizes are selected in the alignment image to ensure a unified comparison benchmark and avoid false differences introduced by positional offsets.
[0111] The lateral gradients of the reference region and the region to be compared are calculated using the Sobel operator. With longitudinal gradient Through formula Calculate gradient direction angle The angle distribution between the gradient directions of the two regions is statistically analyzed using the formula. Consistency of gradient direction calculation Where N is the number of pixels in the unit. The gradient direction angle of the i-th pixel in the reference unit. The gradient direction angle of the i-th pixel of the unit to be compared is smaller; the smaller the angle difference, the higher the structural consistency.
[0112] Extract the Histogram of Oriented Gradients (HOG) features from the two regions to obtain the texture histogram, and then apply the cosine similarity algorithm. Calculate texture histogram similarity, where, This represents the texture histogram vector of the corresponding image region. Let the texture histogram vector of the desired pattern structure region be denoted as . The L2 norm of the vectors indicates that the higher the similarity, the more consistent the texture structure.
[0113] Calculate the mean gray level of the two regions. and variance Through formula Calculate the consistency of grayscale distribution ;
[0114] Based on gradient direction consistency, texture histogram similarity, and gray-level distribution consistency, structural difference scores are calculated unit by unit. These scores are then mapped to pixel values to generate structural residual images. Larger residual values indicate a greater deviation between the region and the desired texture structure. The formula for calculating the structural difference score is as follows: ;
[0115] The prior information of the structure from the desired pattern structure image is used to perform targeted background suppression on the structural residual image, filtering out pseudo residuals generated by normal jacquard patterns and retaining only abnormal responses related to real defects. Specifically, the color yarn mask and color block boundary coordinates in the desired pattern structure image are used to locate the boundary areas of different color yarns and different structure units in the jacquard pattern. The structural residuals within ±2 pixels of the color block boundary are weighted and weakened, with the weakening weight set to 0.2, to eliminate pseudo residuals caused by small alignment deviations and abrupt gradient changes at the color yarn boundaries. Based on the coil period information extracted in step three, the structural residual image is subjected to frequency domain bandpass filtering to filter out periodic residual signals that are completely consistent with the coil period and texture period, retaining non-periodic and irregular abnormal residual signals, and eliminating interference residuals caused by coil relief shadows, yarn reflections, and normal needle loop undulations.
[0116] Binarization and connected component analysis are performed on the structural residual information after background suppression to extract candidate anomalous regions that meet the physical scale of defects. The suppressed structural residual image is normalized to the gray range of 0-255, and a residual threshold is set. The normalized residual image is then binarized. Pixels with residuals greater than or equal to the preset residual threshold are marked as suspected anomalous points, while pixels with residuals less than the preset residual threshold are marked as background. Connected component labeling is performed on the binarized image, and all connected regions are extracted. Connected regions with an area greater than or equal to 3×3 pixels are selected as candidate anomalous regions. Isolated noise with too small an area, such as single-pixel noise, is removed, and only candidate regions with physical defect morphology are retained.
[0117] Constructing a defect scoring model ,in, This indicates the defect score. For the structural residual term, the normalized mean of the structural residuals within the candidate anomaly region is taken and mapped to... The larger the value in the interval, the more significant the structural deviation. The phase anomaly term reflects local phase inconsistencies. It takes the degree of local phase deviation within the candidate anomaly region and normalizes it to... interval; For time-series continuous terms, The weighting coefficients are calibrated using a small validation set and are set with the objective of minimizing the joint false positive rate and false negative rate. In a specific embodiment, ;
[0118] The defect score is calculated for each candidate abnormal region according to the defect scoring model. A defect score threshold is preset. When the defect score of a candidate abnormal region is greater than or equal to the preset defect score threshold, it is judged as a high-risk abnormal region. When the defect score of a candidate abnormal region is less than the preset defect score threshold, it is judged as a low-risk or normal interference region and is removed.
[0119] Using the structural residual map as the base map, the locations and scores of all high-risk abnormal areas are fused and mapped. In the structural residual map, only the defect responses that are inconsistent with the prior structure are retained, and the interference responses generated by normal jacquard patterns, yarn boundaries, and coil textures are completely suppressed to generate the final organizational prior constraint residual map. It should be noted that this map highlights real defects and weakens the interference of normal patterns, and can be directly used for subsequent multi-frame timing verification.
[0120] It should be further explained that after accurate alignment is completed, the actual captured image is compared with the expected pattern. Prior knowledge of the organization is used to distinguish between normal pattern variations and real anomalies, and a residual map that can highlight potential defects is generated.
[0121] Step 5: Perform continuous frame tracking and timing verification on the defect residual map to eliminate false defects caused by instantaneous interference and obtain the final defect judgment result;
[0122] Furthermore, the step of performing continuous frame tracking and timing verification on the defect residual map to eliminate false defects caused by transient interference and obtain the final defect judgment result includes:
[0123] For high-risk abnormal regions in the defect residual map of multiple consecutive frames, position tracking and shape tracking are performed by target tracking algorithm to establish the temporal trajectory of each high-risk abnormal region on the time axis;
[0124] Based on the temporal trajectory, the stability index of each high-risk anomaly region in consecutive frames is calculated. The stability index includes the number of continuous frames, area fluctuation rate and grayscale stability, to obtain the temporal consistency result.
[0125] By integrating the temporal consistency results with the defect score, false defects caused by transient interference are eliminated, and the final defect judgment result is obtained.
[0126] In one specific embodiment, multiple consecutive frames (3-5 frames) of defect residual images are selected, and the high-risk abnormal regions identified in step four are time-series tracked. The position of the high-risk abnormal regions in subsequent frames is predicted by the Kalman filter algorithm, and the coordinates, area and grayscale information are recorded frame by frame.
[0127] Based on the temporal trajectory, the number of consecutive frames, area volatility, and grayscale stability of high-risk anomaly regions are calculated and compared with preset thresholds to obtain temporal consistency results. The number of consecutive frames refers to the number of frames in which the high-risk anomaly region is successfully matched in consecutive frames; the area volatility is calculated using the following formula: , These represent the maximum, minimum, and average areas of high-risk anomaly regions across multiple continuously tracked image frames; the grayscale stability calculation formula is: , These represent the standard deviation and mean value of the average residual gray value in high-risk anomaly regions across multiple continuously tracked images. The standard deviation of the average residual gray value measures the dispersion (fluctuation range) of the gray value.
[0128] A region that meets the following conditions is considered a time-consistent region: the number of consecutive frames is greater than or equal to a preset frame number threshold, such as 2 frames; the area fluctuation rate is less than or equal to a preset area fluctuation rate threshold, such as 0.3; and the grayscale stability is greater than or equal to a preset grayscale stability threshold, such as 0.7. A region that does not meet any of these conditions is considered a time-inconsistent region (pseudo-defect).
[0129] The temporal consistency result is merged with the defect score obtained in step four to update the defect confidence. If it is a temporally consistent region, the original defect score is multiplied by the temporal gain coefficient. Preferred To increase confidence, the updated defect score is obtained. If the region is inconsistent in time sequence, it is directly marked as a false defect and removed.
[0130] If the updated defect score is greater than or equal to the preset defect score, it is determined to be a real defect; otherwise, it is determined to be a low-risk interference area and is removed. All real defect areas are summarized to generate a final defect judgment result that includes location, area, and confidence level.
[0131] It should be noted that the abnormal candidate regions in a single frame image may be false defects caused by accidental factors such as instantaneous noise, optical noise flicker, or mechanical jitter. Step five utilizes the characteristics of continuous fabric movement and uses multi-frame temporal analysis to eliminate these interferences, thereby improving the reliability of detection.
[0132] Step 6: Based on the final defect determination result, classify the defect types to obtain the defect classification result.
[0133] Furthermore, the step of classifying defects based on the final defect determination result to obtain defect classification results specifically includes:
[0134] Based on the final defect judgment result, the defect location, area, length, direction and confidence level are output to obtain the defect detection result;
[0135] Based on the defect detection results, combined with structural residual features, temporal continuity features, and pattern prior deviation types, a lightweight classifier is used to classify the defects, resulting in defect classification results.
[0136] In one specific embodiment, the location coordinates, physical area, length, orientation, and confidence score of each real defect are extracted and mapped to the original fabric coordinate system. The confidence score refers to the updated defect score value after time-series verification. Defect marker boxes are superimposed on the original online fabric image, and different colors are used to distinguish the confidence level to intuitively display the defect distribution. An inspection report containing batch information, total number of defects, proportion of each type, maximum defect size, and average confidence score is output and synchronously stored in the production database for quality traceability and process analysis.
[0137] By combining structural residual features, temporal persistence features, and pattern prior deviation types, a lightweight classifier (such as a decision tree or a few-sample CNN) is used to classify defects, and the defect classification results are obtained. The defect classification results include at least one of the following: missed stitches, floating threads, broken yarns, wrong patterns, and misaligned colored yarns.
[0138] Subsequently, the confirmed normal sample segments (defect-free areas) are updated as background statistical references to correct subsequent gradient thresholds and grayscale distribution benchmarks, making the system clearer about "what is normal texture," thereby filtering out false residuals (false alarms) caused by normal jacquard patterns, yarn boundaries, and loop undulations, reducing the false alarm rate. The confirmed defect sample segments are stored in the difficult case sample library for subsequent optimization of defect scoring model weights and classifier features, improving the ability to identify complex and rare defects. When switching to a new pattern, the expected pattern structure diagram and vertical and horizontal scaling parameters are automatically updated based on the new jacquard organization file and the first standard sample fabric, without the need to retrain the entire process model, improving cross-pattern adaptability.
[0139] Please see Figure 2 As shown, compared with existing technologies, this invention exhibits superior performance in defect identification, adaptability to dynamic production interference, resistance to transient interference, false defect removal, and cross-process and cross-pattern adaptability. Specifically, this invention effectively filters out pattern interference and accurately identifies minute defects such as missed needles, broken yarns, and misaligned patterns by introducing prior structural data to construct the desired pattern structure map and combining multi-dimensional comparison with prior constraints. Through coil phase correction and periodic alignment, sub-pixel-level image alignment is achieved, overcoming dynamic interference such as tension fluctuations and mechanical vibrations, ensuring detection stability under high-speed production. Furthermore, it utilizes multi-frame timing... The tracking and stability index verification eliminates false defects caused by accidental factors such as light noise and jitter, reducing false alarms per frame. Driven by jacquard organization files, when switching patterns, only the new organization file needs to be parsed and the standard sample fabric calibrated to automatically reconstruct the desired pattern structure diagram and alignment parameters, without the need to retrain the deep learning model or adjust a large number of detection thresholds. At the same time, by updating the confirmed normal sample segments as background statistical references and storing the confirmed defect sample segments in the difficult sample library, online adaptive optimization of detection parameters is achieved, which significantly reduces the deployment cost and maintenance difficulty in small-batch, multi-variety production scenarios.
[0140] The above description is merely an example and illustration of the structure of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the structure of the invention or exceed the scope defined in the claims, all of which should fall within the protection scope of the present invention.
Claims
1. A method for detecting defects in jacquard knitted fabrics, characterized in that, include: Acquire prior data of jacquard structure, which includes theoretical pattern prior data and real-time detection input data; Construct the desired pattern structure diagram based on the theoretical pattern prior data; The real-time detection input data is subjected to coil phase correction and period alignment to obtain an alignment image; The alignment image is compared with the desired pattern structure image to obtain the structural residual image; High-risk anomaly regions are screened from the structural residual image to obtain a defect residual map; The defect residual map is subjected to continuous frame tracking and timing verification to eliminate false defects caused by instantaneous interference, and the final defect judgment result is obtained. Based on the final defect determination result, the defect type is classified to obtain the defect classification result.
2. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The steps for obtaining prior data on jacquard tissue include: Obtain the jacquard structure file, pattern design drawing, yarn color matching table, machine size parameters and needle pitch parameters corresponding to the jacquard knitted fabric to be tested, and obtain the theoretical pattern prior data; Collect online fabric image sequences and device encoder pulses and fabric roll data to obtain real-time detection input data; Based on the equipment encoder pulses and fabric roll data, the theoretical pattern prior data is spatially aligned with the real-time detection input data according to the production travel length to obtain the jacquard structure prior data.
3. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for constructing the desired pattern structure diagram based on the theoretical pattern prior data include: Based on the arrangement relationship of each organizational unit, the distribution relationship of colored yarns, and the repetition period relationship in the jacquard structure file, a theoretical pattern topology diagram is obtained; Collect images of a standard sample fabric without defects using the same process, and calibrate the basic magnification ratio; the basic magnification ratio is the number of image pixels corresponding to a unit physical length, which is calculated by the pixel distance of feature points with known physical distances on the standard sample fabric. Based on the basic magnification, the fabric design width and design height, the target pixel size of the theoretical pattern topology map is calculated, and bilinear interpolation is used to scale the theoretical pattern topology map to the target size to generate the initial expected pattern structure map. Based on batch shrinkage differences, images of the first roll of standard fabric were collected, the actual width and actual height were measured, and the horizontal and vertical scaling factors were calculated. Based on the horizontal scaling factor and the vertical scaling factor, the initial desired pattern structure diagram is subjected to an affine scaling transformation to obtain the desired pattern structure diagram.
4. The method for detecting defects in jacquard knitted fabrics according to claim 3, characterized in that, The specific steps for obtaining the theoretical pattern topology diagram based on the arrangement relationship, yarn distribution relationship, and repetition period relationship of each weave unit in the jacquard weave file include: The jacquard weave file is parsed to extract the needle position weave status data column by column and row by row to obtain the original weave data matrix with the columns as rows and the columns as columns. Each element in the matrix records the weave type of the corresponding needle position in the corresponding column. The weave type includes one or more of the following: loop, tufted loop, floating thread, and shifted loop. Read the yarn color matching table, establish the corresponding mapping relationship between color number, yarn feeder number and needle position, match the mapping relationship position by position to the original structure data matrix, generate a structure matrix with color yarn allocation information, so that each element in the matrix contains both structure type and corresponding color number information; Autocorrelation is performed on the organization matrix with colored yarn allocation information along the horizontal longitudinal direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the horizontal direction; autocorrelation is also performed along the vertical column direction to extract the peak position of the correlation coefficient and determine the minimum repeating period in the vertical direction. The area defined by the minimum repeating period in the horizontal direction and the minimum repeating period in the vertical direction is marked as the minimum jacquard cycle unit. Based on the smallest jacquard cycle unit, the relative positional relationship of each weaving point within the unit, the connection relationship of adjacent weaving points, and the continuity and boundary relationship of colored yarn distribution are extracted. Data of ground line and padding yarn that do not participate in the pattern formation are removed, while retaining the effective jacquard structure and colored yarn topology information. Record the relative column and column numbers of all weaving points within the smallest jacquard repeat unit in relative coordinate form, establish the adjacency topology of weaving points, and obtain the theoretical pattern topology diagram.
5. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for performing coil phase correction and periodic alignment on the real-time detection input data to obtain the alignment image include: Preprocess the online fabric image of the current frame to obtain the preprocessed online fabric image of the current frame; Based on the structural tensor algorithm, the main texture direction of the preprocessed online fabric image in the current frame is extracted; Based on frequency domain analysis, the coil period information of the preprocessed online fabric image of the current frame is extracted; The main texture direction and periodic information of the preprocessed online fabric image of the current frame are matched with the desired pattern structure diagram to obtain the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction and deflection angle. Based on the horizontal phase offset, vertical phase offset, horizontal scale correction, vertical scale correction, and deflection angle, the current frame preprocessed online fabric image is geometrically transformed to obtain an alignment image that is precisely aligned with the desired pattern structure diagram.
6. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for comparing the alignment image with the desired pattern structure image to obtain the structural residual image include: Based on the alignment image and the desired pattern structure map, a spatially corresponding region is established. Gradient consistency comparison, texture distribution comparison and grayscale distribution comparison are performed on the spatially corresponding region to generate structural difference information. A structural residual image is generated based on the structural difference information.
7. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for filtering high-risk anomaly regions from the structural residual image to obtain a defect residual image include: The prior information of the organization in the desired pattern structure image is called to perform pattern boundary suppression and periodic background suppression on the structural residual image to obtain the suppressed residual information; The suppressed residual information is binarized and connected component analysis is performed to extract candidate abnormal regions that meet the physical scale of the defects; Based on the candidate anomaly regions, a defect scoring model is constructed and defect score values are calculated to screen high-risk anomaly regions. Based on the structural residual image and the high-risk anomaly region, a defect residual map constrained by organizational priors is generated.
8. The method for detecting defects in jacquard knitted fabrics according to claim 7, characterized in that, The specific steps for constructing a defect scoring model based on the candidate anomaly regions and calculating defect score values to screen high-risk anomaly regions include: Constructing a defect scoring model ,in, This indicates the defect score. For structural residuals, For phase anomaly terms, For time-series continuous terms, These are weighting coefficients; The defect score is calculated for each candidate abnormal region according to the defect scoring model. A defect score threshold is preset. When the defect score of a candidate abnormal region is greater than or equal to the preset defect score threshold, it is judged as a high-risk abnormal region. When the defect score of a candidate abnormal region is less than the preset defect score threshold, it is judged as a low-risk or normal interference region and is removed. This process identifies high-risk anomaly areas.
9. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for performing continuous frame tracking and temporal verification on the defect residual map, eliminating false defects caused by transient interference, and obtaining the final defect judgment result include: For high-risk abnormal regions in the defect residual map of multiple consecutive frames, position tracking and shape tracking are performed by target tracking algorithm to establish the temporal trajectory of each high-risk abnormal region on the time axis; Based on the temporal trajectory, the stability index of each high-risk anomaly region in consecutive frames is calculated. The stability index includes the number of continuous frames, area fluctuation rate and grayscale stability, to obtain the temporal consistency result. By integrating the temporal consistency results with the defect score, false defects caused by transient interference are eliminated, and the final defect judgment result is obtained.
10. The method for detecting defects in jacquard knitted fabrics according to claim 1, characterized in that, The specific steps for classifying defects based on the final defect determination result to obtain the defect classification result include: Based on the final defect judgment result, the defect location, area, length, direction and confidence level are output to obtain the defect detection result; Based on the defect detection results, combined with structural residual features, temporal continuity features, and pattern prior deviation types, a lightweight classifier is used to classify the defects, resulting in defect classification results.