A method for visual inspection of defects on a textile surface
By using high-resolution industrial cameras and deep learning technology, combined with adaptive filtering and wavelet transform, the problems of complex background interference and insufficient computing resources in textile surface defect detection are solved, achieving efficient and accurate defect detection and real-time alarm.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FOSHAN YICHANGRUI KNITTING CO LTD
- Filing Date
- 2026-04-30
- Publication Date
- 2026-07-24
Smart Images

Figure CN122453776A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and more specifically to a visual inspection method for surface defects in textiles. Background Technology
[0002] With the continuous evolution of industrial automation and intelligent manufacturing technologies, computer vision is increasingly widely used in quality control of textile production, becoming a key link in ensuring product qualification rates. The production process of knitted textiles involves yarn weaving and physical finishing; affected by equipment operating conditions and raw material quality, various physical defects can easily occur on the surface. Replacing traditional manual visual inspection with automated inspection technology can not only significantly improve the inspection efficiency of the production line but also effectively reduce the missed inspection rate and alleviate manual labor intensity, making it the core of achieving digital transformation in textile workshops.
[0003] Among them, surface defect detection technology based on digital image processing uses high-resolution industrial cameras to collect the surface state of fabrics in real time, and uses specific algorithms to extract and analyze image features, thereby achieving accurate location and classification of abnormal fabric conditions. In the context of knitted fabric production, the image detection system needs to process fabric data with highly periodic textures and complex deformation features in real time, which places stringent requirements on the robustness of feature description operators, noise suppression capabilities, and computational efficiency of the algorithms.
[0004] However, existing detection methods often struggle to extract highly discriminative defect representations when faced with complex background textures in knitted textiles, resulting in a high false detection rate for minor damage and shadow stains. Furthermore, due to subtle differences in texture spacing and color between different batches of fabric, traditional fixed-parameter feature extraction models lack adaptability and are ill-suited to varying working environments. In addition, existing visual inspection algorithms often suffer from insufficient real-time performance when processing high-speed image streams in dynamic production processes due to excessive computational resource consumption, failing to meet the high-speed production demands of modern weaving workshops. Summary of the Invention
[0005] The present invention provides a visual inspection method for surface defects in knitted textiles, which can solve the above-mentioned problems.
[0006] To solve the above problems, the technical solution adopted by the present invention is as follows: A visual detection method for surface defects in knitted textiles includes the following specific steps: Step 1: Dynamically acquire images of the knitted textile surface: Using a high-resolution industrial camera combined with a strip light-emitting diode light source, during the operation of the weaving production line, a continuous original grayscale image of the knitted textile surface is acquired in real time using a rotary encoder trigger signal; Step 2: Suppress fabric background texture: The original grayscale image is converted to the frequency domain, and the characteristic frequency points representing the periodic texture of the fabric are masked by constructing an adaptive band-stop filter, and then restored to the detextured residual image by inverse Fourier transform; Step 3: Enhance small defect features: Multi-scale Gabor wavelet transform is performed on the residual image, and the detailed features of the fabric surface are extracted using filter banks of different directions and frequencies, and the contrast between the suspected defect area and the normal area is enhanced by a nonlinear mapping function; Step 4: Extract multi-dimensional representation vector: A sliding window is constructed on the enhanced image, and the local binary mode features, gray-level co-occurrence matrix features, and information entropy features of the region within the window are calculated. The above features are fused to form a multi-dimensional feature vector for describing defect attributes; Step 5: ... Defect classification, identification, and localization: The multidimensional feature vector is input into a pre-trained deep residual convolutional neural network model to identify the specific type of defect and determine the coordinate position of the defect in the image, and finally output the detection result.
[0007] Preferably, in step 1, the high-resolution industrial camera uses a line-scan complementary metal-oxide-semiconductor sensor with a predetermined pixel size, the line scanning frequency is set to a preset operating frequency, and the object distance is controlled within a predetermined distance range to ensure that the spatial resolution reaches the target resolution, thereby enabling it to capture fiber breaks or damage of a predetermined size.
[0008] Preferably, the strip light-emitting diode light source adopts a highly uniform white light source with an illumination intensity greater than a preset intensity threshold, and the incident angle of the light beam forms a preset angle range with the fabric plane, using the shadow effect generated by oblique illumination to highlight defects such as pilling, cotton shedding, or foreign matter on the fabric surface.
[0009] Preferably, in step 1, the rotary encoder is installed at the axial end of the winding roller of the loom, and outputs a specific number of pulse signals every predetermined number of rotations. Through the linear mapping relationship between the pulse frequency and the fabric running speed, it ensures that the scale of the acquired image is consistent in the longitudinal and transverse directions, and eliminates image distortion caused by production line speed fluctuations.
[0010] Preferably, in step 2, the original grayscale image is subjected to a two-dimensional discrete Fourier transform to obtain the corresponding amplitude spectrum image. Peak points representing the periodic structure of warp and weft yarns are identified in the amplitude spectrum. A mask matrix is automatically generated based on the distribution characteristics of the peak points. The gain of the mask matrix at the peak points is set to a first predetermined gain value, and the gain in the remaining areas is set to a second predetermined gain value.
[0011] Preferably, the cutoff frequency of the adaptive bandstop filter is automatically adjusted according to the fabric density. It determines the main frequency of the fabric by calculating the local maximum value of the radial energy distribution at the center of the amplitude spectrum, and the filter bandwidth is set to a predetermined proportional coefficient relative to the main frequency to achieve accurate stripping of complex texture backgrounds.
[0012] Preferably, in step 3, the multi-scale Gabor wavelet transform uses a combination of filters with multiple scales and multiple directions. The scale parameters follow a preset distribution pattern, and the direction parameters are uniformly distributed at predetermined angle intervals. By extracting the maximum value of the multi-channel response, the saliency features of the defect under different observation dimensions are preserved.
[0013] Preferably, the nonlinear mapping function adopts an improved sigmoid colon function, the expression of which includes an adaptive gain factor. This factor is dynamically adjusted according to the variance of the local region of the image, improving contrast for smooth regions with small variance and smoothing and suppressing regions with large noise fluctuations.
[0014] Preferably, in step 4, the local binary pattern features use an equivalent pattern operator to reduce the dimensionality of the original dimension features to the target dimension, thereby improving computational efficiency and maintaining rotation invariance, and are used to describe the texture roughness information of defects.
[0015] Preferably, the grayscale co-occurrence matrix features include statistical indicators in multiple dimensions, the calculation direction is the average of multiple predetermined directions, and the window step size is set to a preset pixel value, which is used to quantify the statistical differences between the defect area and the surrounding fabric structure.
[0016] Preferably, the construction process of the multidimensional feature vector includes feature normalization processing, using the zero-mean unit variance method to ensure that feature terms with different physical meanings have the same weight contribution in the subsequent classifier, thus eliminating the impact of dimensional differences on recognition accuracy.
[0017] Preferably, in step 5, the deep residual convolutional neural network model includes a multi-layer convolutional structure, utilizes a skip connection mechanism to solve the gradient vanishing problem during deep network training, and sets the model input layer size to a predetermined size.
[0018] Preferably, in the classification and recognition process, the model terminal uses a normalized exponential function layer to calculate the probability distribution. When the probability value of a certain defect category is greater than a first preset probability threshold and the background probability is less than a second preset probability threshold, it is determined that the defect of that type has been detected.
[0019] Preferably, the specific method for locating defects is as follows: extract the activation region of the feature map of the last layer of the convolutional neural network, generate a heat map through class activation mapping technology, perform threshold segmentation on the heat map, and find the minimum bounding rectangle of the connected region, thereby obtaining the pixel coordinates and geometric dimensions of the defect in the original image.
[0020] Preferably, step 6, real-time alarm and quality statistics, is also included: when a defect is detected, the system sends an audible and visual alarm signal to the production line through the programmable logic controller, and stores the defect image, type, size and location information of the roll in the database, and automatically generates a quality inspection report for each roll of textile.
[0021] Preferably, the quality inspection report includes a defect density distribution curve, which is calculated as the total number of defects within a predetermined unit length along the fabric length direction. If the defect density exceeds a preset threshold, the roll of fabric is automatically determined to be a defective product.
[0022] Preferably, the method also involves an adaptive learning mechanism, which involves periodically extracting false or missed samples from the database, manually correcting them using annotation tools, and then re-adding them to the training set to incrementally learn the deep residual convolutional neural network, so that the model can adapt to new materials or new patterns of knitted textiles.
[0023] Preferably, in step 5, the deep residual convolutional neural network uses a stochastic gradient descent algorithm during the training phase, the momentum factor is set to a preset momentum value, the initial learning rate is a preset learning rate, the learning rate is reduced by a predetermined proportion after each predetermined iteration period, and the total training time is not less than the preset total number of iterations.
[0024] Preferably, the image acquisition and processing flow adopts a multi-threaded parallel computing architecture, where the image acquisition thread and the feature extraction thread exchange data through a circular buffer to ensure that the detection delay is less than a preset delay threshold at a predetermined production speed.
[0025] Preferably, the residual image after the inverse Fourier transform in step 2 needs to undergo median filtering. The filter kernel size is a predetermined size, which is used to filter out isolated bright pixels caused by sensor thermal noise and prevent the generation of false features.
[0026] Preferably, the defect types include holes, oil stains, color deviation, missing needles, warp threads, crossbars, flying flowers, and broken warp threads. For different types of defects, the deep residual convolutional neural network in step 5 is set with independent judgment thresholds, among which the judgment sensitivity for specific severe defect types is set to the highest.
[0027] Compared with the prior art, the beneficial effects of the present invention are: (1) This invention achieves high-precision microscopic imaging through the combination of a high-resolution industrial camera and a preset row scanning frequency. By combining frequency-domain adaptive band-stop filtering and multi-scale Gabor wavelet transform, weak defect signals can be accurately extracted from the complex periodic texture of knitted fabrics. Detection results show that this method has an extremely high detection rate for tiny defects and controls the false negative rate to an extremely low level, which is significantly better than traditional manual visual inspection and simple binarization image processing algorithms.
[0028] (2) The Fourier transform automatic masking technology used in this invention can automatically adjust the filtering parameters for knitted textiles with different fabric densities, batches, and even colors. By suppressing the background texture of the fabric, interference caused by slight differences in texture spacing is eliminated. At the same time, the deep residual convolutional neural network has a strong feature abstraction capability and can adapt to the negative impacts of light fluctuations, slight fabric shaking, and deformation in the production environment. This adaptive mechanism allows the system to meet the production needs of various types of knitted fabrics without frequent manual parameter intervention, greatly reducing the system's maintenance costs.
[0029] (3) Through a multi-threaded parallel computing architecture and an optimized deep learning inference engine, this invention achieves extremely fast single-frame image processing response, perfectly matching the operational requirements of high-speed production lines. The system achieves precise synchronous triggering through a rotary encoder, ensuring the geometric consistency of image acquisition. Through deep integration with a programmable logic controller, it realizes full-process automation from defect detection to alarm, recording, and report generation, providing solid technical support for the digital transformation and intelligent manufacturing upgrade of textile workshops.
[0030] (4) The adaptive learning mechanism and database management system introduced in this invention enable the detection model to continuously evolve. Through in-depth mining of historical defect data, not only can the product quality be accurately classified, but it can also assist production process personnel in analyzing the frequency and cycle of defect occurrence, thereby tracing the operational failures of upstream equipment or batch problems of raw materials. This closed-loop system from detection to analysis and then to process improvement not only improves the factory pass rate, but also provides a scientific basis for decision-making to reduce the scrap rate and optimize resource allocation.
[0031] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, embodiments of the present invention are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0032] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a schematic diagram of the overall technical solution architecture of a visual inspection method for surface defects in knitted textiles proposed in this invention; Figure 2 This is a schematic diagram of the core principle framework of adaptive background texture suppression and multi-scale feature enhancement in this invention; Figure 3 This is a flowchart illustrating the logical process of multi-dimensional feature fusion construction and defect classification and identification in this invention. (Detailed implementation details follow.) To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 some embodiments of the present invention, but not all embodiments. Example
[0034] Please refer to Figure 1 This invention provides a visual inspection method for surface defects in knitted textiles, as detailed below: The specific implementation process of step 1 involves the construction of a high-precision opto-mechanical-electronic collaborative acquisition architecture. The high-resolution industrial camera is positioned above the winding mechanism of the weaving production line, and its internal line-scanning complementary metal-oxide-semiconductor (CMOS) sensor has a predetermined pixel size of 8192 pixels. During dynamic acquisition, the line scanning frequency is set in real-time to a preset operating frequency of 50kHz to 80kHz to match the operating speed of the loom under different working conditions. The object distance is precisely controlled within a predetermined range of 300mm to 500mm to ensure a 1:1 or specific ratio imaging effect in the optical path system, achieving a spatial resolution of 0.05mm / pixel, thereby stably capturing single fiber breaks, minor damage, or weaving noise at predetermined size levels (e.g., 0.1mm).
[0035] The strip-shaped LED light source employs a highly uniform white light source module with an integrated constant current drive circuit, ensuring that the luminous flux fluctuation is less than 1% during long-term operation. The luminous intensity of the strip-shaped LED light source is adjusted to a preset intensity threshold greater than 5000 Lux via a digital dimmer. To enhance the visual contrast of defects, the installation position of the light source is precisely calibrated so that the incident angle of the beam forms a preset angle range of 15 to 30 degrees with the fabric plane. Utilizing the shadow effect generated by this oblique illumination, a significant brightness gradient difference can be formed in the image for surface defects such as pilling, loose fibers, foreign matter, or changes in surface smoothness caused by warp breaks, thus completing physical-level feature pre-enhancement at the original grayscale image stage.
[0036] The rotary encoder is mounted on the axial end of the loom's winding roller and rotates synchronously with the roller shaft via a highly flexible coupling. The rotary encoder outputs 10,000 specific pulse signals per revolution. The system acquires these pulse signals in real time through a high-speed counting module and dynamically adjusts the trigger cycle of the high-resolution industrial camera using the linear mapping relationship between pulse frequency and fabric running speed. Specifically, the trigger cycle shortens proportionally when the linear speed increases and lengthens proportionally when the linear speed decreases. This synchronization mechanism ensures that the acquired images maintain a 1:1 ratio in both the longitudinal (fabric feeding direction) and transverse (width direction), eliminating longitudinal stretching or compression deformation caused by fluctuations in production line motor speed and load changes. This provides a precise spatial reference for subsequent geometric dimension measurements and defect location.
[0037] In the above method, step 2 suppresses the fabric background texture through digital signal processing. The original grayscale image is first divided into sub-image blocks of a predetermined size (e.g., 2048×2048 pixels), and a two-dimensional discrete Fourier transform is performed to convert the image from the spatial domain to the frequency domain, obtaining the corresponding amplitude spectrum image. In the amplitude spectrum, due to the highly periodic structure of knitted textiles (e.g., plain weave, twill weave, or satin weave), the energy representing the distribution of warp and weft yarns is concentrated at specific frequency peak points. The system identifies these peak points using a local maximum search algorithm and automatically generates a mask matrix centered on each peak point based on its energy diffusion radius. The gain of the mask matrix at these frequency peak points is set to a first predetermined gain value of 0 (i.e., complete masking), while the gain in non-periodic texture regions is set to a second predetermined gain value of 1.
[0038] The transfer function of the adaptive bandstop filter is defined as:
[0039] in, Represents frequency coordinates. This indicates the number of identified main frequency peak points. Indicates the current frequency point to the [number]th [frequency]. Euclidean distance between the central peak points This represents the distance to its symmetrical point. The filter bandwidth. It is set to 0.05 to 0.1 times the main frequency value. This configuration can accurately filter out the periodic components that represent the normal fabric background, while retaining the non-stationary components that represent random defects (such as holes, oil stains, etc. that disrupt the periodic signal).
[0040] After inverse Fourier transform, most of the fabric texture has disappeared in the restored residual image, and the background becomes relatively smooth. To further remove thermal noise or shot noise generated by the sensor during high-speed sampling, the residual image also needs to undergo median filtering. The filter kernel size is set to a predetermined size of 3×3 or 5×5. By sorting neighboring pixels and taking the median, isolated bright or extremely dark pixels are effectively filtered out, preventing these isolated points from being mistaken for fine fiber defects in subsequent steps.
[0041] In the above method, step 3 further enhances the features of minute defects in the residual image. Multi-scale Gabor wavelet transform is achieved by constructing a filter bank with different scale and orientation parameters. The scale parameters follow a power-of-2 distribution, typically covering 3 to 5 levels, to capture defects of different physical sizes; the orientation parameters are uniformly distributed in the range of 0 to 180 degrees at intervals of 22.5 degrees or 45 degrees, to capture directional defects (such as meridian breaks or latitudinal crossbars). Each Gabor filter is convolved with the image to obtain a multi-channel response map. The system extracts the maximum value of the multi-channel responses at the same spatial location and fuses them into a single saliency map, thus preserving the strongest response features of the defects across multiple observation dimensions.
[0042] To further expand the grayscale range between the defective region and the normal background, the system employs a modified sigmoid function as the nonlinear mapping function. The mathematical expression of this function is:
[0043] in, To input grayscale values, The upper limit of the target dynamic range, This represents the average local gray level of the image. The key adaptive gain factor. The system dynamically adjusts based on the variance of local image regions. When the local variance is small (representing smooth areas), the system automatically increases... The value is adjusted to enhance subtle grayscale fluctuations, thereby highlighting potential minor defects; when the local variance is large (representing noise or residual texture), the system automatically reduces the value. The value plays a smoothing and suppression role, thereby improving the signal-to-noise ratio of the image.
[0044] In the above method, step 4 extracts multidimensional representation vectors through a sliding window mechanism. The size of the sliding window is set according to the minimum detectable defect size, such as 32×32 or 64×64 pixels, and the step size is set to 1 / 2 of the window size to ensure coverage continuity. Within each window, the system computes three types of features in parallel. The first is Local Binary Pattern (LBP) features, which use an equivalent pattern operator to reduce the original 256-dimensional features to a target dimension of 59. This not only greatly improves computational efficiency but also maintains the rotation invariance and grayscale translation invariance of the features. It is mainly used to describe the microscopic texture roughness of defects, such as the disorder of fiber clusters.
[0045] Secondly, the system calculates the gray-level co-occurrence matrix (GLCM) features, including statistical indicators across four dimensions: energy, contrast, correlation, and entropy. To eliminate directional bias, the calculation direction is taken as the average of four predetermined directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees. The window step size is set to 1 to 3 pixel values to quantify the spatial statistical differences between the defective region and the surrounding normal tissue. Finally, the system calculates the region information entropy features, using the uncertainty of pixel distribution to identify structurally disordered defective regions.
[0046] The generated raw feature vectors contain multiple indices with different dimensions. To ensure that the subsequent classifier can handle these features in a balanced manner, the system implements feature normalization. A zero-mean unit variance method is used, which maps all feature terms to a uniform numerical magnitude by subtracting the feature mean and dividing by the standard deviation. This process eliminates the influence of physical meaning and dimensional differences on the weight contribution, ensuring the classification model's fair sensitivity to various feature types.
[0047] In the above method, step 5 relies on a deep learning architecture to achieve classification, recognition, and localization. The deep residual convolutional neural network (ResNet) is composed of multiple stacked residual modules, each containing convolutional layers, batch normalization (BN) layers, and modified linear unit activation layers. By introducing a skip connection mechanism, the network can learn identity mappings, effectively solving the gradient vanishing or gradient exploding problem in deep networks during backpropagation, making the training of deep networks with 50 or even 101 layers efficient and stable. The model input layer size is set according to the sliding window size, typically 224×224 pixels (obtained through interpolation scaling).
[0048] During the inference phase, a normalized exponential function (Softmax) layer is connected to the end of the model, outputting the probability distribution of whether the current window belongs to the normal background or various defects (such as holes, oil stains, color deviation, missing needles, warp threads, horizontal bars, flyaways, and broken warp threads). The judgment logic follows a dual threshold strategy: when the probability value of a certain defect category is greater than a first preset probability threshold of 0.85, and the background probability is less than a second preset probability threshold of 0.15, the system determines that a defect of that specific type has been detected. For defects of different severity levels, such as holes and broken warp threads, the system sets independent judgment thresholds by adjusting the cost sensitivity coefficient, maximizing the detection sensitivity of severe defects to ensure "zero missed detections".
[0049] The defect localization process is achieved using Class Activation Mapping (CAM) technology. The system extracts the feature map from the last convolutional layer of the convolutional neural network, and then performs a weighted summation using the weight vectors from the global average pooling layer to generate a heatmap representing the model's decision-making basis. The brightest region on the heatmap corresponds to the physical location of the defect in the image. By performing binarization and thresholding on the heatmap, and filling holes using image morphology operations, the system calculates the minimum bounding rectangle of all connected components. The coordinates of the top-left corner and the width and height parameters of this rectangle are then converted into the pixel coordinates and geometric dimensions of the defect in the original full-frame image, achieving sub-pixel level localization accuracy.
[0050] In the above method, step 6 is responsible for real-time response and quality control. When the detection result confirms the existence of a defect, the system sends an interrupt signal to the programmable logic controller (PLC) of the production line via industrial Ethernet (such as Profinet or Modbus TCP protocol). After receiving the signal, the PLC immediately drives the audible and visual alarm to emit sound and flashing signals, and controls the inkjet printer to spray color marks at the corresponding positions on the edge of the fabric, facilitating subsequent manual repair or cutting. At the same time, the system stores the original image clipping block of the defect, the defect type label, the geometric area, the latitude and longitude coordinates, and the current roll length in meters into a distributed database (such as MySQL or MongoDB) in real time.
[0051] The system automatically generates a detailed quality inspection report for each roll of knitted textiles. Key data in the report includes a defect density distribution curve, obtained by counting the total number of defects within predetermined unit lengths of 10 meters or 100 meters along the fabric's length. If the defect density in a certain section exceeds a preset quality threshold (e.g., more than 20 points are deducted per 100 meters of defects), the system will automatically classify the roll of fabric as non-conforming in the report and send an interception command to the central control room.
[0052] To adapt to the rapid updates in textile patterns, this method introduces an adaptive learning mechanism. The system periodically (e.g., weekly) automatically retrieves samples from the database whose predicted probabilities fall into an ambiguous range (e.g., between 0.4 and 0.6), or samples identified through manual sampling as false positives or false negatives. These samples are then manually reviewed and corrected by quality control personnel using an interactive annotation tool. The corrected samples are added to the incremental learning training set, where the deep residual convolutional neural network is fine-tuned using the stochastic gradient descent (SGD) algorithm. During fine-tuning, the initial learning rate is set to 0.001, and every 10 iterations, the learning rate is reduced to 1 / 10 of its original value. The momentum factor is set to 0.9, and the total training time ensures that the model's loss function on the validation set tends to stabilize. Through this closed-loop optimization, the system can quickly grasp the characteristics of new materials, textures, or defect morphologies, maintaining the long-term viability of the detection algorithm.
[0053] The entire image acquisition and processing workflow employs a multi-threaded parallel computing architecture. The image acquisition thread is responsible for communicating with the underlying hardware driver, stitching the acquired row data into frames; the processing thread is responsible for algorithm calculations; and the feature extraction and inference threads share the computational burden. Different threads exchange data through a high-speed circular buffer. This buffer has a mutex lock mechanism to ensure the atomicity and sequentiality of data read and write operations. At a predetermined production speed (e.g., 120 meters / minute), the total latency from image entry into the system to output of the detection result is strictly controlled within a preset latency threshold of 200 milliseconds, fully meeting the requirements of real-time online detection.
[0054] Example 2 In another specific implementation scenario, for special knitted textiles with high reflectivity or complex embossed textures (such as jacquard fabrics with gold and silver threads), this embodiment further optimizes and adjusts the background texture suppression and image acquisition strategies. The high-resolution industrial camera is configured to support high dynamic range imaging mode, effectively eliminating highlight overflow caused by gold and silver threads by performing two exposures of different lengths at the same physical location and fusing them, while preserving minute morphological features caused by warp breaks or skipped stitches.
[0055] In the above optimization scheme, the adaptive band-stop filter in step 2 introduces an asymmetric frequency response mechanism. Considering the significant difference in weave density between the warp and weft directions in jacquard fabrics, the system extracts local maxima along both the horizontal and vertical axes when calculating the radial energy distribution at the center of the amplitude spectrum, thereby independently determining the warp and weft dominant frequencies. The bandwidth of the filter is set as an independent scaling factor for both directions, that is, the filtering resources are dynamically allocated according to the degree of spectral spread in different directions to achieve accurate stripping of non-uniform texture backgrounds.
[0056] In the above enhancement steps, step 3, the multi-scale Gabor wavelet transform, adds a preprocessing branch for color features. When detecting color cast or color difference defects, the system converts the original image from RGB space to CIE Lab color space, extracts structural features using the L component, and evaluates color uniformity using the a and b components. The nonlinear mapping function employs a piecewise mapping strategy to address the variance of the color components: for regions where the color difference value is within a preset tolerance range, the mapping function remains linear to prevent the introduction of false color fluctuations; for suspected regions exceeding the tolerance range, the mapping function switches to a high-gain mode, significantly widening the numerical distance between the defective color and the standard sample color, making the color cast defect appear as an extremely high brightness value in the feature map.
[0057] In the aforementioned feature extraction process, step 4, for complex embossed textures, expands the local binary pattern features into a multi-scale local binary pattern (MS-LBP). The system simultaneously extracts texture features within circular neighborhoods with radii of 1, 2, and 3 pixels and performs cascaded stitching. This multi-scale descriptive capability effectively distinguishes between normal texture undulations and defects caused by needle damage. The calculation process of the gray-level co-occurrence matrix incorporates rotation invariance correction. By performing four feature extractions at 0 degrees, 90 degrees, 180 degrees, and 270 degrees on the input window and taking their invariant moments, it is ensured that the descriptive performance of the feature vector remains stable even when the fabric experiences slight skew or shaking.
[0058] In the classification and recognition stage described above, step 5 employs a deep residual network optimization strategy based on transfer learning. Due to the scarcity of samples for certain special defects (such as extremely rare weaving faults), the system is first pre-trained on a large-scale general fabric defect dataset to acquire basic texture feature extraction capabilities. Subsequently, by freezing the weights of the first two convolutional layers of the network, targeted training is performed only on the back-end residual blocks and the classification head. During training, a focus loss term is introduced into the loss function, forcing the model to focus on those minute defects that are extremely similar to normal textures by increasing the weight of hard-to-classify samples.
[0059] The defect localization process incorporates a multi-scale feature fusion (FPN) mechanism. The system utilizes not only the high semantic feature map of the final layer but also fuses shallower feature maps with high spatial resolution. Through top-down paths and lateral connections, a prediction map rich in detailed information is generated. Under this architecture, the boundary delineation of elongated defects (such as willow branches and crossbars) is more accurate, and pixel deviation is controlled within 2 pixels.
[0060] In the aforementioned alarm and statistics process, step 6 adds a defect traceability QR code printing function for high-value special fabrics. Whenever a major defect is detected, the system not only records the meterage in the database but also directly prints a QR code containing the defect number and type on the reverse side of the fabric using an online inkjet printer. In the subsequent garment cutting process, the automatic cutting machine can automatically avoid the defective area by scanning the code, achieving a data closed loop across the entire production chain.
[0061] Furthermore, the adaptive learning mechanism in this embodiment is configured as an "expert review mode." Disputed samples in the database are pushed to remote technical experts via a cloud interface, who then make judgments using high-magnification electron microscopy images on a tablet terminal. The judgment results are automatically synchronized to all testing nodes on the production site via an incremental update script, ensuring a high degree of consistency in testing standards across factories and production lines.
[0062] Example 3 In another specific implementation scenario, for high-speed knitting production lines with ultra-wide widths (e.g., 4 meters or more), this embodiment adopts a multi-camera stitching imaging and distributed computing collaboration scheme. Multiple high-resolution industrial cameras are arranged at equal intervals along the width direction, with approximately 5% overlap between the imaging areas of adjacent cameras.
[0063] In the aforementioned data acquisition process, step 1 involves multi-camera spatial calibration. The system employs a high-precision checkerboard calibration board for intrinsic and extrinsic parameter calibration, establishing a mapping relationship between the pixel coordinate systems of each camera and a unified fabric world coordinate system. The trigger signal of the rotary encoder is synchronously transmitted to all cameras via a single-channel differential distributor, ensuring absolute consistency and synchronization of the shutter opening times of each camera. The image stitching thread utilizes a feature point matching algorithm for overlapping areas (such as scale-invariant feature transformation) to dynamically calculate the stitching fusion line, and eliminates physical seams between cameras caused by differences in photosensitive sensitivity through a weighted average fusion algorithm.
[0064] In the texture suppression steps described above, the Fourier transform in step 2 is executed in parallel on the graphics processors of the distributed computing nodes. Each camera's corresponding sub-image stream is allocated to an independent video memory space, and utilizing the parallel acceleration characteristics of the Fast Fourier Transform, a megapixel-level frequency domain conversion is completed within 10 milliseconds. The adaptive band-stop filter dynamically calculates the local mask matrix gain to address the uneven illumination within the field of view of different cameras, ensuring uniform background suppression across the entire image width.
[0065] In the aforementioned feature enhancement process, step 3, the multi-scale Gabor wavelet transform, employs a streaming computation mode. As image data enters the video memory, a pre-set filter kernel is immediately activated for convolution. To reduce video memory usage, the system retains only the maximum response component at each scale. The nonlinear mapping function is implemented using a lookup table, with gain curves pre-calculated based on different fabric types and stored in a cache. When the fabric type changes, the system only needs one clock cycle to update the enhancement strategy.
[0066] In the feature extraction stage described above, the construction of the multidimensional feature vector in step 4 utilizes a vectorized instruction set (such as AVX-512) for acceleration. For the calculation of local binary patterns and information entropy, the system maps image row data into wide vectors for batch processing, improving computational efficiency by more than 8 times compared to traditional pixel-by-pixel traversal. The feature normalization process employs a combination of global statistics and local calibration. By monitoring the mean and standard deviation fluctuations of the full-width image in real time, the normalization parameters are dynamically corrected to compensate for data drift caused by light source attenuation over long periods of operation.
[0067] In the classification and recognition process described above, step 5 employs a lightweight deep residual convolutional neural network (such as ResNet-18 or a MobileNet-V2 residual variant). While maintaining detection accuracy, model parameters are compressed from floating-point numbers to 8-bit fixed-point numbers through model pruning and quantization techniques, significantly reducing computational resource consumption. The classification task is distributed to edge computing gateways, with each gateway handling data streams from 2 to 3 cameras, thus achieving horizontal scaling of detection capabilities.
[0068] In the alarm and statistics steps described above, step 6 integrates Internet of Things (IoT) monitoring functionality. The operating status, real-time detection rate, and defect distribution trend of each inspection server are uploaded to the Enterprise Manufacturing Execution System (MES) via the MQTT protocol. The quality inspection report not only includes information on the current roll pack but also automatically compares historical batch data using big data analysis. When the frequency of a specific defect is found to increase abnormally in a short period of time, the system will automatically issue a process warning, prompting the operator to check whether the mechanical parts of the loom (such as needles and sinkers) are worn or loose.
[0069] This adaptive learning mechanism in a distributed architecture is implemented through a "master-slave learning model." The master model, located on the central server, is responsible for collecting typical samples from all child nodes for full training. After training, the weight parameters are distributed to the execution mechanisms of each child node through the network for local inference. This model ensures both the generalization ability of the model and the real-time response speed of the production site, providing a complete system solution for intelligent inspection in large-scale textile workshops.
[0070] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A visual inspection method for surface defects in knitted textiles, characterized in that, Includes the following steps: By using a high-resolution industrial camera and a strip light-emitting diode light source configured on the production line to work together, during the operation of the textile production line, a rotary encoder installed on the winding mechanism outputs a pulse signal in real time, and uses this pulse signal as a trigger source to drive the high-resolution industrial camera to perform image acquisition, thereby acquiring a continuous original grayscale image that reflects the complex surface morphology of the textile in real time. The original grayscale image is mapped to the frequency domain space through a discrete transformation. In the generated amplitude spectrum image, the characteristic frequency peak points representing the periodic warp and weft structure of the knitted textile are identified using a local search algorithm. An adaptive band-stop filter is constructed based on the energy distribution law of the characteristic frequency peak points. The energy region corresponding to the characteristic frequency peak points is masked using this filter. Then, the processed signal is restored to the spatial domain through an inverse transformation process to obtain a residual image after effectively suppressing the background fabric texture. The residual image is subjected to multi-scale Gabor wavelet transform processing. Multi-dimensional detailed feature information of the surface of the textile is extracted by using a preset filter bank with different scale parameters and orientation parameters. A nonlinear mapping function containing an adaptive gain factor is used to perform contrast enhancement processing on the variance statistical characteristics of different regions in the residual image to improve the visual difference between suspected defective regions and normal tissue regions. A sliding window is constructed on the enhanced image. Local binary mode features, gray-level co-occurrence matrix features, and information entropy features representing the uncertainty of regional information are extracted in the local area covered by each sliding window. The extracted features are then fused and normalized in multiple dimensions to form a multi-dimensional feature vector for describing the physical properties of the defect. The multidimensional feature vector is input into a pre-trained deep residual convolutional neural network model. High-level semantic features are extracted through the multi-layer convolutional processing and residual connection mechanism inside the deep residual convolutional neural network model to identify the specific category attributes of surface defects of textiles. The spatial coordinates of the defects in the original full-frame image are determined by combining the feature map activation region inside the neural network, and the detection result is finally output.
2. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, In the step of acquiring the original grayscale image using a high-resolution industrial camera, the high-resolution industrial camera is equipped with a line-scan complementary metal-oxide-semiconductor sensor, and the line-scan complementary metal-oxide-semiconductor sensor has a predetermined pixel scale. During the acquisition process, the line scanning frequency of the high-resolution industrial camera is set to the corresponding preset working frequency according to the real-time operating speed of the production line, and the object distance between the high-resolution industrial camera and the knitted textile plane is precisely controlled within a predetermined distance range to ensure that a constant spatial resolution is formed in the imaging optical path system, so as to meet the imaging requirements of capturing fiber breaks, damage and weaving noise of a predetermined size.
3. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, The strip-shaped light-emitting diode light source adopts a highly uniform white light source module. The white light source module integrates a constant current drive circuit to ensure that the fluctuation rate of luminous flux is below a predetermined fluctuation threshold during operation. The luminous intensity of the strip-shaped light-emitting diode light source is adjusted to be greater than a preset intensity threshold by a digital dimming device. The installation position of the strip-shaped light-emitting diode light source is calibrated to ensure that the incident angle of the beam forms a preset angle range with the surface of the knitted textile. By utilizing the shadow effect generated on the surface of the knitted textile by oblique illumination, a brightness gradient reflecting defects such as pilling, cotton shedding, or foreign matter is formed in the original grayscale image.
4. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, The rotary encoder rotates synchronously with the textile winding roller via a coupling. The rotary encoder outputs a specific number of pulse signals every predetermined number of rotations. The system acquires the pulse signals in real time through a counting module and establishes a linear mapping relationship between the pulse frequency and the running linear speed of the textile. Based on this linear mapping relationship, the trigger cycle of the high-resolution industrial camera is dynamically adjusted to ensure that the proportions of the acquired original grayscale image remain consistent in the fabric feeding direction and width direction, eliminating longitudinal stretching or compression deformation of the image caused by fluctuations in the production line motor speed or changes in load.
5. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, In the step of constructing the adaptive bandstop filter, the original grayscale image is first divided into image blocks of a predetermined size, and an amplitude spectrum image is obtained through two-dimensional discrete Fourier transform. In the amplitude spectrum image, the system identifies multiple frequency peak points representing the periodic structure of warp and weft yarns, and generates a corresponding mask matrix based on the energy diffusion radius of each frequency peak point. The gain of the mask matrix at the frequency peak points is set to a first predetermined gain value, while the gain in the non-peak point region is set to a second predetermined gain value. The cutoff frequency of the adaptive bandstop filter is adjusted according to the fabric density of the knitted textile. The dominant frequency of the fabric is determined by calculating the local maximum value of the radial energy distribution at the center of the amplitude spectrum, and the filtering bandwidth is set to a predetermined proportional coefficient relative to the dominant frequency.
6. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, In the multi-scale Gabor wavelet transform process, the scale parameters of the filter bank follow a preset power distribution law to capture defect signals of different physical sizes, while the direction parameters are uniformly distributed within a predetermined rotation range at predetermined angle intervals to capture defects with directional characteristics. The system extracts the maximum values of the multi-channel convolution responses at the same spatial location and fuses them into a feature map reflecting the saliency of the defects. In the nonlinear mapping function, the adaptive gain factor is dynamically adjusted according to the variance of the local region of the image. Contrast enhancement processing is performed on smooth regions with variance less than a preset variance threshold, while smoothing suppression processing is performed on regions with variance greater than the preset variance threshold.
7. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, In the steps of extracting local binary pattern features, gray-level co-occurrence matrix features, and information entropy features, the local binary pattern features employ an equivalent pattern operator to map features from the original dimension to the target dimension, thereby describing the microscopic texture roughness information of the defect. The gray-level co-occurrence matrix features include statistical indicators of multiple dimensions such as energy, contrast, correlation, and entropy, and the calculation direction is the average of multiple predetermined directions, with the window step size set to a preset pixel value, to quantify the spatial statistical difference between the defect area and the surrounding normal fabric tissue. The feature normalization process employs a zero-mean unit variance method, which eliminates the dimensional differences between feature terms with different physical meanings, ensuring that each feature has a balanced weight contribution in the subsequent recognition process.
8. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, The deep residual convolutional neural network model includes multiple residual modules consisting of convolutional layers, batch normalization layers, and activation layers, and utilizes a skip connection mechanism to transmit feature information. In the process of identifying category attributes, the end of the deep residual convolutional neural network model uses a normalized exponential function layer to calculate the probability distribution. The judgment logic adopts a dual threshold strategy, that is, when the predicted probability value of a certain defect category is greater than the first preset probability threshold and the predicted probability of the background category is less than the second preset probability threshold, the specific type of defect is confirmed to be detected. For defect types with different hazard levels, the system sets independent judgment thresholds for each by adjusting the cost sensitivity coefficient.
9. The method for visual inspection of surface defects in knitted textiles according to claim 1, characterized in that, In the step of determining the spatial coordinates of the defect in the original full-frame image, the activation distribution of the feature map of the last layer of the deep residual convolutional neural network model is extracted using class activation mapping technology to generate a heatmap representing the decision basis of the model; the heatmap is subjected to binarization thresholding and segmentation, and morphological operations are performed to fill the holes in the region, and then the minimum bounding rectangle of the generated connected region is obtained; using the vertex coordinate information, width and height parameters of the minimum bounding rectangle, the pixel coordinates and corresponding geometric dimensions of the defect in the original full-frame image are calculated.
10. A visual inspection method for surface defects in knitted textiles according to claim 1, characterized in that, After outputting the detection results, the method also includes real-time response and closed-loop optimization steps: when a defect is detected, the system sends an interrupt signal to the programmable logic controller of the production line, drives the audible and visual alarm device to issue an alarm signal, and stores the data containing defect image blocks, defect type, geometric size and location information into a distributed database; the system automatically generates a quality inspection report for each roll of knitted textiles based on the records in the database, and calculates the defect density distribution curve along the fabric length direction within a predetermined unit length range; in addition, the method also involves an adaptive learning mechanism, that is, periodically extracting samples that meet preset conditions from the database, adding them to the training set after manual correction feedback, and using the gradient descent algorithm to perform incremental fine-tuning on the deep residual convolutional neural network model to adapt to knitted textiles of new materials or new patterns.