A Visual Inspection Method and Intelligent Quality Inspection System for Defects in Apparel Fabrics Based on Industrial Vision
By constructing a fabric texture topology mesh and an adaptive sensitivity mask, combined with deformation feedback closed-loop control, the accuracy and reliability issues of fabric defect detection in dynamic production line environments were solved, achieving a detection effect with high detection rate and low false alarm rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU DUSHANG GARMENT CO LTD
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-02
AI Technical Summary
Existing visual inspection technologies struggle to balance high detection rates and low false alarm rates in complex, dynamic production line environments. In particular, when fabrics are subjected to longitudinal stretching or loosening compression, texture feature drift leads to decreased detection accuracy and reliability, and longitudinal image distortion affects the positioning accuracy of texture features.
By extracting fabric texture skeleton features to construct a real-time texture topology mesh, generating a microscopic deformation vector field, dynamically constructing an adaptive sensitivity mask, and combining deformation feedback closed-loop control to adjust the acquisition frequency of the imaging device, accurate detection of the fabric is achieved.
This improved the accuracy and environmental adaptability of the detection system under complex working conditions, reduced false defect signals and missed detection rate, and ensured efficient identification of fabric defects.
Smart Images

Figure CN122134703A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of automation and machine vision inspection technology in the textile industry, and particularly to a visual inspection method for defects in clothing fabrics based on industrial vision and its intelligent quality inspection system. Background Technology
[0002] In the modern textile printing, dyeing, and garment processing industry, surface quality inspection of fabrics is a crucial step in controlling the quality of finished products. With the development of intelligent manufacturing technology, automated optical inspection equipment using industrial cameras and image processing algorithms has gradually replaced traditional manual visual inspection of fabrics, becoming an important component of production lines. These devices typically acquire surface images during high-speed fabric transport and detect common defects such as holes, oil stains, and skipped stitches by identifying texture anomalies, playing a positive role in improving inspection efficiency and reducing labor costs.
[0003] However, clothing fabrics, as typical flexible porous materials, possess anisotropic and easily deformable physical properties. In actual industrial production environments, fabrics are typically continuously transported under the traction of guide rollers, making them highly susceptible to non-rigid physical deformation due to fluctuations in mechanical tension, roller vibration, and their own gravity. Existing visual inspection technologies are mostly based on static image texture features, often employing globally fixed detection thresholds or general deep learning models. When the fabric is subjected to longitudinal stretching, the gaps between warp and weft yarns are physically enlarged, leading to increased local light transmittance. This visually resembles tiny holes, easily causing false alarms in the algorithm. Conversely, when the fabric is in a relaxed, compressed state, the dense texture can easily mask minute cracks or loose threads, resulting in missed detections. This texture feature drift caused by physical deformation makes it difficult for existing detection methods to achieve both high detection rates and low false alarm rates in complex, dynamic production line environments.
[0004] Furthermore, traditional line scan imaging systems typically rely on a rotary encoder connected to the conveyor shaft for passive triggering. Due to the potential for minute slippage between the fabric and the guide rollers, and the inherent elasticity of the fabric, relying solely on encoder pulses cannot accurately match the actual physical distance the fabric has moved. This results in geometric distortion in the acquired digital image on the vertical scale, causing the texture in the image to deviate from the actual physical shape, further impacting the positioning accuracy and feature extraction reliability of texture-based detection algorithms. Summary of the Invention
[0005] One of the objectives of this invention is to provide a visual inspection method for defects in clothing fabrics based on industrial vision and its intelligent quality inspection system, so as to solve the problems pointed out in the background art.
[0006] In a first aspect, the present invention provides a method for visually detecting defects in clothing fabrics based on industrial vision, the method comprising the following steps: Real-time sequential images of the garment fabric to be inspected are acquired using industrial imaging equipment, and the real-time sequential images are preprocessed to obtain the target frame image. Extract the texture skeleton features from the target frame image, and construct a real-time texture topology mesh that reflects the current physical state of the fabric based on the texture skeleton features; The real-time texture topology mesh is mapped and compared with the preset reference tension-free topology mesh, and the displacement deviation of all nodes is calculated to generate the micro-deformation vector field of the fabric surface. Based on the distribution of each vector magnitude in the micro-deformation vector field, an adaptive sensitivity mask corresponding one-to-one with the pixel coordinates of the target frame image is dynamically constructed. The target frame image is input into a preset visual detection model to extract an initial defect probability map; The initial defect probability map is weighted and corrected using the adaptive sensitivity mask to obtain the final defect judgment result, and a quality inspection control signal is output based on the final defect judgment result.
[0007] Optionally, the step of extracting texture skeleton features from the target frame image specifically includes: The target frame image is convolved using a multi-scale Gaussian difference operator to obtain candidate regions for texture corner points. Calculate the principal curvature ratio of the candidate texture corner regions, eliminate edge response points, and determine stable texture nodes; The neighborhood direction of the texture node is analyzed using the local binary mode algorithm, and adjacent texture nodes are connected to generate the real-time texture topology mesh.
[0008] Optionally, the step of preprocessing the real-time sequence images to obtain the target frame image specifically includes: The real-time sequence images are spatially denoised using an adaptive Wiener filter to remove random photoelectric noise. The local contrast of the image is enhanced by limiting the contrast adaptive histogram equalization algorithm, thus separating the texture foreground from the background; The enhanced image is then subjected to grayscale normalization processing to output the target frame image.
[0009] Optionally, the step of dynamically constructing an adaptive sensitivity mask that corresponds one-to-one with the pixel coordinates of the target frame image includes: Set a baseline sensitivity value; When the local vector magnitude in the micro-deformation vector field indicates that the fabric is in a stretched state, the weight value of that region in the adaptive sensitivity mask is nonlinearly reduced according to the degree of stretching in order to suppress false defect signals caused by the increase of texture gaps. When the local vector magnitude in the micro-deformation vector field indicates that the fabric is under compression, the weight value of that region in the adaptive sensitivity mask is nonlinearly increased according to the degree of compression to enhance the detection capability of small closed defects.
[0010] Optionally, the step of weighting and correcting the initial defect probability map using the adaptive sensitivity mask specifically includes: Extract the original confidence values of each pixel in the initial defect probability map; Obtain the weight adjustment coefficients of the corresponding coordinate points in the adaptive sensitivity mask; The original confidence score value and the weight adjustment coefficient are performed point-to-point to obtain the corrected confidence score value. Determine whether the corrected confidence value exceeds a preset alarm threshold. If it does, then the pixel is determined to be a real defect.
[0011] Optionally, the method for obtaining the reference tension-free topology mesh includes: During the equipment calibration phase, static images of the standard sample fabric are collected when it is stationary and without external traction. The static image is divided into grids and labeled with nodes to establish a grid data model in a standard coordinate system; The grid data model is stored in the system database as a benchmark for subsequent detection and comparison.
[0012] Optionally, the method further includes a closed-loop control step based on deformation feedback: Calculate the global average deformation modulus of the microscopic deformation vector field; If the global average deformation modulus exceeds a preset safety threshold for multiple consecutive frames, a synchronization adjustment signal is generated. The synchronization adjustment signal is sent to the controller of the industrial imaging equipment to adjust the trigger frequency of image acquisition to match the current motion state of the fabric, thereby suppressing longitudinal distortion at the acquisition source.
[0013] Optionally, the final defect determination result includes the defect type, area, and physical location coordinates; For different types of defects, the adaptive sensitivity mask uses different weighting mapping functions; for structural defects, the weights change negatively with the stretching degree; for surface discoloration defects, the weights remain constant.
[0014] Optionally, the method further includes a model self-learning step: Image regions that are identified as false defects after being corrected by the adaptive sensitivity mask are selected as negative samples. The negative samples are used periodically to fine-tune the parameters of the visual detection model and update the weight parameters inside the model to improve the model's intrinsic robustness to texture deformation.
[0015] Secondly, the present invention provides an intelligent quality inspection system for visual detection of defects in clothing fabrics based on industrial vision, the system comprising: The image acquisition module is used to acquire real-time sequential images of the garment fabric to be inspected using an industrial camera; The processor is connected to the image acquisition module; A memory storing a computer program that, when executed by the processor, implements the method steps as described in any one of the first aspects; An actuator is used to physically mark or stop the machine on fabric areas with defects in response to a quality control signal output by the processor.
[0016] The present invention has achieved the following beneficial effects: This invention introduces the physical deformation analysis of textile materials into the visual inspection process by extracting fabric texture skeleton features and constructing a real-time texture topology mesh, enabling the quantification of the microscopic stretching or compression degree of the fabric during transmission. The system dynamically constructs a pixel-level adaptive sensitivity mask using the generated microscopic deformation vector field, achieving spatially differentiated adjustment of detection weights. In fabric stretching areas, reducing weights suppresses false defect signals caused by increased texture gaps, while increasing weights in fabric compression areas enhances the detection capability of hidden defects.
[0017] Meanwhile, this invention constructs a hardware closed-loop control mechanism based on deformation feedback, which can adjust the acquisition frequency of the imaging device in real time according to the global deformation modulus, thus offsetting the longitudinal distortion of the image caused by speed mismatch from the signal source. Furthermore, combined with differentiated weight mapping for different defect categories and a model self-learning strategy, this invention effectively improves the accuracy and environmental adaptability of the detection system for flexible fabric quality inspection under complex working conditions.
[0018] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0019] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic diagram of a visual detection method for clothing fabric defects based on industrial vision, as described in an embodiment of the present invention. Figure 2 This is a schematic diagram of a visual inspection system for clothing fabric defects based on industrial vision, as described in an embodiment of the present invention. Detailed Implementation
[0021] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0022] This invention provides an intelligent quality inspection system for visual detection of defects in clothing fabrics based on industrial vision. This system serves as the physical carrier for executing the detection method described in this invention. In actual textile printing and dyeing or garment processing production lines, fabrics are typically transported at high speeds of 60 to 120 meters per minute, and the fabrics themselves possess physical characteristics such as flexibility, easy deformation, complex texture, and large width span (typically 160 cm to 320 cm). To achieve defect detection under these complex conditions, this embodiment constructs a hardware architecture with high-throughput data acquisition and real-time edge computing capabilities.
[0023] like Figure 1 As shown, the intelligent quality inspection system includes an image acquisition module, a processor, a memory, and an actuator. These modules work collaboratively via an industrial-grade high-speed bus to form a closed-loop control system.
[0024] Specifically, the image acquisition module is configured to acquire real-time sequential images of the garment fabric to be inspected using industrial cameras. Considering that area scan cameras are prone to perspective distortion and have limited frame rates when shooting large-format moving objects, this embodiment preferably uses multiple sets of high-resolution color line scan industrial cameras as the main acquisition devices. For example, four 8K pixel line scan CCD cameras can be mounted side by side on a precision gantry along the width of the fabric, with adjacent cameras maintaining a 5% to 10% overlap in their fields of view to facilitate subsequent image stitching. The cameras are connected to the back-end processor via high-speed data interfaces such as CoaXpress or CameraLink, and can output uncompressed RAW format image data in real time at a line frequency of 40kHz to 80kHz. To eliminate imaging blur caused by fabric jitter, each camera is equipped with a bi-telecentric lens, which has extremely high depth of field and constant magnification, ensuring that even if the fabric experiences slight vertical jitter (Z-axis displacement) during transmission, its projected size on the imaging target remains stable, thus guaranteeing that the subsequently constructed texture topology mesh has geometrical significance.
[0025] The lighting subsystem, integrated with the image acquisition module, employs a composite light source design, including a high-angle linear focusing LED light source and a low-angle dark-field grazing LED light source mounted above the fabric, as well as a backlighting transmissive LED light source mounted below the fabric. The high-angle light source is used to acquire color and pattern information from the fabric surface; the dark-field grazing LED light source utilizes the shadow effect to specifically highlight three-dimensional defects on the fabric surface such as pilling, knots, and snags; the backlighting transmissive light source penetrates the fabric to enhance the contrast of translucent defects such as blemishes, holes, and pinholes. The image acquisition module is also connected to a high-precision rotary encoder mounted on the conveyor belt's drive shaft. The encoder's AB-phase quadrature pulse signals are directly connected to the camera's external trigger interface. Through this hardware-level synchronization mechanism, the camera's line scanning is controlled by the actual movement distance of the fabric (e.g., triggering an exposure every 0.1mm of movement), thereby effectively suppressing longitudinal stretching or compression distortion of the image caused by fluctuations in production line speed.
[0026] The processor is connected to the image acquisition module. Considering that the method of the present invention involves real-time preprocessing of massive pixels, complex topological mesh construction, and concurrent inference of deep neural networks, a single general-purpose central processing unit (CPU) is difficult to meet the real-time requirements. Therefore, the processor in this embodiment adopts a heterogeneous computing architecture combining CPU, GPU, and FPGA. Among them, the field-programmable gate array (FPGA) serves as the front-end processing unit, directly receiving the high-speed data stream from the camera and using its pipelined parallel processing advantages to complete image flat field correction (FFC), white balance correction, and Bayer format conversion; the high-performance graphics processing unit (GPU) serves as the core computing unit, responsible for performing high computational density tasks such as texture feature extraction, topological mesh mapping, and deep learning model inference; the CPU of the industrial control computer is responsible for overall task scheduling, logic control, and communication with external production line PLCs.
[0027] The memory stores a computer program, which, when executed by the processor, implements the steps of the visual inspection method described in any one of these applications. Furthermore, the memory includes a high-speed circular buffer to temporarily store image data during network fluctuations or computational peaks, preventing frame loss. The actuator, in response to the quality control signal output by the processor, performs physical marking or a shutdown operation on defective fabric areas. The actuator includes, but is not limited to, a high-speed inkjet marking machine, a labeling machine, an audible and visual alarm, and a production line shutdown relay interface.
[0028] Based on the aforementioned precisely constructed hardware platform, this embodiment of the invention provides a method for visual detection of defects in clothing fabrics based on industrial vision. For example... Figure 1 As shown, the method specifically includes the following steps: Step S11: Acquire real-time sequence images of the garment fabric to be inspected using industrial imaging equipment, and preprocess the real-time sequence images to obtain target frame images.
[0029] Despite the anti-interference design at the hardware level, the raw real-time sequence images inevitably contain random noise under the complex industrial electromagnetic environment and mechanical vibration, and the contrast of the micro-texture on the fabric surface is often insufficient. In order to provide a clean data source for subsequent precise topology analysis, in-depth signal conditioning is necessary.
[0030] Specifically, the step of preprocessing the real-time sequence images to obtain the target frame image includes the following sub-steps: An adaptive Wiener filter is used to perform spatial domain noise reduction on the real-time image sequence, removing random photoelectric noise. Unlike traditional mean filtering or Gaussian filtering, which can easily lead to image blurring, the adaptive Wiener filter is an optimal estimation filter based on statistical properties. The processor slides a window of a preset size (e.g., ...) across the image. (pixels), calculates the local mean within the window in real time. and local variance The algorithm's logic lies in: when the local variance... A larger local variance indicates that the region contains significant edge or texture details. The filter will automatically reduce the smoothing intensity, preserving the original pixel values and thus avoiding the removal of subtle yarn breakage features. When the value is small, it indicates that the area has a flat background, and the filter will automatically increase the smoothing intensity to filter out shot noise introduced by the sensor. Through this adaptive mechanism, it is possible to effectively preserve the physical skeleton information of the fabric's warp and weft yarns while significantly reducing noise.
[0031] The Limiting Contrast Adaptive Histogram Equalization (CLAHE) algorithm enhances the local contrast of an image, separating textured foreground from background. Due to the microscopic undulations on the fabric surface, alternating bright and dark textures appear under sidelighting, and large-format images often suffer from uneven lighting. The CLAHE algorithm divides the image into several non-overlapping sub-blocks (e.g., (Grid). Within each sub-block, a grayscale histogram is calculated independently, and a clipping threshold is introduced. For portions of the histogram whose frequency exceeds this threshold, they are clipped and evenly distributed to other grayscale levels, thus limiting the maximum amplification of local contrast and preventing excessive enhancement of background noise. Finally, bilinear interpolation is used to smoothly stitch together the equalization results of each sub-block, eliminating blockiness. After CLAHE processing, the contrast between the fabric yarns (foreground) and the yarn gaps (background) is significantly stretched, and subtle imperfections that were originally in the darker areas (such as light-colored oil stains or minor snags) can be clearly detected.
[0032] The enhanced image is then subjected to grayscale normalization processing, and the target frame image is output. To unify the input distribution of subsequent algorithm models and eliminate absolute grayscale differences caused by light source brightness attenuation or variations in fabric color, the processor maps the image data to a standard grayscale normalization model. floating-point range or Integer range. This standardization ensures that the detection algorithm has a consistent response benchmark when processing black and white fabrics.
[0033] Step S12: Extract the texture skeleton features from the target frame image, and construct a real-time texture topology mesh that reflects the current physical state of the fabric based on the texture skeleton features.
[0034] Traditional machine vision methods typically treat images as unstructured pixel matrices, while this invention, from the perspective of textile materials science, views fabric as a physical topological structure composed of interwoven warp and weft yarns. When the fabric undergoes stretching, compression, or shear deformation, the relative positions of its warp and weft interlacing points (nodes) change in accordance with the laws of continuous medium mechanics. By capturing these changes, the current physical state of the fabric can be determined.
[0035] Specifically, the step of extracting texture skeleton features from the target frame image includes: A multi-scale Difference of Gaussian (DoG) operator is used to perform convolution operations on the target frame image to obtain candidate regions for texture corner points. The warp and weft interlacing points of the fabric appear as a speckled structure in the microscopic image. Considering the different yarn counts of different fabrics (e.g., coarse canvas versus fine silk), single-scale detection operators are prone to missing detections. The DoG operator constructs a Gaussian pyramid and utilizes different standard deviations... The Gaussian kernel is used to convolve and subtract images, simulating the characteristics of a bandpass filter and exhibiting excellent scale invariance. In the preferred parameter settings of this embodiment, to balance texture capture sensitivity and noise suppression capability, the standard deviation of the first-scale Gaussian kernel is set to [value missing]. The standard deviation of the second-scale Gaussian kernel is The processor searches for extreme points in the DoG scale space; the locations of these extreme points represent potential yarn weaving centers.
[0036] The principal curvature ratio of the candidate texture corner points is calculated to eliminate edge response points and determine stable texture nodes. While the DoG operator is sensitive to blobs, it also tends to produce strong responses to long edges (such as fabric edges or creases). To eliminate these pseudo-nodes, the processor calculates the Hessian matrix at each candidate point, which is defined as... ,in , and The target frame image is in Point about Directional second-order partial derivative, Directional second-order partial derivative and The Gaussian convolution response value with directional mixed partial derivatives. Two eigenvalues of the Hessian matrix. This reflects the curvature of the point in the two principal directions. For true interlacing nodes, the curvature is large in both directions; for edge points, the curvature is large only in the direction perpendicular to the edge. This embodiment calculates the ratio of principal curvatures. (set up ), and set a threshold (e.g. This effectively eliminates unstable edge response points and filters out texture nodes with high physical location stability.
[0037] The local binary pattern algorithm (LBP) is used to analyze the neighborhood orientation of the texture nodes, and adjacent texture nodes are connected to generate the real-time texture topology mesh. To ensure that the generated mesh has a four-connected structure that conforms to the warp and weft physical properties of the fabric, the connection step specifically executes the following logic: Using any given texture node as the central anchor point, and based on the principal direction of the texture (i.e., the tangent direction of the warp or weft yarns) calculated by the LBP operator, a local polar coordinate system is constructed, dividing the two-dimensional space surrounding the node into four 90-degree search sectors (respectively...). (Direction); where the sampling parameters of the LBP algorithm are set as: sampling radius (pixels), number of sampling points Next, a dynamic search radius is set within each search sector. ( The value is taken as 1.5 times the average spacing of texture corner points. The candidate node with the closest Euclidean distance is selected as the neighbor. Finally, only bidirectional nearest neighbor connections are retained. If a sector has no nodes (e.g., located at the fabric edge), it is marked as a mesh boundary. This quadrant constraint connection method generates a mesh that corresponds to the warp and weft directions of the fabric.
[0038] After identifying the discrete nodes, connections need to be established to form a mesh. The processor uses the LBP operator or histogram of gradient directions (HOG) to analyze the texture flow around each node, determining the extension directions of the warp and weft yarns. Based on this directional information, the nearest neighbor nodes are searched in the warp and weft directions, and connection edges are established. Ultimately, a large number of nodes and connection edges constitute a real-time texture topology mesh covering the entire graph. Geometrically, this mesh is an elastic mesh that twists with fabric deformation, visually reflecting the current physical posture of the fabric.
[0039] Step S13: Map and compare the real-time texture topology mesh with the preset reference tension-free topology mesh, calculate the displacement deviation of all nodes, and generate the micro-deformation vector field of the fabric surface.
[0040] The mapping and comparison process introduces a local topological constraint mechanism to eliminate matching ambiguities caused by periodic textures: first, coarse alignment is performed using the geometric center of the image; then, when finding the correspondence between real-time nodes and reference nodes, the search matching radius is limited. It must be smaller than the average side length of the reference grid cell. times (i.e.) , (This is the average side length of the reference mesh cell). If no reference node is found within this radius, interpolation is performed using the average displacement vector of adjacent nodes, rather than expanding the search range. This constraint avoids erroneous matching across texture periods, ensuring the physical accuracy of micro-deformation calculations.
[0041] The method for obtaining the reference tension-free topological mesh includes: during the equipment calibration stage, acquiring static images of the same batch of standard sample fabrics in a static state without external traction; extracting nodes and constructing a mesh using the same algorithm as in step S12, establishing a mesh data model in a standard coordinate system, and storing it in the system database.
[0042] In real-time detection, the processor uses point set registration algorithms (such as TPS thin-plate spline interpolation or RANSAC algorithm) to logically align the real-time texture topology mesh with the reference tension-free topology mesh. After registration, for each node in the real-time mesh, a corresponding theoretical position can be found in the reference mesh. The processor calculates the displacement vector between these two positions. This vector contains both magnitude (modulus) and direction. Calculations are performed on all nodes to generate a dense microscopic deformation vector field, which describes not only the magnitude and nature of the deformation: vector divergence represents stretching, vector convergence represents compression, and vector vortex represents torsion.
[0043] It should be noted that the microscale defined in this embodiment refers to the physical scale of a single warp and weft yarn interlacing unit, that is, each warp and weft yarn physical interlacing point on the fabric surface is taken as an independent calculation unit.
[0044] Accordingly, the definition rules for each deformation vector in the microscopic deformation vector field are as follows: the starting point of the vector is set as the theoretical position of the reference network node in the image coordinate system (this position data comes from the reference tension-free topological mesh); the ending point of the vector is set as the actual position of the texture node extracted in real time in the image coordinate system (this position data comes from the real-time texture topological mesh). The vector represents the displacement deviation of the specific texture node on the fabric relative to the theoretical tension-free state.
[0045] Step S14: Based on the distribution of the vector magnitudes in the micro-deformation vector field, dynamically construct an adaptive sensitivity mask that corresponds one-to-one with the pixel coordinates of the target frame image.
[0046] Traditional detection methods typically use globally fixed thresholds, leading to false alarms for holes when the fabric is stretched due to increased texture gaps, and false alarms for cracks when the fabric is compressed due to texture stacking. This invention achieves dynamic adjustment of the detection standard by constructing an adaptive sensitivity mask.
[0047] The step of dynamically constructing an adaptive sensitivity mask that corresponds one-to-one with the pixel coordinates of the target frame image includes: Initialize a single-channel floating-point mask matrix with the same resolution as the target frame image. Set all values as the baseline sensitivity reference value. (e.g., 1.0).
[0048] By traversing the microscopic deformation vector field, when the local vector magnitude and divergence indicate that the fabric is in a stretched state (i.e., texture sparsification), the system nonlinearly reduces the weight value of that region in the mask according to the degree of stretching. Specific weights... The calculation formula is as follows: ; in, Represents the pixel coordinates in the image; The standard physical area of a single grid cell in a baseline tension-free topological mesh; The formula for calculating the local grid area increment is as follows: , This represents the real-time area of the mesh cell at the corresponding coordinate in the real-time texture topology mesh; This is the stretching suppression sensitivity coefficient, used to adjust the response threshold of the mask weights to an increase in area; This is the stretch attenuation exponential factor, used to control the rate at which the weight decreases non-linearly with increasing stretch (usually taken as...). ).
[0049] As the degree of stretching increases, the weight... Rapid decay (e.g., dropping to 0.3). The physical meaning is that the system determines the increased light transmission in this area is caused by physical stretching, thus actively reducing sensitivity to hole-like features and suppressing false defect signals.
[0050] When the local vector magnitude and divergence indicate that the fabric is under compression (i.e., texture densification), the system nonlinearly increases the weight value of that region in the mask according to the degree of compression. Specific weights... The calculation formula is as follows: ; in, This represents the absolute value of the change in the local grid area. This is the compression enhancement gain coefficient, used to set the maximum amplification factor of the weight when the fabric undergoes compression deformation; The compression enhancement index factor controls the steepness of the non-linear increase in weight as the grid area decreases. This embodiment provides a set of preferred empirical value ranges for the above parameters. Taking a 1.6-meter wide pure cotton twill fabric as an example: Basic sensitivity benchmark value Set as ; Stretching inhibition sensitivity coefficient Set as Stretch attenuation index factor Set as This means that when the local mesh area increases by 50% due to stretching, the mask weight in that area will automatically decrease to approximately 0.3, thereby effectively suppressing false positives; the compression enhances the gain coefficient. Set as Extrusion Enhancement Index Factor Set as The above parameters are not fixed and can be finely adjusted linearly according to the elastic modulus of the fabric.
[0051] As the degree of compression increases, the weight... Significant improvement (e.g., up to 1.8). The physical meaning is that the system determines that the texture of this area is abnormally dense, which can easily cover up minor flaws. Therefore, it actively increases the sensitivity, so that the subsequent detection model can detect this area with a higher sensitivity threshold, thereby enhancing the ability to capture minor closed flaws.
[0052] The calculated weight values are filled into the mask matrix. In the process, Gaussian smoothing is performed to eliminate weight abrupt boundaries, generating the final adaptive sensitivity mask.
[0053] Step S15: Input the target frame image into a preset visual detection model to extract an initial defect probability map.
[0054] While constructing the physical defense mechanism, visual feature extraction is also performed simultaneously. In this embodiment, the visual detection model preferably employs a deep convolutional neural network (CNN), such as the improved U-Net or DeepLabV3+ architecture. The model outputs an initial defect probability map at the output layer through a sigmoid activation function. The value (0~1) of each pixel in the map represents the model's original confidence level in judging that the point as a defect based on pure visual features. Since deformation factors are not considered, this original result often contains a large number of false positives caused by stretching or false negatives caused by compression.
[0055] Step S16: Use the adaptive sensitivity mask to perform weighted correction on the initial defect probability map to obtain the final defect judgment result, and output the quality inspection control signal according to the final defect judgment result.
[0056] This is the convergence point of the algorithm flow. The processor performs a point-to-point fusion operation between the initial defect probability map and the adaptive sensitivity mask. Specific operations include: Extract the original confidence scores of each pixel in the initial defect probability map. ; Obtain the weight adjustment coefficients of the corresponding coordinate points in the adaptive sensitivity mask. ; The two values are then weighted to obtain the corrected confidence score. The calculation formula is: .in, The initial defect probability value output by the visual inspection model, with a value range of [value missing]. ; For adaptive sensitivity mask in coordinate The weight value at the location; This is the corrected final confidence level value. If the calculated result is greater than... Then cut off as .
[0057] judge Does it exceed a preset alarm threshold (e.g., 0.5)? If it does, the pixel is determined to be a genuine defect.
[0058] Through this mechanism, the present invention uses a physical model to correct the blind spots of the AI model: in the stretching region, the weights This lowers the confidence level of false defects and eliminates false alarms; in the squeeze region, the weights This amplifies the confidence level of minor defects, preventing missed detections. Finally, the processor generates a quality control signal based on the corrected result, driving the actuator to mark or stop the machine.
[0059] Furthermore, although software-level compensation can solve most false alarm problems, the imaging system will face sampling rate mismatch when the physical deformation of the fabric exceeds a certain limit (for example, the longitudinal stretching rate of high-elastic knitted fabric exceeds 8% when the tension is uneven).
[0060] Specifically, traditional line-scan industrial cameras are typically configured in external trigger mode, with their line scanning frequency following the pulse signals of a rotary encoder mounted on the guide roller. This mechanism assumes that the distance the guide roller rotates is equal to the distance the fabric moves. However, when transporting flexible fabrics at high speeds, due to the viscoelasticity of the fabric and the slight slippage between it and the guide roller, the actual speed of the fabric often differs from the linear velocity of the guide roller. Especially when the fabric experiences significant longitudinal tension and elastic elongation, a unit physical length (e.g., 1 meter) of fabric physically stretches in the transport direction. If the camera continues to capture images according to the original encoder pulses, the resulting digital image will have a significantly lower longitudinal resolution than the lateral resolution, causing the originally circular texture to be flattened into an ellipse. This geometric distortion of the source data severely disrupts the subsequent texture topology mesh construction process and may even cause texture feature extraction algorithms such as LBP to fail.
[0061] To address this issue, embodiments of the present invention further introduce a closed-loop control step based on deformation feedback. Specifically, the closed-loop control step based on deformation feedback includes the following process: After generating the micro-deformation vector field as described in step S13, the processor not only uses it as an intermediate variable for generating the mask, but also simultaneously inputs it into the global tension analysis module within the system. This module is responsible for extracting macroscopic physical indicators characterizing the overall motion state of the fabric from the massive amount of micro-vector data.
[0062] Considering the potential for localized contamination, fly debris obstruction, or calculation errors in industrial environments, directly averaging the entire field vector is highly susceptible to interference from outliers. Therefore, this embodiment preferably employs the Trimmed Mean or Weighted Root Mean Square method to calculate the displacement vector magnitude of effective texture nodes. Specifically, the processor first removes the top 5% and bottom 5% of node data in the micro-deformation vector field to eliminate local singularities. Then, combining the texture sharpness score of each node (nodes with higher sharpness have greater weight), a weighted average is calculated for the remaining 90% of nodes to obtain the Global Average Deformation Modulus (GADM).
[0063] The meaning of the GADM value includes: it directly corresponds to the overall tension-strain state of the fabric on the conveyor belt. If the GADM value increases significantly and the direction is consistent with the direction of movement, it means that the fabric is in a longitudinally stretched state and the yarn density per unit physical length is reduced; if the GADM value decreases or the direction is opposite, it means that the fabric is in a relaxed, retracted or stacked state.
[0064] The system maintains a time-sliding window in memory (e.g., 50 frames long, covering approximately 200mm of fabric) to monitor the changing trend of the GADM value in real time. The system presets a tension safety threshold range (e.g., ±2% of the baseline state).
[0065] If the GADM value continuously exceeds the safety threshold for multiple consecutive frames, it indicates a systematic drift in production line tension, rather than a momentary mechanical jitter. At this point, a high-frequency digital PID (proportional-integral-derivative) control algorithm module running inside the processor is activated.
[0066] The PID controller uses the deviation between the GADM value and the reference zero point as input error. It responds quickly to the deviation through a proportional (P) element, eliminates steady-state error through an integral (I) element, and predicts the changing trend through a derivative (D) element, ultimately calculating the corrected synchronization control signal. For example, when the fabric is stretched longitudinally, it physically lengthens. To ensure that the aspect ratio of the acquired image remains at 1:1, the system must increase the camera's line scan frequency to increase the number of sampling lines per unit time.
[0067] The specific frequency adjustment logic is implemented by adjusting the electronic gear ratio. First, a reference electronic gear ratio is set. The calculation formula is as follows: ; In the formula, The physical resolution (unit: pulses / revolution) of the encoder located on the drive shaft of an industrial imaging device. The circumference of the guide roller (unit: millimeters); The target vertical resolution set for the system (unit: lines / mm).
[0068] When visual inspection measures the longitudinal tensile strength of the fabric... hour( For dimensionless values, such as when stretched by 5%. To compensate for the vertical distortion of the image caused by physical stretching, the processor calculates the corrected electronic gear ratio in real time. The calculation formula is: ; After the calculation is complete, the command is sent in real time to the servo driver or motion control card via the EtherCAT bus. When At that time, calculated according to the above formula This reduces the number of acquisition rows per unit physical distance (i.e., increases the trigger interval), ensuring that the generated digital image reproduces the geometric proportions of the fabric in a tension-free state.
[0069] The synchronization adjustment signal is sent directly to the controller of the industrial imaging equipment or the encoder signal distribution card connected to it via a low-latency industrial fieldbus (such as EtherCAT) or a dedicated FPGA hardwired connection (such as RS-422 differential signal).
[0070] In traditional hard encoder mode, a single line of images captured by the camera corresponds to a fixed number of pulses emitted by the encoder. However, in the closed-loop mode of this invention, the system enables a virtual electronic gear function. The processor dynamically modifies the division / multiplication ratio of the encoder signal based on the calculated adjustment amount.
[0071] For example, when a 5% longitudinal stretch of the fabric is detected, the processor sends a command to adjust the frequency division ratio from the standard 1:1 to 1:1.05. This means that for every shorter physical distance the fabric moves (based on roller rotation), the camera triggers an exposure. Through this dynamic adjustment, the system physically counteracts the effects of fabric stretching at the source of photoelectric conversion, ensuring that the output RAW image remains highly realistic on a geometric scale. This effectively avoids software interpolation artifacts and provides a high-quality data source for subsequent high-precision quality inspection.
[0072] Furthermore, in practical applications, clothing fabrics exhibit a wide variety of defects with varying physical properties. Different types of defects have different sensitivities to fabric deformation. Applying the same masking correction strategy to all types of defects may lead to the missed detection of certain types of defects (such as oil stains). Therefore, this embodiment introduces a differentiated weighting mapping mechanism based on defect categories.
[0073] The final defect determination result includes not only whether there is a defect, but also the defect type (such as structural, discoloration, or texture), area, and physical location coordinates. The visual detection model in step S15 is designed as a multi-head architecture, and the adaptive sensitivity mask uses different weight mapping functions for different defect channels: Structural defects mainly refer to physical damage that disrupts the warp and weft weave structure of the fabric, such as holes, sparse yarn (too low yarn density), skipped yarns, and broken warp or weft threads. The visual characteristics of these defects are primarily manifested as abnormal abrupt changes in light transmittance or interruptions in texture continuity. When the fabric is stretched, the normal gaps between the yarns are physically enlarged, significantly increasing its light transmittance, which appears similar to tiny holes in backlit images.
[0074] Therefore, for the channel that outputs structural defect classification in the visual inspection model, the system implements a negative correlation strategy. As the local stretching (microscopic deformation vector magnitude) increases, the weight of this region in the mask decreases exponentially. The weight decreases rapidly with increasing stretching (e.g., from 1.0 to 0.1). The physical meaning is that the system determines that the enhanced light transmission in this region is highly likely caused by physical stretching, thus actively reducing sensitivity to hole-like features and suppressing false defect signals. While this may theoretically reduce the detection rate of real micro-holes under extreme stretching, in industrial practice, this trade-off is entirely reasonable because under high stretching, even the human eye cannot distinguish between a hole and a gap, and high stretching is usually accompanied by subsequent cutting processes, often resulting in the region being discarded.
[0075] Surface discoloration defects refer to abnormal colors adhering to the fabric surface, such as oil stains, color spots, fly waste (discolored fibers), and dyeing smudges. These defects are caused by changes in the spectral reflectance of the material, not changes in the weave structure. Regardless of whether the fabric is stretched or compressed, the color depth (grayscale value) of oil stains does not fundamentally change. If the detection weight of oil stains is reduced in the stretched area to suppress false alarms of holes, it will lead to serious missed detections. Therefore, this invention logically separates the detection channels. For the channel in the visual detection model that outputs the classification of surface discoloration defects, the system forces its weight mapping function to remain constant, or only makes a very small linear adjustment. That is, no matter how drastically the microscopic deformation vector field fluctuates, the mask weight for the oil stain channel always remains near a baseline value (e.g., 1.0). This means that even if the fabric undergoes severe distortion, the system's detection sensitivity for oil stains and color spots remains at the highest level. For three-dimensional defects (such as pilling, knots, and loose warp threads), the characteristic is the change in the three-dimensional height of the surface. When fabric is compressed, normal surface textures will bulge, forming shadows similar to pilling. Therefore, to address this type of defect, the system employs a moderate suppression strategy, appropriately reducing sensitivity in the compression zone (vector convergence zone) to prevent misjudging normal loose wrinkles as pilling; while maintaining high sensitivity in the stretching and flattening zone.
[0076] Furthermore, in the field of industrial vision, the performance of a model may degrade after deployment due to changes in the production environment (such as changes in fabric batches, light source attenuation, and mechanical wear). To address this, this invention introduces a model self-learning evolution mechanism. The data corrected by the adaptive sensitivity mask in the aforementioned steps is used as negative samples, and the data from manual review is used as positive samples to achieve online incremental updates of the model. The specific steps are as follows: During normal system operation, the processor monitors the weighted correction process in step S16 in real time. An internal sample capture trigger is configured. The trigger activates under the following conditions: Condition 1: The initial defect probability map output by the visual inspection model (AI side) shows that a certain area has a very high defect confidence (e.g., greater than 0.85). Condition 2: After correction by the adaptive sensitivity mask (physical end), its final confidence level is significantly reduced to below the alarm threshold (e.g., less than 0.2). Condition 3: The deformation vector magnitude of the region exceeds a specific threshold (confirmed to be a correction due to deformation).
[0077] Image regions that meet all the above conditions are defined by the system as high-value pseudo-defects. These samples are typically extremely stretched normal meshes, strong reflective wrinkles, etc., which are visually extremely close to real defects. The system will automatically crop the original image corresponding to the region, automatically label it with a normal background, and store it on a local high-speed SSD or upload it to a self-learning database on a private cloud server.
[0078] The system is set with an automatic update cycle (e.g., every 100,000 meters of fabric produced or during equipment downtime on Sunday mornings). During the update window, the processor uses data from the self-learning database, combined with historically retained real defect samples (to prevent the model from forgetting), to incrementally train the visual inspection model in the background.
[0079] The preferred training strategy is Backbone Freezing, which keeps the parameters of the feature extraction layers at the front of the deep neural network unchanged, and only fine-tunes the classifier layer (Head) or specific feature fusion layers at the back of the network. This strategy ensures training speed while avoiding the risk of overfitting due to insufficient sample size.
[0080] By repeatedly analyzing these normal textures under stretched conditions, the model's convolution kernel parameters will be fine-tuned, and it will gradually learn to distinguish from the microscopic features of the texture the enlargement of pores caused by stretching and the enlargement of pores caused by yarn breakage.
[0081] To ensure operational stability in industrial settings, newly trained model versions do not directly replace the old model; instead, they first enter shadow mode. In shadow mode, both the new and old models perform inference on real-time images simultaneously, but the control signals are still generated by the old model. The system compares the output differences between the two models in the background. Only when statistical data shows that the new model significantly reduces the false alarm rate (i.e., enhances the ability to identify false defects) while maintaining the original detection rate, will the system perform a hot update of the model weights using a double-buffered switching technique.
[0082] In the above embodiments, the micro-deformation vector field is constructed based on a textured topological mesh. In another embodiment, optical flow can be used to calculate the dense motion field between adjacent frames or between the current frame and a reference frame. The divergence of the optical flow field can also be used to determine the stretching or compression state of the fabric, and an adaptive sensitivity mask can be constructed accordingly. Although the optical flow method is slightly less robust than the topological mesh method when the illumination changes drastically, its physical essence is still to use the kinematic characteristics of the fabric to correct the detection threshold, and therefore it is an equivalent technical solution of this invention.
[0083] When processing dark or black fabrics, the texture contrast under visible light is extremely low. In this case, the image acquisition module can be replaced with a short-wave infrared camera. In the infrared band, many dark dyes appear transparent, while physical defects (such as broken yarns) remain clearly visible. Applying the topological mesh construction and adaptive masking algorithm described in this invention under this spectrum can effectively solve the problem of difficult detection of black fabrics.
[0084] In another implementation, a generative adversarial network (GAN) can be trained. Taking a normal fabric image under stretching as input, the GAN generates a corresponding ideal unstretched image, and an attention mask is automatically generated by comparing the differences between the two. Although this method requires more computation, it does not deviate from the core concept of correcting detection results based on deformation information.
[0085] In summary, the present invention discloses a visual inspection method and intelligent quality inspection system for garment fabric defects based on industrial vision. By constructing a texture topology mesh, it effectively solves the problems of high false alarm rate and high false negative rate caused by physical deformation in high-speed inspection of flexible fabrics.
[0086] The system utilizes an adaptive sensitivity mask to achieve dynamic adjustment of detection standards; utilizes deformation feedback to achieve closed-loop hardware control at the acquisition source; utilizes a refined classification weight strategy to address the differentiated detection needs of different defects; and utilizes a self-learning mechanism based on pseudo-defect mining to endow the system with the ability to continuously evolve.
[0087] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for visually detecting defects in clothing fabrics based on industrial vision, characterized in that, The method includes the following steps: Real-time sequential images of the garment fabric to be inspected are acquired using industrial imaging equipment, and the real-time sequential images are preprocessed to obtain the target frame image. Extract the texture skeleton features from the target frame image, and construct a real-time texture topology mesh that reflects the current physical state of the fabric based on the texture skeleton features; The real-time texture topology mesh is mapped and compared with the preset reference tension-free topology mesh, and the displacement deviation of all nodes in the field is calculated to generate the micro-deformation vector field of the fabric surface. Based on the distribution of each vector magnitude in the micro-deformation vector field, an adaptive sensitivity mask that corresponds one-to-one with the pixel coordinates of the target frame image is dynamically constructed. The target frame image is input into a preset visual detection model to extract an initial defect probability map; The initial defect probability map is weighted and corrected using the adaptive sensitivity mask to obtain the final defect judgment result, and a quality inspection control signal is output based on the final defect judgment result.
2. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The step of extracting texture skeleton features from the target frame image specifically includes: The target frame image is convolved using a multi-scale Gaussian difference operator to obtain candidate regions for texture corner points. Calculate the principal curvature ratio of the candidate texture corner regions, eliminate edge response points, and determine stable texture nodes; The neighborhood direction of the texture node is analyzed using the local binary mode algorithm, and adjacent texture nodes are connected to generate the real-time texture topology mesh.
3. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The step of preprocessing the real-time sequence images to obtain the target frame image specifically includes: The real-time sequence images are spatially denoised using an adaptive Wiener filter to remove random photoelectric noise. The local contrast of the image is enhanced by limiting the contrast adaptive histogram equalization algorithm, thus separating the texture foreground from the background; The enhanced image is then subjected to grayscale normalization processing to output the target frame image.
4. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The step of dynamically constructing an adaptive sensitivity mask that corresponds one-to-one with the pixel coordinates of the target frame image includes: Set a baseline sensitivity value; When the local vector magnitude in the micro-deformation vector field indicates that the fabric is in a stretched state, the weight value of that region in the adaptive sensitivity mask is nonlinearly reduced according to the degree of stretching in order to suppress false defect signals caused by the increase of texture gaps. When the local vector magnitude in the micro-deformation vector field indicates that the fabric is under compression, the weight value of that region in the adaptive sensitivity mask is nonlinearly increased according to the degree of compression to enhance the detection capability of small closed defects.
5. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The step of weighting and correcting the initial defect probability map using the adaptive sensitivity mask specifically includes: Extract the original confidence values of each pixel in the initial defect probability map; Obtain the weight adjustment coefficients of the corresponding coordinate points in the adaptive sensitivity mask; The original confidence score value and the weight adjustment coefficient are performed point-to-point to obtain the corrected confidence score value. Determine whether the corrected confidence value exceeds a preset alarm threshold. If it does, then the pixel is determined to be a real defect.
6. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The methods for obtaining the reference tension-free topology mesh include: During the equipment calibration phase, static images of the standard sample fabric are collected when it is stationary and without external traction. The static image is divided into grids and labeled with nodes to establish a grid data model in a standard coordinate system; The grid data model is stored in the system database as a benchmark for subsequent detection and comparison.
7. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The method also includes a closed-loop control step based on deformation feedback: Calculate the global average deformation modulus of the microscopic deformation vector field; If the global average deformation modulus exceeds a preset safety threshold for multiple consecutive frames, a synchronization adjustment signal is generated. The synchronization adjustment signal is sent to the controller of the industrial imaging equipment to adjust the trigger frequency of image acquisition to match the current motion state of the fabric, thereby suppressing longitudinal distortion at the acquisition source.
8. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The final defect determination result includes the defect type, area, and physical location coordinates; For different types of defects, the adaptive sensitivity mask uses different weighting mapping functions; for structural defects, the weights change negatively with the stretching degree; for surface discoloration defects, the weights remain constant.
9. The method for visual inspection of defects in clothing fabrics based on industrial vision according to claim 1, characterized in that, The method also includes a model self-learning step: Image regions that are identified as false defects after being corrected by the adaptive sensitivity mask are selected as negative samples. The negative samples are used periodically to fine-tune the parameters of the visual detection model and update the weight parameters inside the model to improve the model's intrinsic robustness to texture deformation.
10. An intelligent quality inspection system for visual detection of defects in clothing fabrics based on industrial vision, characterized in that, The system includes: The image acquisition module is used to acquire real-time sequential images of the garment fabric to be inspected using an industrial camera; The processor is connected to the image acquisition module; A memory storing a computer program, which, when executed by the processor, implements the method steps as described in any one of claims 1 to 9; An actuator is used to physically mark or stop the machine on fabric areas with defects in response to a quality control signal output by the processor.