Fabric defect visual detection method based on fabric visual cognition
By employing a detection method based on fabric visual cognition, multidimensional texture features are extracted and fabric defects are identified using convolutional neural networks and attention mechanisms. Combined with local databases and cloud storage, the accuracy and data continuity issues of fabric defect detection are resolved, enabling the prediction and traceability of quality anomalies. This method is suitable for real-time quality management in textile production.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies for fabric defect detection rely on single or local features, which are difficult to fully characterize the arrangement of warp and weft yarns, the periodicity of texture, and the continuity of local structures. This leads to inaccurate identification of complex or minor defects, incomplete storage and traceability of quality inspection data, and inability to predict quality anomalies in a timely manner.
By constructing a detection method based on fabric visual cognition, we extract the warp and weft arrangement direction features, texture periodicity features, and local structural continuity features. We use a fabric visual cognition model with convolutional neural networks and attention mechanisms to identify defects. By combining local databases and cloud storage mechanisms, we achieve continuous storage and synchronization of defect detection results. We also construct a time-series feature analysis model for quality risk prediction.
It achieves high-precision identification and location of fabric defects, ensures continuous storage and traceability of quality inspection data, can continuously save data in a network-free environment, and predicts quality anomaly risks through time-series analysis, supporting the generation and management of batch-level quality inspection correlation data.
Smart Images

Figure CN121724973A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of textile production and quality control, and particularly relates to a fabric defect visual detection method based on fabric visual cognition. BACKGROUND
[0002] With the continuous improvement of the automation level of the textile industry, the fabric production speed and batch continue to grow, and the fabric quality management is facing increasingly severe challenges. The traditional manual quality inspection method has problems such as low inspection efficiency, unstable detection accuracy, and defect identification depending on experience, and is difficult to meet the requirements of high efficiency, high precision, and continuous monitoring in modern textile production.
[0003] In the prior art, some enterprises use a fabric defect detection method based on image processing, which obtains a fabric surface image and performs edge detection, texture analysis, template matching and other operations to identify fabric defects. However, there are still problems such as limited defect feature representation, low recognition rate, and insufficient data storage and analysis.
[0004] Therefore, the prior art cannot meet the needs of real-time, accurate, and continuous defect detection and quality management of large-scale and high-speed fabric production lines, and a fabric defect visual detection method is needed that can integrate multi-dimensional texture features, automatically identify defect types, support local storage and cloud synchronization, and combine production environment data for time series analysis. SUMMARY
[0005] The present application provides a fabric defect visual detection method based on fabric visual cognition, which is used to solve the problem of relying only on single features or local features in the prior art, lack of comprehensive representation of fabric warp and weft yarn arrangement, texture periodicity and local structure continuity, difficulty in accurately identifying complex or small defects, and inability to completely store and trace quality inspection data, thereby causing the problem of being unable to timely predict fabric quality abnormalities.
[0006] In view of the above problems, the present application provides a fabric defect visual detection method based on fabric visual cognition.
[0007] The application provides a fabric defect visual detection method based on fabric visual cognition, which comprises the following steps: collecting fabric surface image data in the fabric production process, and performing standardization pretreatment on the fabric surface image data to generate standardized fabric surface image data; based on the standardized fabric surface image data, extracting the warp and weft arrangement direction feature, the texture periodicity feature and the local structure continuity feature of the fabric, and constructing a texture structure feature for representing normal fabric texture distribution; inputting the texture structure feature into a fabric visual cognition fabric visual cognition model, analyzing the fabric surface texture structure by the fabric visual cognition fabric visual cognition model, identifying abnormal areas deviating from the normal texture structure feature, and generating fabric defect candidate areas; performing defect feature decoding and semantic analysis on the fabric defect candidate areas, identifying the corresponding fabric defect type, determining the position, size and confidence information of the fabric defect type on the fabric surface, and obtaining a fabric defect detection result; storing the fabric defect detection result and the corresponding fabric surface image data in a local database, supporting continuous storage of more than a preset number of quality inspection image data and defect labeling information in a state without network connection; after the detection equipment is connected with the network, based on an incremental synchronization mechanism, synchronizing the newly generated or updated quality inspection data in the local database to a cloud server; based on historical quality inspection data at least comprising the fabric defect detection result and production environment data, constructing a time sequence feature analysis model, predicting the quality abnormal risk of the fabric under the current production environment condition, and when the predicted risk exceeds a preset threshold, generating corresponding quality risk warning information and prevention control suggestions; associating the fabric defect detection result with corresponding production batch information, process single information and production process information, generating batch-level quality inspection association data, and synchronizing the batch-level quality inspection association data to a production management module and a quality management module.
[0008] The one or more technical solutions provided in the application have at least the following technical effects or advantages: One or more technical solutions provided in the application, around the actual problems of difficult to accurately detect defects in the fabric production process, difficult to continuously store data, difficult to identify quality risks in advance, and difficult to trace quality problems, a complete, implementable and engineering applicable fabric defect visual detection and quality analysis technology system is constructed. Through high-frequency image acquisition on the continuously running fabric surface on the fabric production line, and unified standardized preprocessing of the collected fabric surface image data, the consistency of the input data in time sequence, spatial position, size resolution and illumination condition is ensured, providing a stable data basis for subsequent analysis. On this basis, the application extracts the warp and weft yarn arrangement direction features, texture periodicity features and local structure continuity features, and models the normal texture distribution of the fabric in multiple dimensions and structures, avoiding the problem of incomplete texture representation caused by relying only on single features or local features in the prior art. Further, a fabric visual cognitive fabric visual cognitive model based on convolutional neural network and attention mechanism is constructed, which analyzes the fabric surface texture structure through hierarchical coding, feature fusion and anomaly analysis, so as to stably identify the abnormal areas deviating from the normal texture structure in the continuous production scene, and output the standardized fabric defect candidate region data structure. For the above candidate region, the application also decodes and analyzes the pixel-level and region-level features, and encodes the defect features in tensor and semantics, and then obtains the fabric defect detection results containing defect type, position, size and confidence information, realizes the standardized description and unified output of defect information. In terms of data management, a local database is established on the detection equipment side, and the fabric surface image data and the corresponding fabric defect detection results are structured and continuously stored, and through the cycle and incremental storage mechanism, the quality inspection data can still be saved continuously under the condition of no network connection, avoiding the problem of data loss in the continuous production process. After the detection equipment and the network are connected, the incremental synchronization mechanism is used to synchronize the newly generated or updated quality inspection data in the local database to the cloud server, realizing the consistency maintenance and centralized management of local and cloud data. On this basis, the application further integrates historical fabric defect detection results and production environment data to construct a time series feature analysis model to predict the quality abnormal risk of the fabric under the current production environment, providing data support for quality risk early warning and subsequent control strategy. At the same time, by associating the fabric defect detection results with the production batch information, process single information and production process information, batch-level quality inspection associated data is generated and synchronized to the production management module and quality management module, realizing batch-level and process-level traceability analysis of fabric quality problems.In summary, this application, through the systematic design of key aspects such as fabric defect detection, data storage and synchronization, time-series analysis, and quality traceability, effectively solves the problems in existing technologies such as incomplete fabric defect characterization, unstable detection results, difficulty in continuously storing quality inspection data, difficulty in predicting quality risks, and difficulty in tracing quality issues. It forms a fabric defect visual inspection and quality management technology solution suitable for actual production environments. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a schematic diagram of a fabric defect visual detection method based on fabric visual cognition, provided in an embodiment of this application. Detailed Implementation
[0011] This application provides a fabric defect visual detection method based on fabric visual cognition to address the problem that existing technologies rely on only single or local features, lacking a comprehensive representation of the fabric's warp and weft yarn arrangement, texture periodicity, and local structural continuity. This makes it difficult to accurately identify complex or minute defects, resulting in incomplete storage and traceability of quality inspection data, and consequently, the inability to predict fabric quality anomalies in a timely manner. This application constructs a standardized fabric surface image dataset and simultaneously extracts features of the fabric's warp and weft arrangement direction, texture periodicity, and local structural continuity to achieve a comprehensive representation of the fabric's texture structure. By establishing a fabric visual cognition model, high-dimensional feature encoding, spatial neighborhood analysis, and deviation detection are performed on the texture structure features to identify candidate regions for fabric defects. Through a defect feature decoding and semantic analysis module, pixel-level and region-level feature extraction, semantic encoding, and defect classification are performed on the candidate regions to determine defect type, location, and size, and generate a defect detection result tensor. A joint storage mechanism combining a local database and a cloud server is used to encapsulate, index, and incrementally synchronize the detection results and fabric surface image data, achieving continuous storage in offline environments and data synchronization after networking. A time-series feature analysis model based on historical quality inspection data and production environment data is constructed, including a Long Short-Term Memory (LSTM) network and an attention mechanism module, to predict quality anomalies in the fabric under current and future production environment conditions and generate early warning information and prevention and control suggestions. By associating fabric defect detection results with production batch information, process sheet information, and production process information, process-level traceability analysis of batch-level quality inspection data is achieved, and the association results are synchronized to the production management module and quality management module, thereby achieving the technical effects of rapid identification, precise location, traceability management, and potential risk prediction of defects during fabric production.
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0013] It should be noted that any variation of the terms "comprising" and "having" is intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0014] Examples, such as Figure 1As shown, this application provides a method for visual detection of fabric defects based on fabric visual cognition, the method comprising: S100: Collect fabric surface image data during the fabric production process, and perform standardized preprocessing on the fabric surface image data to generate standardized fabric surface image data.
[0015] Furthermore, step S100 of this application also includes: During the fabric production process, an image acquisition device images the continuously transported fabric surface at a preset acquisition frequency to obtain raw fabric surface image data. The raw fabric surface image data is then timestamped and spatially aligned to form a sequence of fabric surface image data arranged in the fabric's running direction, which will be used for subsequent processing. This sequence is then cropped, scaled, and resampled to ensure that each frame of fabric surface image data meets preset size and resolution parameters. The fabric surface image data, after size and resolution unification processing, undergoes brightness correction, contrast adjustment, and grayscale normalization to generate fabric surface image data with consistent illumination. Finally, the fabric surface image data with consistent illumination is subjected to noise suppression processing and encapsulated according to a preset data format to output standardized fabric surface image data.
[0016] Specifically, during the fabric production process, image acquisition devices deployed on the production line image the continuously moving fabric surface at a preset acquisition frequency, acquiring raw fabric surface image data. For example, an industrial camera with a resolution of 2048×2048 pixels can be used, with the acquisition speed matched to the fabric's running speed to ensure image continuity and integrity. The raw fabric surface image data is then timestamped and spatially aligned to form an image data sequence arranged according to the fabric's running direction, which serves as the object for subsequent processing. Timestamping ensures a precise correspondence between the image data and the fabric's running speed and production batch; spatial alignment eliminates errors caused by image acquisition position offsets. The fabric surface image data sequence is then cropped, scaled, and resampled to ensure that each frame meets preset size and resolution parameters. For example, the image can be cropped to 1024×1024 pixels and resampled using bilinear interpolation to ensure image consistency across different acquisition devices. Finally, the image data, after size and resolution unification processing, undergoes brightness correction, contrast adjustment, and grayscale normalization to generate fabric surface image data with consistent illumination. This step can employ histogram equalization or adaptive contrast enhancement algorithms to reduce the impact of ambient lighting variations on subsequent texture feature extraction. Noise suppression processing is applied to image data with consistent lighting, and the data is encapsulated according to a preset data format to output standardized fabric surface image data. For example, Gaussian filtering or median filtering can be used for noise suppression, and the image data is encapsulated into multi-channel tensors or binary formats supported by the database for easy storage, retrieval, and model input. This achieves continuous acquisition, standardization processing, and data encapsulation of fabric surface images, providing high-quality input data for subsequent fabric texture feature extraction, defect identification, and quality management, ensuring data consistency and reliability in the visual inspection process of fabric defects.
[0017] S200. Based on the standardized fabric surface image data, extract the warp and weft arrangement direction features, texture periodicity features, and local structural continuity features of the fabric to construct texture structure features for characterizing the normal fabric texture distribution.
[0018] Furthermore, step S200 of this application also includes: Edge detection and directional gradient analysis are performed on the standardized fabric surface image data in the warp and weft yarn arrangement directions to generate warp and weft arrangement direction feature data. Frequency domain transformation analysis is performed on the standardized fabric surface image data to calculate the local texture repetition period and generate texture periodicity feature data. Local regions are divided into the standardized fabric surface image data, and the continuity of adjacent pixel arrangement and yarn arrangement is analyzed to generate local structural continuity feature data. The generated warp and weft direction feature data, texture periodicity feature data, and local structural continuity feature data are structurally combined to output fabric texture structure feature data for subsequent fabric defect identification.
[0019] Specifically, the standardized fabric surface image data undergoes edge detection and directional gradient analysis along the warp and weft yarn arrangement directions to generate warp and weft arrangement direction feature data. For example, the Sobel edge detection algorithm can be used to calculate the gradients in the horizontal and vertical directions, thereby generating a directional gradient map of the yarn arrangement direction to represent the warp and weft arrangement structure of the fabric. Frequency domain transformation analysis is performed on the standardized fabric surface image data to calculate the local texture repetition period, generating texture periodicity feature data. Specific methods may include performing a two-dimensional fast Fourier transform (2D-FFT) on local image blocks, analyzing the spectral peak positions and amplitudes to obtain yarn periodicity and texture repetition feature information. Local regions are divided into the standardized fabric surface image data, and the continuity of adjacent pixel arrangement and yarn arrangement is analyzed to generate local structural continuity feature data. For example, the image can be divided into fixed-size image blocks, and a feature matrix representing local structural continuity is formed by calculating pixel intensity variations and local directional consistency within the blocks. The generated warp and weft direction feature data, texture periodicity feature data, and local structural continuity feature data are then structurally combined to output fabric texture structure feature data for subsequent fabric defect identification. For example, the three types of features can be concatenated into a multidimensional feature vector or tensor in a preset order and saved as a data format that the model can directly input. This enables multidimensional feature extraction and structured combination of fabric surface texture, which can comprehensively characterize the warp and weft arrangement direction, texture periodicity, and local continuity of the fabric. This provides high-quality, structured input for the subsequent defect candidate region identification of the fabric visual cognition model, thereby improving the accuracy and reliability of defect identification.
[0020] S300. Input the texture structure features into the fabric visual cognition model. The fabric visual cognition model analyzes the texture structure of the fabric surface, identifies abnormal areas that deviate from the normal texture structure features, and generates candidate areas for fabric defects.
[0021] Furthermore, step S300 of this application also includes: S301: Establish a fabric visual cognition model, which is constructed based on a convolutional neural network (CNN) and a self-attention mechanism. The model includes an input module, an encoding module, a feature fusion module, an anomaly detection module, a boundary adjustment and merging module, and an output module. The input and output dimensions and connection methods of each module are defined. S302: Initialize the weights and bias parameters of different functional modules in the fabric visual cognition model. Specifically, the convolutional layer parameters in the encoding module are initialized using pre-trained weights from a CNN, while the parameters of the remaining modules are randomly initialized to generate initial model parameters. S303: Batch and tensorize the texture structure features to form input data that meets the requirements of model training and inference. S304: Input the input tensor data into the model encoding module, and through convolution... The process involves: S305: Extracting local high-dimensional texture features through layered convolution and introducing an attention module onto the convolutional features. This attention module employs an existing attention mechanism structure, including a channel attention module and a spatial attention module, to enhance the representation of key local region features and generate a local texture feature tensor; S306: Performing spatial neighborhood analysis on the local texture feature tensor in the feature fusion module to generate a local region texture consistency tensor; S307: Calculating the deviation of each local region from the standard texture pattern through the output layer to generate a preliminary anomalous region tensor; S308: Adjusting and merging the boundaries of adjacent preliminary anomalous regions based on the preliminary anomalous region tensor to generate a fused anomalous region and two-dimensional or three-dimensional coordinates, forming a standardized candidate region data structure; S309: Outputting the standardized candidate region data structure as a fabric defect candidate region, which then serves as the input for subsequent defect feature decoding and recognition processing.
[0022] Specifically, a fabric visual cognition model is established, based on a convolutional neural network (CNN) and a self-attention mechanism. The model architecture includes an input module, an encoding module, a feature fusion module, an anomaly detection module, a boundary adjustment and merging module, and an output module. The input module accepts structured texture feature tensors. The encoding module includes multiple convolutional layers (3×3 kernel size, 1 stride, padding to preserve size) and the ReLU activation function. Each convolutional layer is followed by a batch normalization layer to normalize the feature distribution. An attention module, including channel attention and spatial attention, is also embedded in the encoding module to highlight key texture region features. The feature fusion module performs weighted fusion of multi-scale convolutional outputs to generate a unified high-dimensional feature representation. The anomaly detection module calculates the deviation probability of each local region from the standard texture pattern through fully connected layers and a sigmoid activation function. The boundary adjustment and merging module fuses adjacent anomaly regions. The output module uses the generated two-dimensional or three-dimensional candidate region coordinates as input for subsequent defect identification. The weights and bias parameters of each module are randomly initialized and initialized using pre-trained weights from the convolutional neural network to form the initial model parameters. Key hyperparameters in the model include the number of convolutional kernels (16–128), the number of convolutional layers (3–6), the number of attention heads (4–8), the learning rate (0.0001–0.001), and the batch size (16–64). Hyperparameter selection is optimized based on fabric texture complexity and experimental validation. Texture structure features are batch-processed and tensor-processed to form input tensor data that meets the requirements of model training and inference. The tensor dimension is consistent with the model input module and includes batch, channel, height, and width information. This input tensor data is input to the encoding module, where convolutional layers extract high-dimensional local texture features. The attention module performs channel and spatial weighting on the convolutional features to generate a local texture feature tensor. In the feature fusion module, spatial neighborhood analysis and multi-scale fusion are performed on the local texture feature tensor to generate a texture consistency tensor. The convolutional features are multi-channel local texture response feature tensors formed by the input texture structure feature tensor after computation by the convolutional layers in the encoding module. The anomaly detection module calculates the deviation of each local region from the standard texture pattern through the output layer, generating an initial anomaly region tensor. The boundary adjustment and merging module fuses adjacent anomaly regions to generate a standardized candidate region data structure, including two-dimensional or three-dimensional coordinate information. This standardized candidate region data structure is output as the fabric defect candidate region for subsequent defect feature decoding and recognition. Data sources: Publicly available fabric defect datasets (such as TILDA) and enterprise-built fabric image datasets are used, covering various fabric types and defect categories, with an image resolution of 1024×1024 pixels. Data preprocessing includes cropping, scaling, normalization, grayscale normalization, and data augmentation (rotation, flipping, and adding noise).Loss Function: A joint loss function is used, including a weighted combination of defect classification cross-entropy loss and localization mean square error loss, with weights set to 0.7:0.3 based on experimental verification. Optimization Algorithm: The Adam optimizer is used with an initial learning rate of 0.001, employing a learning rate decay strategy and gradient clipping. Training Strategy: The training, validation, and test sets are divided in a 7:2:1 ratio, with a batch size of 32 and 100 training epochs. An early stopping strategy is used to prevent overfitting. Hyperparameter Tuning: The optimal configuration for the number of convolutional kernels, attention heads, and hidden units is determined through grid search and cross-validation. The fabric visual cognition model discloses in detail the feature extraction, attention weighting, anomaly detection, and candidate region generation processes for fabric surface texture structure. Combined with training data, loss functions, and optimization strategies, it ensures that those skilled in the art can implement the model. To verify the technical solution of the fabric visual cognition model proposed in this application, this embodiment was experimentally tested in a real fabric production environment. The experimental data includes 10,000 images of fabric surfaces from various fabric types (such as cotton, polyester, and blended fabrics) and their manually labeled defect information, covering different defect types such as loose threads, broken yarns, color differences, and stains. Defect recognition accuracy: By comparing the fabric visual cognition model with traditional image processing methods (edge detection, texture analysis, and template matching) and standard convolutional neural network (CNN) defect recognition methods, our method achieves an accuracy of 94.7% for small defects and 92.3% for complex texture defects, significantly higher than the 78.5% and 73.2% of traditional methods, and 88.1% and 85.6% of standard CNN methods, respectively. Defect localization accuracy: Using two-dimensional pixel coordinates to evaluate defect positions, our method has an average localization error of 1.8 pixels, while the standard CNN method has an average error of 3.5 pixels, and the traditional image processing method has an average error of 5.2 pixels, demonstrating that fabric visual cognition has high accuracy in local defect localization. Candidate region fusion and boundary adjustment effects: After the initial abnormal region is generated, boundary adjustment and fusion processing are performed to improve the overlap (IoU) between the candidate defect region and the actual defect boundary. The Union (Union) score reached an average of 0.87, higher than the standard CNN's 0.79 and the traditional method's 0.68, indicating that the model is significantly effective in identifying and fusing abnormal regions. The model's adaptability to complex textures was demonstrated; under various fabric texture conditions, including dense weave, patterned, and blended textures, the method could generate reasonable texture structure feature representations and correctly identify regions deviating from the standard texture pattern, verifying the model's strong adaptability to complex texture defects. Regarding data storage and synchronous verification, in a continuous production environment, the method can store over 1,200 quality inspection images and corresponding defect annotations in a local database, and incrementally upload the data to the cloud after networking, ensuring data integrity and continuity, proving the feasibility of the system architecture and model collaboration.In summary, through comparative experiments and multi-index verification with existing technologies, the fabric visual cognition model proposed in this application outperforms traditional methods in terms of defect identification accuracy, positioning accuracy, candidate region fusion, adaptability to complex textures, and data storage synchronization, demonstrating the feasibility and superiority of the technical solution.
[0023] S400. Defect feature decoding and semantic analysis are performed on the candidate areas of fabric defects to identify the corresponding fabric defect types, and the location, size and confidence information of the fabric defect types on the fabric surface are determined to obtain the fabric defect detection results.
[0024] Furthermore, step S400 of this application also includes: The candidate regions for fabric defects are simultaneously subjected to pixel-level and region-level feature extraction, including shape, edge, texture, and color features. These features are then tensorized to generate a defect feature tensor. This defect feature tensor is input into a semantic analysis module, which employs existing semantic coding structures, including convolutional encoders, fully connected encoders, and attention mechanism encoders, to encode the defect-related features in the defect feature tensor, generating a defect semantic representation tensor. Based on this defect semantic representation tensor, a classifier and decoder module are used to identify the corresponding fabric defect type and calculate the defect's location and size information on the fabric surface. Confidence scores are calculated for the defect type and location information to form a fabric defect detection result tensor.
[0025] Specifically, the original pixel matrix of each fabric defect candidate region undergoes multi-channel processing, including red, green, and blue channels, as well as an optional grayscale channel. At the pixel level, local features such as edges, texture, grayscale gradient, and color contrast are extracted using convolutional kernels (e.g., 3×3 or 5×5 convolution). At the region level, the candidate region is divided into several sub-regions, and the shape, area, orientation, aspect ratio, texture consistency, and relative positional relationship between regions are calculated for each sub-region. The pixel-level and region-level features are combined in a unified order to form a three-dimensional or four-dimensional tensor, where the first dimension is the candidate region sequence index, the second dimension is the feature type, and the third dimension is the spatial location index (an optional fourth dimension is the color channel). Tensor quantization can employ standardization methods (such as Min-Max normalization or Z-score normalization) to ensure consistency in the dimensions of different features, facilitating subsequent semantic analysis processing. The defect feature tensor is input into the semantic analysis module. The semantic analysis module adopts an existing semantic coding structure, including: a convolutional encoder: performing multi-layer convolution processing on the input tensor, followed by batch normalization and non-linear activation functions (such as ReLU or Leaky ReLU) after each convolution layer to extract high-dimensional local features; a fully connected encoder: unfolding the convolution output into a vector, inputting it into a multi-layer fully connected network to generate a global feature representation; and an attention mechanism encoder: applying channel attention and spatial attention mechanisms to the convolutional or fully connected features to enhance the weights of key local region features and suppress redundant information. The output is a defect semantic representation tensor, where each dimension corresponds to the latent feature representation and spatial information encoding of the defect type. The defect semantic representation tensor is input into the classifier module. The classifier uses a multi-layer fully connected network or a lightweight convolutional network to map the tensor into discrete defect categories, such as broken yarn, color difference, stains, and loose threads. Simultaneously, the defect semantic representation tensor is input into the decoder module. The decoder can use a deconvolution or upsampling network to output the two-dimensional or three-dimensional position coordinates and size information (length, width, and height) of the defect within the candidate region. The classifier and decoder modules can share intermediate feature layers to improve recognition accuracy and computational efficiency. The output results include the category identifier, position information, and size information of each defect instance, forming a multi-dimensional defect parameter matrix. For each identified defect instance, a confidence value is calculated, which can be achieved using softmax output probability or a normalization method based on classifier output logits. The defect type, location, size, and confidence information are combined into a fabric defect detection result tensor, with the following structure: First dimension: candidate region index; Second dimension: defect instance index; Third dimension: defect type, location coordinates, size, and confidence. The result tensor can be directly used for subsequent quality inspection data storage, production process traceability analysis, or quality risk prediction modules.This application can simultaneously utilize pixel-level and region-level features to perform high-precision decoding of fabric defects, achieving accurate identification of both minor and complex defects. Experimental data shows that for defects such as broken yarns, color differences, and minor stains, the classification accuracy of this method on the standard test set can exceed 95%, with position and size errors controlled within ±2 pixels. The confidence output can be used to automatically screen low-confidence samples for manual verification.
[0026] S500: Store the fabric defect detection results and corresponding fabric surface image data in a local database. In the absence of a network connection, it supports the continuous storage of a preset number or more quality inspection image data and their defect labeling information.
[0027] Furthermore, step S500 of this application also includes: A local database is established in the testing equipment, defining the database table structure, including an image data table, a defect detection result table, and a defect annotation information table. The fabric defect detection results and corresponding fabric surface image data are encapsulated according to a preset data format to form storable data units. The storable data units are written into the corresponding tables in the local database, and the writing timestamp and data index are recorded. In the absence of a network connection, newly added quality inspection data is cyclically stored according to a preset quantity limit, and incremental writing is supported to form continuous storage management. An index is established for the stored data in the local database, and a data query interface is provided.
[0028] Specifically, a relational or lightweight database (such as SQLite, MySQL, or PostgreSQL) is deployed as local storage in the inspection equipment. The database table structure is defined, including: an image data table storing the file path, image ID, acquisition timestamp, and image resolution information of the fabric surface image; a defect detection result table storing the unique identifier of the fabric defect detection result tensor, the corresponding image ID, defect type, location, size, and confidence level information; and a defect annotation information table storing manually annotated or automatically generated defect labels, annotation time, annotator, or algorithm version information. The table structure supports primary keys, foreign keys, and index settings to ensure data relevance and query efficiency. The fabric defect detection result tensor and corresponding image data are encapsulated to form storable data units. Image data can be in a compressed format (such as PNG or JPEG) and stored as a binary large object (BLOB). The defect detection result tensor can be serialized into JSON or Protobuf format for easy storage, transmission, and parsing. During the encapsulation process, a unique identifier, acquisition timestamp, and batch information are added to each data unit to ensure data traceability. The encapsulated data units are written to the corresponding database tables. A timestamp and data index are automatically generated for each written record for sorting and subsequent retrieval. Write operations support transaction management to ensure consistency and prevent data corruption. Write buffers and batch commit strategies can be configured to improve continuous storage efficiency. In the absence of a network connection, newly added quality inspection data is stored cyclically according to a preset maximum quantity. When the storage limit is reached, the oldest data is overwritten according to the FIFO (First-In, First-Out) principle to ensure controllable local database capacity. Incremental write mechanisms are supported, writing only newly added or updated data to avoid duplicate storage. Data version numbers and batch numbers can be maintained to ensure traceability of historical data during cyclic overwriting. Multi-dimensional indexes, including image ID indexes, defect type indexes, and timestamp indexes, are established for the image data table, defect detection result table, and defect annotation information table in the local database to improve query performance. A standardized data query interface is provided, supporting data retrieval based on conditions such as image ID, defect type, collection time range, and batch number. The query interface returns complete image and defect information, which can be directly used for quality inspection backtracking, report generation, or uploading to the cloud. It can continuously record more than a preset amount of fabric quality inspection data in a network-free environment, while supporting cyclic overwrite and incremental write management to ensure data integrity and traceability. The establishment of index and query interfaces enables subsequent defect analysis, batch tracking and quality management modules to efficiently access local storage data, realizing close linkage between quality inspection data and production management.
[0029] S600. After the testing equipment establishes a connection with the network, based on the incremental synchronization mechanism, the newly generated or updated quality inspection data in the local database is synchronized to the cloud server.
[0030] Furthermore, step S600 of this application also includes: The testing equipment establishes a network connection with the cloud server and confirms the availability of the communication link; it extracts newly added or updated quality inspection data since the last synchronization from the local database, including fabric defect detection result tensors, fabric surface image data, and defect annotation information, forming a data set to be synchronized; it packages and converts the data set to be synchronized to generate synchronization data units that meet the requirements of the cloud server; it uploads the synchronization data units to the cloud server through the established network connection and records the transmission timestamp and status information; after the receiving end confirms that the synchronization data units have been completely received, it records the synchronization status and time in the local database, completing incremental synchronization management.
[0031] Specifically, after detecting that a wired or wireless network has become available again, the detection equipment actively initiates a communication request with the cloud server; a stable connection is established through communication protocols such as TCP / IP, HTTPS, or MQTT, and identity verification and session initialization are completed; after the connection is established, the availability and stability of the communication link are confirmed by sending heartbeat packets or test requests; the subsequent incremental synchronization process is triggered only when the link status meets the preset availability conditions to avoid data transmission failure due to network instability. Quality inspection data added or updated since the last synchronization completion time is read from the local database; the quality inspection data includes: fabric defect detection result tensors; corresponding fabric surface image data; defect annotation information associated with the defect area; the data is filtered by timestamp, synchronization status flag, or version number field, extracting only unsynchronized or updateable data; the filtered data is organized into a set of data to be synchronized to reduce redundant data transmission and improve synchronization efficiency. The data sets to be synchronized are uniformly packaged into standardized synchronization data units. Image data can be compressed and encoded, while defect detection result tensors and annotation information can be serialized into JSON, XML, or binary structured data formats. Device identifiers, data batch numbers, synchronization serial numbers, and verification information are appended to each synchronization data unit for cloud data parsing and consistency verification. The generated synchronization data units meet the cloud server's interface protocol and data reception specifications. The synchronization data units are uploaded to the cloud server via an established network connection. During data transmission, the start time, end time, and transmission result status are recorded in real time. If transmission interruption or failure occurs, a resume or retry mechanism can be supported based on the recorded synchronization serial number to avoid data loss. After receiving the synchronization data unit, the cloud server verifies the data integrity and returns confirmation information. Upon receiving complete confirmation information from the cloud server, the synchronization status of the corresponding quality inspection data is updated in the local database. The synchronization completion time and cloud confirmation identifier are recorded as the data benchmark for the next incremental synchronization. A completion marker is set for successfully synchronized data to ensure it is not uploaded repeatedly during subsequent synchronization processes. This completes one incremental synchronization management process. This application enables incremental synchronization of only newly added or updated fabric quality inspection data in the local database after network recovery, significantly reducing communication bandwidth consumption and improving synchronization efficiency. Simultaneously, through a synchronization status recording and confirmation mechanism, it ensures the consistency and integrity of local and cloud data, providing a reliable data foundation for subsequent cloud-based quality analysis, batch traceability, and cross-device collaborative management.
[0032] S700. Based on historical quality inspection data including at least the fabric defect detection results and production environment data, a time-series feature analysis model is constructed to predict the quality anomaly risk of the fabric under the current production environment conditions. When the predicted risk exceeds a preset threshold, corresponding quality risk warning information and prevention and control suggestions are generated.
[0033] Furthermore, step S700 of this application also includes: S701: Obtain historical quality inspection data from local databases and cloud servers, including fabric defect detection result tensors, and acquire corresponding production environment data to form a time series dataset; S702: Perform missing value processing, normalization, and timestamp alignment on the time series dataset to generate standardized time series feature data; S703: Extract key features from the standardized time series feature data based on fabric production characteristics and historical defect distribution, and construct an input feature matrix for model training and prediction; S704: Based on the input feature matrix, construct a time series feature analysis model, including a recurrent neural network (RNN) and a long short-term memory (LSTM) network. The model includes an attention mechanism module, and defines the model input layer, hidden layer, output layer, and connection method; S705: The time-series feature analysis model is trained using historical quality inspection data and production environment data. The training method adopts existing deep learning training algorithms, including forward propagation, loss calculation, and backpropagation. After training, the model parameters are incrementally updated using new data to generate trained model parameters; S706: The current production environment data and corresponding features are input into the trained time-series feature analysis model to generate quality anomaly prediction data, including prediction indicators and confidence levels, and output as input for subsequent risk warning information and prevention and control suggestions.
[0034] Specifically, historical quality inspection data is read from local databases and cloud servers. This historical quality inspection data includes at least: tensors of fabric defect detection results corresponding to different time points; defect type, defect quantity, defect area ratio, and confidence level information; and synchronously acquired production environment data corresponding to the time period of the quality inspection data, including but not limited to: workshop temperature, humidity, and noise levels; equipment operating speed, tension parameters, and production batch identifiers. Using timestamps as indexes, the historical quality inspection data and production environment data are correlated chronologically to form a multi-dimensional time series dataset, providing basic data support for subsequent time series modeling. The time series dataset undergoes a completeness check; for missing data points, linear interpolation, forward imputation, or methods based on historical means are used to fill in missing values; normalization or standardization processing is performed on feature data of different dimensions to ensure that each feature value is distributed within a uniform numerical range; the timestamps of the historical quality inspection data and production environment data are aligned using time window segmentation or resampling to ensure that feature data within the same time step has a consistent time reference; after processing, standardized time series feature data with a unified structure and consistent scale is generated for subsequent feature extraction and model input. Based on the characteristics of fabric production processes and the historical distribution patterns of defects, key features highly correlated with quality anomalies are selected from standardized time-series feature data. These key features include at least: the trend of defect occurrence frequency over time; the correlation between defect types and production environment parameters; and the degree of defect accumulation and fluctuation within a continuous time window. The extracted key features are combined into an input feature matrix according to a preset time step and feature dimensions. This input feature matrix is used for training and prediction of the subsequent time-series feature analysis model. Based on the input feature matrix, a time-series feature analysis model is constructed. The model includes: a model input layer for receiving the input feature matrix; at least one hidden layer of a recurrent neural network (RNN) or long short-term memory network (LSTM) for learning temporal dependencies; an attention mechanism module to weight the feature contributions at different time steps to highlight key time segments that significantly influence quality anomaly prediction; and a model output layer for outputting quality anomaly prediction indicators and corresponding confidence levels. The connection methods, data flow, and parameter dimensions between each layer are clearly defined to ensure the model structure is feasible and reproducible. The training data used to build and train the time-series feature analysis model comes from historical quality inspection data and production environment data collected during long-term operation of the fabric production site. Specifically, it includes: historical fabric defect detection result tensors output by the fabric defect detection module; production environment parameter data corresponding to the timestamps of each defect detection result, including temperature, humidity, equipment operating speed, tension parameters, and batch identification information; the data can come from historical storage data in local databases and cloud servers, and are matched one-to-one by timestamps.Before inputting the data into the model, the following preprocessing steps are performed on the training data: time window segmentation, where the continuous time series is segmented into sliding windows with a fixed time step (e.g., 10–60 seconds), with each window serving as a training sample; missing value handling, where missing values in environmental parameters or quality inspection data are filled in using linear interpolation or the previous time step; numerical normalization, where each feature dimension is normalized using Min-Max normalization or Z-score standardization to ensure that feature values of different dimensions are distributed within a uniform scale range; and feature concatenation, where defect features and environmental parameter features within the same time window are concatenated in a preset order to form a multidimensional input feature sequence. After preprocessing, a standardized temporal feature matrix that can be directly input into the neural network model is generated. The temporal feature analysis model adopts a temporal modeling structure of "LSTM + attention mechanism," which includes the following network layers: an input layer, where the input is a temporal feature matrix of shape (T×F), where T represents the time step length and F represents the number of feature dimensions. The first temporal modeling layer (LSTM layer) employs at least one Long Short-Term Memory (LSTM) network. Each time step receives the hidden state from the previous time step and the current input features. The LSTM uses a Sigmoid activation function to control the gate structure, and a Tanh activation function to update the memory cell states. The second temporal modeling layer (optionally stacked LSTM) can be layered on top of the hidden states output from the first LSTM layer to enhance temporal representation. Fully connected layers connect the various LSTM layers. The attention mechanism layer calculates attention weights for the hidden states at each time step output from the LSTM. A weighted summation method is used to highlight key time steps that contribute significantly to quality anomaly prediction. The attention weights are normalized using the Softmax function. The fully connected output layer inputs the attention-fused feature vectors into the fully connected layer. The fully connected layer uses the ReLU activation function for non-linear mapping. The output layer generates the predicted quality anomaly values and their corresponding confidence scores. During model training, regression or classification loss functions are employed, specifically: mean squared error (MSE) loss is used when the predicted output is a quality anomaly risk score; cross-entropy loss is used when the predicted output is an anomaly probability. Weight coefficients can be introduced into the loss function to assign higher penalty weights to high-risk samples, thereby improving the model's sensitivity to severe quality anomalies. Model parameter optimization utilizes the Adam optimization algorithm; the initial learning rate is set based on the training data size, with an optimal range of 0.0001–0.01; during training, the learning rate is gradually reduced using a decay strategy based on changes in the validation set error; and parameters are updated using mini-batch gradient descent to improve training stability.The key hyperparameters of the model include: time step length T: set according to the fabric production cycle and defect formation period, with an optimal range of 10–100; number of LSTM hidden units: set according to the feature dimension and sample size, with an optimal range of 32–256; batch size: set according to the device's computing power, with an optimal range of 16–128; number of training epochs: dynamically adjusted according to the convergence situation, with an optimal range of 50–300. Each hyperparameter is selected through cross-validation or historical data experiments and dynamically adjusted during training based on the model's convergence speed and prediction error. Through the above network architecture and parameter design, the temporal feature analysis model constructed in this application can effectively learn the temporal correlation between fabric defect evolution and changes in the production environment. While ensuring the model's feasibility and reproducibility, it achieves stable prediction of fabric quality anomaly risks, significantly improving the accuracy and reliability of quality risk warnings. The time-series feature analysis model is trained offline using historical quality inspection data and corresponding production environment data. The training process includes: forward propagation calculation of the predicted output; calculation of the loss function based on the predicted results and actual defect conditions; iterative optimization of the model parameters using a backpropagation algorithm; and incremental training to update the model parameters after initial training when new quality inspection and production environment data are acquired. This method enables the model to continuously adapt to changes in the production environment, improving the stability and accuracy of quality risk prediction. Current production environment data and its corresponding feature vectors are input into the trained time-series feature analysis model. The model outputs quality anomaly prediction data, including: the probability of quality anomaly occurrence or risk score; and the confidence information of the prediction results. This prediction data is used as input to the quality risk early warning module and the prevention and control suggestion generation module to trigger subsequent risk warnings and process adjustment decisions. This application fully utilizes the temporal correlation characteristics of historical quality inspection data and production environment data to achieve early prediction of fabric quality anomaly risks. This solution not only enhances the foresight and initiative of quality management but also effectively reduces the risk of batch quality problems caused by fluctuations in the production environment, providing reliable technical support for intelligent fabric production and quality control.
[0035] S800: Associate the fabric defect detection results with the corresponding production batch information, process sheet information and production process information to generate batch-level quality inspection association data, and synchronize the batch-level quality inspection association data to the production management module and the quality management module.
[0036] Furthermore, step S800 of this application also includes: The system retrieves fabric defect detection result tensors from local databases and cloud servers, along with corresponding production batch information, process sheet information, and production process information. It then standardizes and encodes these data units to generate standardized data units. These standardized data units are then linked according to production batch and process sequence to generate batch-level quality inspection associated data. The batch-level quality inspection associated data is encapsulated to form synchronizeable data units. These synchronizeable data units are uploaded to the production management module and quality management module, and synchronization timestamps and status information are recorded. After the receiving end confirms complete reception of the batch-level quality inspection associated data, the synchronization status and time are recorded in the local database.
[0037] Specifically, the fabric defect detection results are correlated with batch information, process sheet information, and production procedure information during the production process to form batch-level quality inspection correlation data. This batch-level quality inspection correlation data is then synchronized to the production management module and the quality management module. The process includes the following steps: The detection equipment reads fabric defect detection result tensors from both the local database and the cloud server. These tensors include defect type identifiers, defect location coordinates, defect size parameters, and confidence level information. Simultaneously, the equipment obtains production batch information, process sheet information, and production procedure information corresponding to the timestamp of the fabric defect detection results through the production data interface. The production batch information includes at least a batch number and production start and end times; the process sheet information includes at least a process parameter number and parameter set; and the production procedure information includes at least a procedure number and procedure sequence identifier. The acquired fabric defect detection result tensor, production batch information, process sheet information, and production process information undergo unified data format conversion processing, and various data are organized according to a preset field structure. Character fields are encoded and mapped, numerical fields are type-normalized, and time-related fields are standardized to a timestamp format, thereby generating standardized data units containing defect feature fields, batch fields, process fields, and process fields. These standardized data units are grouped according to production batch numbers, and within each production batch, corresponding data units are sorted according to the production process sequence. Standardized data units arranged in the same production batch and by process sequence are linked and integrated to form batch-level quality inspection associated data containing batch identifiers, process information, process sequence, and corresponding fabric defect detection results. The generated batch-level quality inspection associated data is structurally encapsulated, and synchronizeable data units are generated according to a preset data transmission format. Each synchronizeable data unit includes header information and data body information. The header information includes at least the batch number, data version number, and data length identifier, and the data body information includes the corresponding batch-level quality inspection associated data content. Through the established system communication interface, the synchronizeable data units are sent to the production management module and the quality management module. During data transmission, the transmission timestamp, target module identifier, and transmission status information of each synchronizeable data unit are recorded, and this information is written to the synchronization record table in the local database. After receiving data reception confirmation information from the production management module and the quality management module, it is determined that the batch-level quality inspection associated data has been completely received. After confirming successful reception, the synchronization status field of the corresponding batch-level quality inspection associated data is updated in the local database, and the final synchronization completion time is recorded, thus completing the synchronization management process of batch-level quality inspection associated data.
[0038] In summary, the embodiments of this application have at least the following technical effects: This application constructs a complete technical process encompassing fabric surface image acquisition, texture structure feature extraction, fabric defect candidate region identification, defect feature decoding and semantic analysis, local data storage and incremental synchronization, temporal feature analysis, and batch-level quality inspection correlation, achieving systematic and structured processing for fabric defect detection and quality management. By jointly modeling the fabric's warp and weft arrangement characteristics, texture periodicity, and local structural continuity, the normal distribution of fabric surface texture can be stably represented, providing a reliable data foundation for subsequent abnormal region identification. By introducing a fabric visual cognition model to encode, fuse, and analyze texture structure features, automatic localization of regions deviating from the normal texture structure is achieved, outputting them in the form of a standardized candidate region data structure, ensuring consistency in spatial location and data representation of defect candidate regions. Based on these candidate regions, defect feature decoding and semantic analysis enable a unified representation of defect type, location, size, and confidence information in a tensor-based manner, facilitating subsequent storage, statistical analysis, and processing. Meanwhile, this application establishes a local database on the testing equipment side and introduces a circular storage and incremental writing mechanism, enabling continuous storage of fabric defect detection results and corresponding image data even without a network connection, thus avoiding data loss under continuous production operation conditions. After network recovery, the incremental synchronization mechanism reliably synchronizes locally added or updated quality inspection data to the cloud server, achieving consistent data management. This application performs time-series processing on historical quality inspection data and production environment data to construct a time-series feature analysis model, predicting the risk of quality anomalies under current production environment conditions, extending quality analysis from post-event detection to pre-event prediction. Furthermore, by associating fabric defect detection results with production batch information, process sheet information, and production process information, batch-level quality inspection correlation data is generated, enabling unified application of quality inspection results in the production management module and quality management module. In summary, this application constructs a fabric defect detection and quality analysis technology system based on a fabric visual cognition model. This system organically combines standardized acquisition of fabric surface images, multi-dimensional joint representation of texture structure features, automatic identification of abnormal areas, defect feature decoding and semantic analysis, local continuous storage and incremental synchronization of quality inspection data, and time-series analysis based on historical quality inspection data and production environment data. It effectively solves the problems of existing technologies that rely only on single or local features for fabric defect detection, have insufficient ability to identify complex or minor defects, are prone to data loss under network-free or continuous production conditions, and lack forward-looking prediction and batch-level traceability analysis of quality risks. It achieves comprehensive technical effects such as standardized expression of fabric defect detection results, structured defect location and classification information, full-process traceability of quality inspection data, and predictable quality anomaly risks.
[0039] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.
[0040] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0041] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and modifications fall within the scope of this application and its equivalents, this application intends to include such modifications and modifications.
Claims
1. A method for visual inspection of fabric defects based on fabric visual cognition, characterized in that, include: S100. Collect fabric surface image data during the fabric production process, and perform standardized preprocessing on the fabric surface image data to generate standardized fabric surface image data. S200. Based on the standardized fabric surface image data, extract the warp and weft arrangement direction features, texture periodicity features, and local structural continuity features of the fabric to construct texture structure features for characterizing the normal fabric texture distribution. S300. Input the texture structure features into the fabric visual cognition model, and the fabric visual cognition model analyzes the texture structure of the fabric surface, identifies abnormal areas that deviate from the normal texture structure features, and generates fabric defect candidate areas. S400. Defect feature decoding and semantic analysis are performed on the candidate areas of fabric defects to identify the corresponding fabric defect types, and the location, size and confidence information of the fabric defect types on the fabric surface are determined to obtain the fabric defect detection results. S500: Store the fabric defect detection results and the corresponding fabric surface image data in a local database. In the absence of a network connection, it supports the continuous storage of a preset number or more quality inspection image data and their defect labeling information. S600. After the testing equipment establishes a connection with the network, based on the incremental synchronization mechanism, the newly generated or updated quality inspection data in the local database is synchronized to the cloud server. S700. Based on historical quality inspection data including at least the fabric defect detection results and production environment data, a time-series feature analysis model is constructed to predict the quality abnormality risk of the fabric under the current production environment conditions. When the predicted risk exceeds a preset threshold, corresponding quality risk warning information and prevention and control suggestions are generated. S800: Associate the fabric defect detection results with the corresponding production batch information, process sheet information and production process information to generate batch-level quality inspection association data, and synchronize the batch-level quality inspection association data to the production management module and the quality management module.
2. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, Collect fabric surface image data during the fabric production process, and perform standardized preprocessing on the fabric surface image data to generate standardized fabric surface image data, including: During the fabric production process, an image acquisition device is used to image the surface of the continuously conveyed fabric at a preset acquisition frequency to obtain the original fabric surface image data. The original fabric surface image data is time-stamped and spatially aligned to form a sequence of fabric surface image data arranged in the direction of fabric movement, which will be used for subsequent processing. The fabric surface image data sequence is cropped, scaled, and resampled to ensure that each frame of fabric surface image data meets the preset size and resolution parameters. Brightness correction, contrast adjustment and grayscale normalization are performed on the fabric surface image data after the size and resolution are unified to generate fabric surface image data with consistent lighting. The fabric surface image data with consistent illumination is subjected to noise suppression processing and encapsulated according to a preset data format to output standardized fabric surface image data.
3. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, Based on the standardized fabric surface image data, the warp and weft arrangement direction features, texture periodicity features, and local structural continuity features of the fabric are extracted to construct texture structure features for characterizing the normal fabric texture distribution, including: Edge detection and directional gradient analysis of the warp and weft yarn arrangement directions are performed on the standardized fabric surface image data to generate warp and weft arrangement direction feature data. Frequency domain transformation analysis is performed on the standardized fabric surface image data to calculate the local texture repetition period and generate texture periodic feature data. The standardized fabric surface image data is divided into local regions, and the continuity of adjacent pixel arrangement and yarn arrangement is analyzed to generate local structural continuity feature data. The generated warp and weft direction feature data, texture periodicity feature data, and local structural continuity feature data are structurally combined to output fabric texture structure feature data for subsequent fabric defect identification.
4. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, The texture structure features are input into the fabric visual perception model, which analyzes the fabric surface texture structure, identifies abnormal regions that deviate from normal texture structure features, and generates candidate regions for fabric defects, including: S301. Establish a fabric visual cognition model. The fabric visual cognition model is constructed based on a convolutional neural network (CNN) and a self-attention mechanism. It includes an input module, an encoding module, a feature fusion module, an anomaly detection module, a boundary adjustment and merging module, and an output module. The input and output dimensions and connection methods of each module are defined. S302. For different functional modules in the fabric visual cognition model, initialize their weights and bias parameters respectively. Specifically, initialize the parameters of the convolutional layer in the encoding module using pre-trained weights of the convolutional neural network, and initialize the parameters of the other modules using random initialization to generate initial model parameters. S303. Batch and tensor the texture structure features to form input data that meets the requirements of model training and inference; S304. Input the input tensor data into the encoding module of the model, extract local high-dimensional texture features through convolutional layers, and introduce an attention module on the convolutional features. The attention module adopts the existing attention mechanism structure, including a channel attention module and a spatial attention module, to enhance the feature representation of key local regions and generate local texture feature tensors. S305. In the feature fusion module, spatial neighborhood analysis is performed on the local texture feature tensor to generate a local region texture consistency tensor. S306. Calculate the degree of deviation between each local region and the standard texture pattern through the output layer to generate a preliminary abnormal region tensor; S307. Based on the tensor of the preliminary anomaly region, the boundaries of adjacent preliminary anomaly regions are adjusted and merged to generate a fused anomaly region and two-dimensional or three-dimensional coordinates, forming a standardized candidate region data structure. S308. The standardized candidate region data structure is output as the fabric defect candidate region and used as the input for subsequent defect feature decoding and recognition processing.
5. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, The candidate regions for fabric defects are subjected to defect feature decoding and semantic analysis to identify the corresponding fabric defect types. The location, size, and confidence level of each defect type on the fabric surface are determined to obtain the fabric defect detection results, including: Pixel-level and region-level feature extractions are performed simultaneously on the candidate regions of fabric defects, including shape, edge, texture and color features, and the features are tensorized to generate a defect feature tensor. The defect feature tensor is input into the semantic analysis module. The module uses an existing semantic encoding structure, including a convolutional encoder, a fully connected encoder, and an attention mechanism encoder, to encode the defect-related features in the defect feature tensor and generate a defect semantic representation tensor. Based on the defect semantic representation tensor, the corresponding fabric defect type is identified using a classifier and decoder module, and the location and size information of the defect on the fabric surface are calculated. Calculate the confidence level for the defect type and location information to form a fabric defect detection result tensor.
6. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, The fabric defect detection results and corresponding fabric surface image data are stored in a local database. Even without a network connection, the database supports the continuous storage of a preset number or more quality inspection image data and their defect annotation information, including: Establish a local database in the detection equipment and define the database table structure, including an image data table, a defect detection result table, and a defect annotation information table; The fabric defect detection results and the corresponding fabric surface image data are encapsulated according to a preset data format to form a storable data unit. Write the storable data unit into the corresponding table in the local database, and record the writing timestamp and data index; In the absence of network connection, newly added quality inspection data is stored cyclically according to a preset quantity limit and incremental writing is supported to form continuous storage management. Index the stored data in the local database and provide a data query interface.
7. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, After the testing equipment establishes a connection with the network, based on the incremental synchronization mechanism, newly generated or updated quality inspection data in the local database are synchronized to the cloud server, including: The testing equipment establishes a network connection with the cloud server and confirms the availability of the communication link; Extract newly added or updated quality inspection data from the local database since the last synchronization, including fabric defect detection result tensors, fabric surface image data and defect annotation information, to form a data set to be synchronized; The data set to be synchronized is packaged and its format converted to generate synchronized data units that meet the requirements of the cloud server. The synchronized data unit is uploaded to the cloud server through the established network connection, and the transmission timestamp and status information are recorded. After the receiving end confirms that the synchronization data unit has been fully received, it records the synchronization status and time in the local database to complete incremental synchronization management.
8. The fabric defect visual detection method based on fabric visual cognition as described in claim 1, characterized in that, Based on historical quality inspection data and production environment data, including at least the fabric defect detection results, a time-series feature analysis model is constructed to predict the quality anomaly risk of the fabric under the current production environment conditions. When the predicted risk exceeds a preset threshold, corresponding quality risk warning information and prevention and control suggestions are generated, including: S701. Obtain historical quality inspection data from local databases and cloud servers, including fabric defect detection result tensors, and obtain corresponding production environment data to form a time series dataset; S702. Perform missing value processing, normalization, and timestamp alignment on the time series dataset to generate standardized time series feature data; S703. Based on the fabric production characteristics and historical defect distribution, extract key features from the standardized time-series feature data and construct an input feature matrix for model training and prediction. S704. Based on the input feature matrix, construct a time-series feature analysis model, including a recurrent neural network (RNN), a long short-term memory network (LSTM), and an attention mechanism module, and define the model's input layer, hidden layer, output layer, and connection method. S705. The time-series feature analysis model is trained using historical quality inspection data and production environment data. The training method adopts existing deep learning training algorithms, including forward propagation, loss calculation and back propagation. After training, the model parameters are incrementally updated using new data to generate trained model parameters. S706. Input the current production environment data and corresponding features into the trained time series feature analysis model to generate quality anomaly prediction data, including prediction indicators and confidence levels, and output them as input for subsequent risk warning information and prevention and control suggestions.
9. The fabric defect visual detection method based on fabric visual cognition as described in claim 5, characterized in that, The fabric defect detection results are correlated with the corresponding production batch information, process sheet information, and production process information to generate batch-level quality inspection correlation data. This batch-level quality inspection correlation data is then synchronized to the production management module and the quality management module, including: The fabric defect detection result tensor is obtained from the local database and cloud server, and the corresponding production batch information, process sheet information and production process information are obtained. The tensor of the fabric defect detection results, production batch information, process sheet information and production process information are formatted and encoded to generate standardized data units; Standardized data units are linked according to production batches and process sequences to generate batch-level quality inspection linked data; The batch-level quality inspection data is encapsulated to form synchronized data units; The synchronizeable data unit is uploaded to the production management module and the quality management module, and the synchronization timestamp and status information are recorded. After the receiving end confirms that the batch-level quality inspection data has been received completely, it records the synchronization status and time in the local database.
Citation Information
Cited By
Intelligent Industrial Quality Inspection Methods and Systems Based on Lightweight Edge Computing
CN122390580B