A method and system for intelligent classification and identification of silk patterns

By employing hierarchical preprocessing and an improved convolutional neural network model, the problems of low efficiency, low accuracy, and poor interpretability in silk pattern classification and recognition are solved, achieving efficient and accurate intelligent classification of silk patterns, which is suitable for applications in multiple fields.

CN122176371APending Publication Date: 2026-06-09ZHEJIANG SCI-TECH UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG SCI-TECH UNIV
Filing Date
2026-03-02
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies for silk pattern classification and recognition suffer from low efficiency, low accuracy, strong dependence on labeled data, insufficient generalization ability, poor interpretability of results, and difficulty in handling image blurring, loss of detail, and noise.

Method used

Layered preprocessing is employed to improve image quality, and an improved convolutional neural network model is constructed. By combining the Transformer attention mechanism and linear discriminant analysis regularization constraints, the dataset construction and model training strategies are optimized. Grad-CAM visualization technology and a secondary recognition mechanism are introduced for post-processing optimization.

Benefits of technology

It achieves efficient and high-precision classification and recognition of silk patterns, improves the generalization ability of the model and the interpretability of the classification results, ensures the accuracy and standardization of the recognition results, and supports multiple image acquisition methods and data storage operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176371A_ABST
    Figure CN122176371A_ABST
Patent Text Reader

Abstract

The application provides a silk pattern intelligent classification and recognition method and system, and belongs to the technical field of silk pattern recognition and computer vision. The method comprises the following steps: step 1, obtaining a silk pattern original image and performing layered pretreatment to improve the image quality and obtain a standardized pattern image; step 2, constructing an improved convolutional neural network model based on ResNet, embedding a Transformer attention mechanism module and a linear discriminant analysis regular constraint, and adopting a self-supervised pre-training initialization model; step 3, constructing a silk pattern labeling data set and performing pretreatment and data enhancement; and step 4, training the improved convolutional neural network model to obtain a classification and recognition model. The application solves the problems of low recognition accuracy, strong dependence on labeling data and poor result interpretability in the prior art, realizes efficient, high-precision and interpretable intelligent classification and recognition of silk patterns, and has good practicability and popularization value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention provides a method and system for intelligent classification and recognition of silk patterns, belonging to the field of silk pattern recognition and computer vision technology. Background Technology

[0002] Silk patterns are an important carrier of traditional Chinese culture, containing rich historical, artistic, and craft value, and are widely used in textiles and clothing, cultural heritage protection, and cultural and creative product development. The classification and identification of silk patterns is a core prerequisite for achieving digital archiving, intelligent retrieval, and large-scale application of patterns. Traditional classification and identification methods mainly rely on manual identification, which is not only inefficient and labor-intensive, but also susceptible to the experience level and subjective judgment of the appraisers, resulting in problems such as inconsistent classification standards, low identification accuracy, and difficulty in adapting to large-scale pattern processing.

[0003] Based on the above, the inventors discovered that: With the development of computer vision and deep learning technologies, image classification methods based on convolutional neural networks (CNNs) have been gradually applied to the field of silk pattern recognition, improving recognition efficiency to some extent. However, existing technologies still have many shortcomings: on the one hand, the original images of silk patterns are easily affected by shooting angle, lighting conditions, and fabric texture, resulting in blurred images, loss of details, and excessive noise. Existing preprocessing methods cannot balance improving clarity with preserving original colors and details, thus affecting subsequent feature extraction and classification accuracy. On the other hand, traditional CNN models can only effectively extract local texture features of patterns, making it difficult to capture the complex global texture relationships in silk patterns. Furthermore, model training is highly dependent on a large amount of labeled pattern data, resulting in insufficient generalization ability and low discrimination for similar patterns (such as different types of floral patterns and bird patterns). In addition, existing methods lack interpretability of classification results and post-processing optimization mechanisms, which can easily lead to abnormal recognition results and fail to meet the high accuracy and high reliability requirements of practical applications.

[0004] Therefore, in view of this, we study and improve the existing structure, and propose a method and system for intelligent classification and recognition of silk patterns to solve the above-mentioned problems. Summary of the Invention

[0005] To address the problems of low efficiency, low accuracy, strong dependence on labeled data, insufficient generalization ability, and poor interpretability of results in existing silk pattern classification and recognition technologies, this invention provides a method for intelligent classification and recognition of silk patterns. By improving image quality through layered preprocessing, enhancing feature extraction capabilities through improved convolutional neural network models, optimizing dataset construction and model training strategies, and improving the classification, recognition, and post-processing workflow, this invention achieves intelligent, efficient, and high-precision classification and recognition of silk patterns.

[0006] To address the aforementioned problems, the present invention proposes a method for intelligent classification and recognition of silk patterns, comprising the following steps: Step 1: Obtain the original image of the silk pattern and perform layered preprocessing on the original image. The layered preprocessing includes: firstly, using a bicubic interpolation algorithm based on nonlocal mean optimization to perform super-resolution enhancement on the original image, eliminating image noise and improving the clarity of pattern details; then, performing color space conversion on the enhanced image, converting the RGB color space to the HSV color space, separating the color channel and the brightness channel, and performing adaptive histogram equalization on the brightness channel to preserve the original color features of the silk pattern while enhancing the contrast of the pattern outline; finally, performing size normalization and normalization processing on the processed image to obtain a standardized pattern image, solving the problem of low classification accuracy caused by blurry silk pattern images and loss of details in the existing technology. Step 2: Construct an improved convolutional neural network model. This improved model is based on the ResNet framework and incorporates a Transformer attention mechanism module and linear discriminant analysis (LDA) regularization constraints. Specifically, a Transformer attention mechanism module is embedded between the residual blocks of the ResNet to capture global texture association features of silk patterns, overcoming the limitation of traditional CNNs that can only extract local features. A high-level feature layer close to the output layer of the ResNet is selected, and LDA-based regularization constraints are applied to the features of this layer, reducing the intra-class distance and increasing the inter-class distance of the pattern features, thus improving feature discriminancy. Simultaneously, a self-supervised pre-training method is used to initialize the model. Pre-training tasks such as image rotation prediction and pattern mosaic reconstruction reduce the dependence on a large amount of labeled pattern data, improving the model's generalization ability. Step 3: Construct a silk pattern annotation dataset. The dataset includes images of various types of silk patterns, covering common patterns such as floral patterns, bird patterns, cloud patterns, and geometric patterns. After performing the hierarchical preprocessing described in Step 1 on the images in the dataset, it is divided into a training set, a validation set, and a test set. Data augmentation techniques are used to expand the training set. The data augmentation techniques include random cropping, horizontal flipping, slight rotation, and Gaussian noise addition to avoid model overfitting. Step 4: Input the preprocessed training set into the improved convolutional neural network model, and use the mini-batch-based stochastic gradient descent method to train the model. Adjust the model parameters in real time through the validation set, including the convolutional kernel size, attention weights, regularization coefficients and learning rate, until the model converges and the trained silk pattern classification and recognition model is obtained. Step 5: Input the silk pattern image to be classified into Step 1 for hierarchical preprocessing to obtain a standardized image to be identified. Then, input the standardized image into the trained classification and recognition model. The model outputs the pattern category and category confidence of the image to be identified. At the same time, it outputs a heatmap of pattern feature recognition through Grad-CAM visualization technology to achieve interpretability of classification results. If the category confidence is lower than the preset threshold, a secondary recognition mechanism is activated to extract local pattern features of the image to be identified and compare them with similar patterns in the dataset to output auxiliary recognition results. Step 6: Post-process and optimize the classification and recognition results. Combining the texture correlation and category features of silk patterns, eliminate abnormal recognition results, cluster and integrate similar patterns, and output the final silk pattern classification and recognition results and detailed category descriptions to complete the intelligent classification and recognition of silk patterns.

[0007] Furthermore, in step 1, the non-local mean optimized bicubic interpolation algorithm specifically involves: firstly, using the bicubic interpolation algorithm to perform preliminary super-resolution processing on the original image, and then using non-local mean filtering to optimize the noise reduction of the interpolated image. The similarity weight between each pixel in the image and its neighboring pixels is calculated, and the denoised pixel value is obtained by weighted averaging based on the similarity weights, thus balancing image clarity and noise suppression effect. The similarity weights are calculated using a Gaussian kernel function, and the standard deviation of the kernel function is adaptively adjusted according to the image noise intensity.

[0008] Furthermore, in step 2, the Transformer attention mechanism module is embedded between the third and fourth residual groups of the ResNet. This module includes a multi-head attention layer, a layer normalization layer, and a fully connected layer. The multi-head attention layer is used to capture the global texture association of silk patterns at different scales, the layer normalization layer is used to stabilize the model training process, and the fully connected layer is used to integrate attention features and output an enhanced pattern feature map.

[0009] Furthermore, in step 2, the expression for the linear discriminant analysis criterion is trace(Sb) / trace(Sw), where trace(•) represents the trace of the matrix, Sb represents the inter-class scatter matrix of the pattern features, and Sw represents the intra-class scatter matrix of the pattern features. By applying this regularization constraint to the high-level feature layer, the weighted sum of the linear discriminant analysis loss and the model classification loss is used as the total loss function, thereby improving the model's ability to distinguish similar silk patterns.

[0010] Furthermore, in step 4, during model training, the learning rate adopts a cosine annealing decay strategy, with the initial learning rate set to 0.001, the mini-batch size set to 32, and the number of iterations preset to 100-200. When the classification accuracy of the validation set does not improve for 10 consecutive iterations, model training is stopped, and the current optimal model parameters are saved to avoid model overfitting and training redundancy.

[0011] Furthermore, in step 5, the preset threshold is set to 0.85, and the secondary recognition mechanism is as follows: extract the local pattern features of the image to be recognized, use Euclidean distance to calculate the similarity between the local features and the typical features of various patterns in the dataset, select the top 3 pattern categories with the highest similarity as auxiliary recognition results, and output the similarity values ​​of each auxiliary category for user reference and verification.

[0012] Furthermore, in step 6, the criteria for eliminating abnormal identification results are as follows: when the category confidence of the same image to be identified by the model is lower than a preset threshold, and the highest similarity value of the second identification is lower than 0.7, it is determined to be an abnormal identification result and is eliminated; the K-means clustering algorithm is used for the clustering and integration of similar patterns. Clustering is performed based on the similarity of pattern features, and the clustered similar patterns are classified into the same category, and a unified category identifier and feature description are output.

[0013] Furthermore, it includes an image acquisition module, a hierarchical preprocessing module, a model building and training module, a classification and recognition module, a post-processing optimization module, and a data storage module; The image acquisition module is used to acquire the original image of the silk pattern. It supports three acquisition methods: camera shooting, scanner scanning and image file import. The acquired original image is then transmitted to the layered preprocessing module. The layered preprocessing module is used to receive the original image transmitted by the image acquisition module, perform the layered preprocessing operation described in step 1, transmit the obtained standardized pattern image to the classification and recognition module, and transmit the preprocessed image to the data storage module for saving. The model building and training module is used to build the improved convolutional neural network model described in step 2, receive the labeled dataset from the data storage module, perform the dataset processing and model training operations described in steps 3-4, store the trained classification and recognition model parameters to the data storage module, and transmit the model calling instruction to the classification and recognition module. The classification and recognition module is used to receive the standardized pattern image transmitted by the hierarchical preprocessing module and the model call instruction transmitted by the model construction and training module, call the trained classification and recognition model, execute the classification and recognition operation described in step 5, output the preliminary classification and recognition results and feature heatmap, and transmit them to the post-processing optimization module. The post-processing optimization module is used to receive the preliminary classification and recognition results and feature heatmap transmitted by the classification and recognition module, execute the post-processing optimization operation described in step 6, remove abnormal recognition results, cluster and integrate similar patterns, output the final classification and recognition results, and transmit the final results to the data storage module for storage. The data storage module is used to store the original silk pattern image, the preprocessed standardized image, the silk pattern annotation dataset, the parameters of the improved convolutional neural network model, the preliminary classification and recognition results, and the final classification and recognition results, and supports data query, modification and export operations.

[0014] Furthermore, in step 1, the size normalization process uniformly adjusts the image to 224×224 pixels. The normalization process adopts the Z-Score standardization method to calculate the mean and standard deviation of the image pixel grayscale values, and transforms the pixel values ​​to the [-1,1] interval to eliminate the influence of pixel value magnitude differences on model training.

[0015] Furthermore, in step 3, the ratio of the training set, validation set, and test set is 7:2:1. During the data augmentation process, the cropping size of the random cropping is 192×192 pixels, the angle of slight rotation is between -15° and 15°, and the variance of Gaussian noise is set to 0.01-0.03 to ensure that the augmented data can still retain the core features of the silk pattern.

[0016] Due to the adoption of the above technical solution, the beneficial effects of the intelligent classification and recognition method and system for silk patterns of the present invention are as follows: 1. This invention effectively solves the problems of blurred silk pattern images, loss of detail, and excessive noise in existing technologies through a layered preprocessing process: It adopts a bicubic interpolation algorithm based on nonlocal mean optimization to achieve synergistic optimization of super-resolution enhancement and denoising, which improves the clarity of pattern details while avoiding noise amplification; It enhances contour contrast while preserving the original color features through HSV color space conversion and adaptive histogram equalization of the brightness channel; Combined with size normalization and Z-Score standardization, it eliminates the influence of image differences on model training, laying the foundation for subsequent high-precision classification and recognition.

[0017] 2. The improved convolutional neural network model constructed in this invention breaks through the limitations of traditional CNNs: by embedding the Transformer attention mechanism module in the ResNet basic framework, it can effectively capture the global texture association features of silk patterns, making up for the deficiency of traditional CNNs that can only extract local features; by introducing linear discriminant analysis regularization constraints, it significantly improves the intra-class clustering and inter-class discrimination of pattern features, enhancing the model's ability to recognize similar patterns; and by using a self-supervised pre-training method to initialize the model, it greatly reduces the dependence on a large amount of labeled data, improves the model's generalization ability and training efficiency, and is suitable for scenarios where labeled data is scarce.

[0018] 3. This invention further improves model performance through scientific dataset construction and model training strategies: It constructs a labeled dataset covering a variety of common silk patterns, and combines data augmentation techniques such as random cropping and horizontal flipping to effectively avoid model overfitting; it adopts a mini-batch-based stochastic gradient descent method and a cosine annealing learning rate decay strategy, and uses real-time parameter tuning on the validation set to ensure that the model converges quickly and reaches optimal performance, significantly improving training efficiency and model accuracy.

[0019] 4. This invention introduces Grad-CAM visualization technology and a secondary recognition mechanism to achieve interpretability and high reliability of classification results: the core pattern features identified by the model are displayed intuitively through heatmaps, which facilitates user verification and traceability; secondary comparison is initiated for low-confidence recognition results to output auxiliary recognition information and reduce the probability of misjudgment; combined with the post-processing optimization process, abnormal results are eliminated and similar patterns are clustered and integrated to ensure the accuracy and standardization of the output results and meet the needs of practical applications.

[0020] 5. The system modules of this invention are clearly divided and have complete functions. It supports multiple image acquisition methods and data storage, query and export operations. It can realize the full-process automated processing of silk patterns from image acquisition, preprocessing, classification and recognition to result output, which greatly improves classification and recognition efficiency and reduces labor costs. It can be widely used in many fields such as silk cultural heritage protection, textile product design, and cultural and creative development, and has good practicality and promotion value. Attached Figure Description

[0021] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating the overall system workflow of a method and system for intelligent classification and recognition of silk patterns according to the present invention.

[0022] Figure 2 This diagram illustrates the layered preprocessing steps of a method and system for intelligent classification and recognition of silk patterns according to the present invention.

[0023] Figure 3 This is a flowchart of the improved CNN model training process for a method and system for intelligent classification and recognition of silk patterns according to the present invention.

[0024] Figure 4 This is a flowchart illustrating the classification, recognition, and post-processing of a method and system for intelligent classification and recognition of silk patterns according to the present invention. Detailed Implementation

[0025] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Example

[0026] A method for intelligent classification and recognition of silk patterns specifically includes the following steps: Step 1: Layered preprocessing of the original silk pattern image We acquired 1,000 original images of each of four common silk patterns—floral, bird, cloud, and geometric—using three methods: high-definition camera shooting, scanner scanning, and image file import, for a total of 4,000 original images. The image resolutions covered various specifications, including 1024×768 and 1280×960. Some images had slight blurring, noise, and uneven lighting issues.

[0027] The original image undergoes layer-by-layer preprocessing, as follows: (1) Super-resolution enhancement and denoising: A bicubic interpolation algorithm based on nonlocal mean optimization is adopted. First, the original image is subjected to preliminary super-resolution processing to uniformly enhance the image resolution to 2048×1536 pixels. Then, the interpolated image is denoised and optimized by nonlocal mean filtering. The similarity weight between each pixel and all pixels in the 3×3 neighborhood is calculated. The similarity weight is calculated using the Gaussian kernel function. The standard deviation of the kernel function is adaptively adjusted according to the image noise intensity (the noise intensity is calculated by the variance of the image gray value. The larger the variance, the larger the standard deviation is set, ranging from 0.5 to 2.0). The denoised pixel value is obtained by weighted averaging according to the similarity weight, thus achieving a balance between sharpness and noise suppression.

[0028] (2) Color space conversion and contrast enhancement: The super-resolution enhanced RGB image is converted to HSV color space, and the H (hue), S (saturation) color channels and V (luminance) channels are separated. Adaptive histogram equalization is applied to the V channel, the number of histogram bins is set to 256, the cropping limit is 0.02, and the contrast of the pattern outline is enhanced. The H and S channels remain unchanged to ensure that the original color characteristics of the silk pattern are preserved. After processing, the HSV image is converted back to RGB image.

[0029] (3) Standardization processing: Size normalization is used to uniformly adjust the processed image to 224×224 pixels to avoid the impact of size difference on model training; Z-Score standardization method is used to calculate the mean μ and standard deviation σ of gray values ​​of all pixels in the image, and the formula x'=(x-μ) / σ is used to convert all pixel values ​​to the range of [-1,1] to eliminate the difference in pixel value magnitude and obtain a standardized pattern image.

[0030] Step 2: Construction of the Improved Convolutional Neural Network Model Based on the ResNet50 framework, an improved convolutional neural network model is constructed, with the following specific improvements: (1) Embedding of Transformer attention mechanism module: The Transformer attention mechanism module is embedded between the 3rd residual group (conv4_x) and the 4th residual group (conv5_x) of ResNet50. This module includes a multi-head attention layer (the number of attention heads is set to 8), a layer normalization layer and a fully connected layer. The input of the multi-head attention layer is the feature map output by conv4_x (size is 14×14×1024). By calculating the attention weights at different positions of the feature map, global texture association features are captured. After integration by the layer normalization and the fully connected layer, the enhanced feature map is output (size is kept at 14×14×1024) and fed into conv5_x for further feature extraction.

[0031] (2) Adding regularization constraints for linear discriminant analysis: Select the high-level feature layer of ResNet50 close to the output layer (the feature layer output by conv5_x, with a size of 7×7×2048), and apply regularization constraints based on the linear discriminant analysis criterion to the features of this layer. The expression of the linear discriminant analysis criterion is trace(Sb) / trace(Sw), where Sb is the inter-class scatter matrix and Sw is the intra-class scatter matrix. The linear discriminant analysis loss and the cross-entropy classification loss are weighted and summed in a weight ratio of 0.3:0.7, which is used as the total loss function of the model to reduce the intra-class feature distance and increase the inter-class feature distance.

[0032] (3) Model self-supervised pre-training initialization: The model is initialized using self-supervised pre-training. The pre-training tasks include image rotation prediction (randomly rotating the image by 0°, 90°, 180°, and 270°, and letting the model predict the rotation angle) and pattern mosaic reconstruction (dividing the standardized pattern image into 4×4=16 small blocks, randomly shuffling the order, and letting the model predict the correct splicing order). The pre-training dataset consists of 10,000 unlabeled silk pattern images. The number of pre-training iterations is 50, and the learning rate is 0.001. After the pre-training is completed, the model parameters are used as initialization parameters for subsequent fine-tuning training.

[0033] Step 3: Construction and processing of silk pattern annotation dataset The 4,000 standardized pattern images preprocessed in step 1 were used as a labeled dataset. Three professionals in the field of silk patterns labeled the images with the labels “floral pattern”, “bird pattern”, “cloud pattern”, and “geometric pattern”. After labeling, cross-validation was performed, and images with inconsistent labels (inconsistency rate exceeding 5%) were removed, resulting in 3,920 valid labeled images.

[0034] The effectively labeled images were divided into training, validation, and test sets in a ratio of 7:2:1, with 2744 images in the training set, 784 images in the validation set, and 392 images in the test set.

[0035] Data augmentation techniques were used to expand the training set. Specifically, each image in the training set was randomly cropped (cropped to 192×192 pixels and scaled to 224×224 pixels), horizontally flipped (flip probability 0.5), slightly rotated (rotation angle range -15° to 15°, filled with black background and scaled to 224×224 pixels), and Gaussian noise was added (noise variance randomly selected to be 0.01, 0.02, or 0.03). Each augmentation method was performed independently. After expansion, the number of images in the training set increased to 10,976, ensuring that the core features of the silk pattern were preserved in the expanded data.

[0036] Step 4: Training the improved convolutional neural network model The expanded training set images are input into the improved convolutional neural network model constructed in step 2. The model is trained using a mini-batch-based stochastic gradient descent method with the following specific parameters: mini-batch size is 32, initial learning rate is 0.001, learning rate uses cosine annealing decay strategy, iteration period is 10 times, weight decay coefficient is 1e-4, dropout probability is 0.5, and the number of iterations is preset to 150.

[0037] During training, the model is validated using validation set images after each iteration. The classification accuracy of the validation set is calculated, and the model parameters are adjusted in real time (the convolution kernel size is set alternately to 3×3 and 5×3, the initial value of the attention weight is set to 0.5 and dynamically adjusted according to the validation accuracy, the regularization coefficient ranges from 0.1 to 0.5, and the learning rate adaptively decreases with the number of iterations). When the classification accuracy of the validation set does not improve after 10 consecutive iterations, the model training is stopped, the current optimal model parameters are saved, and the trained silk pattern classification and recognition model is obtained.

[0038] After training, the model achieved a classification accuracy of 96.8% on the validation set.

[0039] Step 5: Classification and Identification of Silk Patterns One hundred silk pattern images (25 images of each pattern) that were not used in training and verification were selected as images to be classified and recognized. They were then input into step 1 for hierarchical preprocessing to obtain standardized images to be recognized.

[0040] The standardized images to be identified are input into the trained classification and recognition model. The model outputs the pattern category and category confidence of each image. At the same time, through Grad-CAM visualization technology, a heat map of pattern feature recognition is output. The red area of ​​the heat map represents the core pattern features recognized by the model, which is convenient for intuitive observation and verification.

[0041] The preset threshold for class confidence is set to 0.85. If the class confidence of an image to be identified is lower than 0.85, a secondary recognition mechanism is initiated: the local pattern features of the image (size 56×56×256) are extracted, and the similarity between the local features and the typical features of four patterns in the dataset is calculated using Euclidean distance (50 clearly labeled images are selected for each pattern, their local features are extracted, and the average value is taken as the typical features). The top 3 pattern categories with the highest similarity are selected as auxiliary recognition results, and the similarity values ​​of each auxiliary category are output.

[0042] In this test, among the 100 images to be recognized, 89 images had a class confidence score higher than 0.85, and the recognition results were directly output; 11 images had a class confidence score lower than 0.85, and after secondary recognition, auxiliary recognition results were output. In the end, 98 of the 100 images were correctly recognized, and the recognition accuracy rate reached 98%.

[0043] Step 6: Post-processing optimization of classification and recognition results The preliminary classification and recognition results output in step 5 are then post-processed and optimized. The specific steps are as follows: (1) Removal of abnormal identification results: According to the criteria for removing abnormal identification results, it is determined whether the identification result of each image is abnormal. If the category confidence of an image is lower than 0.85 and the highest similarity value of the second identification is lower than 0.7, it is determined to be an abnormal identification result and removed. In this test, there were no abnormal identification results.

[0044] (2) Clustering and integration of similar patterns: The K-means clustering algorithm is used to cluster the pattern features of 100 images to be identified. The number of clusters is set to 4 (corresponding to four pattern categories). The similar patterns after clustering are classified into the same category, and a unified category identifier (such as "floral pattern-01") and feature description (such as "floral pattern: clear petal texture, bright color, mainly peony pattern") are output.

[0045] Finally, the system outputs the classification and recognition results of 100 images to be recognized, along with detailed category descriptions, thus completing the intelligent classification and recognition of silk patterns. Example

[0046] A system for implementing the above-mentioned intelligent classification and recognition method for silk patterns includes an image acquisition module, a hierarchical preprocessing module, a model building and training module, a classification and recognition module, a post-processing optimization module, and a data storage module. The specific functions of each module are as follows: (1) Image acquisition module: It adopts a high-definition industrial camera, flatbed scanner and image import interface to support real-time shooting of silk patterns by the camera, scanning of silk fabrics by the scanner to obtain pattern images, and importing pattern image files in JPG, PNG and TIFF formats; the module has a built-in image preprocessing trigger mechanism, and after the original image is acquired, it is automatically transmitted to the layered preprocessing module.

[0047] (2) Layered preprocessing module: developed based on Python language and OpenCV library, it receives the original image transmitted by the image acquisition module, automatically performs the super-resolution enhancement, color space conversion, contrast enhancement, size normalization and Z-Score standardization operations described in step 1, and after processing, transmits the standardized pattern image to the classification and recognition module and the data storage module respectively.

[0048] (3) Model building and training module: developed based on the PyTorch framework, with built-in ResNet50 basic model and Transformer attention mechanism module, supports the addition of linear discriminant analysis regularization constraints and the execution of self-supervised pre-training tasks; receives labeled datasets from the data storage module, automatically completes dataset partitioning, data augmentation and model training operations, and after training is completed, stores model parameters in the data storage module and sends model call instructions to the classification and recognition module.

[0049] (4) Classification and Recognition Module: Receives the standardized image to be recognized from the hierarchical preprocessing module and the model call instruction from the model construction and training module, calls the trained classification and recognition model, performs classification and recognition operations, outputs the preliminary classification and recognition results (category, confidence) and Grad-CAM heat map, and transmits them to the post-processing optimization module; at the same time, it supports the manual triggering of the secondary recognition mechanism, allowing users to actively verify the low confidence recognition results.

[0050] (5) Post-processing optimization module: It has a built-in K-means clustering algorithm and abnormal result judgment logic. It receives the preliminary recognition results from the classification and recognition module, automatically removes abnormal recognition results, clusters and integrates similar patterns, generates the final classification and recognition results and detailed category descriptions, and transmits them to the data storage module. It also supports result visualization.

[0051] (6) Data storage module: It adopts a combination of MySQL database and local file storage to store the original silk pattern image, preprocessed standardized image, silk pattern annotation dataset, model parameters, preliminary recognition results and final recognition results; it supports data query by category, time, confidence level and other conditions, and supports modification and export of model parameters and recognition results (export format is Excel and PDF) to ensure data traceability and reuse.

[0052] In this embodiment, the system can automate the entire process of silk pattern classification and recognition. The time from acquiring a single image to outputting the final recognition result is no more than 2 seconds, and the recognition accuracy rate reaches more than 98%. It greatly improves the efficiency and accuracy of classification and recognition, and can be widely used in the fields of silk textiles, cultural heritage protection, etc.

[0053] It should be noted that this invention is not limited to the above embodiments. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention. For example, the pattern categories can be expanded to animal patterns, human figures, auspicious patterns, etc., according to actual needs; the basic model framework can be replaced with other ResNet series models such as ResNet18 and ResNet34; data augmentation techniques can include color dithering, blur enhancement, etc., without affecting the implementation effect of this invention.

[0054] The present invention and its embodiments have been described above. This description is not restrictive. In short, if a person skilled in the art is inspired by this description and designs a similar structure and embodiment without departing from the spirit of the present invention, such design should fall within the protection scope of the present invention.

Claims

1. A method for intelligent classification and recognition of silk patterns, characterized in that, Includes the following steps: Step 1: Obtain the original image of the silk pattern and perform layered preprocessing on the original image. The layered preprocessing includes: firstly, using a bicubic interpolation algorithm based on nonlocal mean optimization to perform super-resolution enhancement on the original image, eliminating image noise and improving the clarity of pattern details; then, performing color space conversion on the enhanced image, converting the RGB color space to the HSV color space, separating the color channel and the brightness channel, and performing adaptive histogram equalization on the brightness channel to preserve the original color features of the silk pattern while enhancing the contrast of the pattern outline; finally, performing size normalization and normalization processing on the processed image to obtain a standardized pattern image, solving the problem of low classification accuracy caused by blurry silk pattern images and loss of details in the existing technology. Step 2: Construct an improved convolutional neural network model. This improved model is based on the ResNet framework and incorporates a Transformer attention mechanism module and linear discriminant analysis (LDA) regularization constraints. Specifically, a Transformer attention mechanism module is embedded between the residual blocks of the ResNet to capture global texture association features of silk patterns, overcoming the limitation of traditional CNNs that can only extract local features. A high-level feature layer close to the output layer of the ResNet is selected, and LDA-based regularization constraints are applied to the features of this layer, reducing the intra-class distance and increasing the inter-class distance of the pattern features, thus improving feature discriminancy. Simultaneously, a self-supervised pre-training method is used to initialize the model. Pre-training tasks such as image rotation prediction and pattern mosaic reconstruction reduce the dependence on a large amount of labeled pattern data, improving the model's generalization ability. Step 3: Construct a silk pattern annotation dataset. The dataset includes images of various types of silk patterns, covering common patterns such as floral patterns, bird patterns, cloud patterns, and geometric patterns. After performing the hierarchical preprocessing described in Step 1 on the images in the dataset, it is divided into a training set, a validation set, and a test set. Data augmentation techniques are used to expand the training set. The data augmentation techniques include random cropping, horizontal flipping, slight rotation, and Gaussian noise addition to avoid model overfitting. Step 4: Input the preprocessed training set into the improved convolutional neural network model, and use the mini-batch-based stochastic gradient descent method to train the model. Adjust the model parameters in real time through the validation set, including the convolutional kernel size, attention weights, regularization coefficients and learning rate, until the model converges and the trained silk pattern classification and recognition model is obtained. Step 5: Input the silk pattern image to be classified into Step 1 for hierarchical preprocessing to obtain a standardized image to be identified. Then, input the standardized image into the trained classification and recognition model. The model outputs the pattern category and category confidence of the image to be identified. At the same time, it outputs a heatmap of pattern feature recognition through Grad-CAM visualization technology to achieve interpretability of classification results. If the category confidence is lower than the preset threshold, a secondary recognition mechanism is activated to extract local pattern features of the image to be identified and compare them with similar patterns in the dataset to output auxiliary recognition results. Step 6: Post-process and optimize the classification and recognition results. Combining the texture correlation and category features of silk patterns, eliminate abnormal recognition results, cluster and integrate similar patterns, and output the final silk pattern classification and recognition results and detailed category descriptions to complete the intelligent classification and recognition of silk patterns.

2. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 1, the nonlocal mean optimized bicubic interpolation algorithm is specifically as follows: first, the bicubic interpolation algorithm is used to perform preliminary super-resolution processing on the original image, and then the nonlocal mean filtering is used to optimize the noise reduction of the interpolated image. The similarity weight between each pixel in the image and its neighboring pixels is calculated, and the pixel value after noise reduction is obtained by weighted averaging according to the similarity weight, thus balancing the image sharpness and the noise suppression effect. The similarity weight is calculated using a Gaussian kernel function, and the standard deviation of the kernel function is adaptively adjusted according to the image noise intensity.

3. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 2, the Transformer attention mechanism module is embedded between the third and fourth residual groups of ResNet. This module includes a multi-head attention layer, a layer normalization layer, and a fully connected layer. The multi-head attention layer is used to capture the global texture association of silk patterns at different scales, the layer normalization layer is used to stabilize the model training process, and the fully connected layer is used to integrate attention features and output the enhanced pattern feature map.

4. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 2, the expression for the linear discriminant analysis criterion is trace(Sb) / trace(Sw), where trace(•) represents the trace of the matrix, Sb represents the inter-class scatter matrix of the pattern features, and Sw represents the intra-class scatter matrix of the pattern features. By applying this regularization constraint to the high-level feature layer, the weighted sum of the linear discriminant analysis loss and the model classification loss is used as the total loss function, thereby improving the model's ability to distinguish similar silk patterns.

5. The method for intelligent classification and recognition of silk patterns, characterized in that: In step 4, during model training, a cosine annealing decay strategy is used for the learning rate. The initial learning rate is set to 0.001, the mini-batch size is set to 32, and the number of iterations is preset to 100-200. When the classification accuracy of the validation set does not improve for 10 consecutive iterations, the model training is stopped, the current optimal model parameters are saved, and model overfitting and training redundancy are avoided.

6. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 5, the preset threshold is set to 0.

85. The secondary recognition mechanism is as follows: extract the local pattern features of the image to be recognized, use Euclidean distance to calculate the similarity between the local features and the typical features of various patterns in the dataset, select the top 3 pattern categories with the highest similarity as auxiliary recognition results, and output the similarity values ​​of each auxiliary category for user reference and verification.

7. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 6, the criteria for eliminating abnormal identification results are as follows: when the category confidence of the same image to be identified by the model is lower than a preset threshold, and the highest similarity value of the second identification is lower than 0.7, it is determined to be an abnormal identification result and is eliminated. The K-means clustering algorithm is used to integrate similar patterns. It clusters patterns based on the similarity of their features, and then groups similar patterns into the same category, outputting a unified category identifier and feature description.

8. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: It includes an image acquisition module, a hierarchical preprocessing module, a model building and training module, a classification and recognition module, a post-processing optimization module, and a data storage module; The image acquisition module is used to acquire the original image of the silk pattern. It supports three acquisition methods: camera shooting, scanner scanning and image file import. The acquired original image is then transmitted to the layered preprocessing module. The layered preprocessing module is used to receive the original image transmitted by the image acquisition module, perform the layered preprocessing operation described in step 1, transmit the obtained standardized pattern image to the classification and recognition module, and transmit the preprocessed image to the data storage module for saving. The model building and training module is used to build the improved convolutional neural network model described in step 2, receive the labeled dataset from the data storage module, perform the dataset processing and model training operations described in steps 3-4, store the trained classification and recognition model parameters to the data storage module, and transmit the model calling instruction to the classification and recognition module. The classification and recognition module is used to receive the standardized pattern image transmitted by the hierarchical preprocessing module and the model call instruction transmitted by the model construction and training module, call the trained classification and recognition model, execute the classification and recognition operation described in step 5, output the preliminary classification and recognition results and feature heatmap, and transmit them to the post-processing optimization module. The post-processing optimization module is used to receive the preliminary classification and recognition results and feature heatmap transmitted by the classification and recognition module, execute the post-processing optimization operation described in step 6, remove abnormal recognition results, cluster and integrate similar patterns, output the final classification and recognition results, and transmit the final results to the data storage module for storage. The data storage module is used to store the original silk pattern image, the preprocessed standardized image, the silk pattern annotation dataset, the parameters of the improved convolutional neural network model, the preliminary classification and recognition results, and the final classification and recognition results, and supports data query, modification and export operations.

9. The method for intelligent classification and recognition of silk patterns, as described above, is characterized in that: In step 1, the size normalization process adjusts the image to a uniform size of 224×224 pixels. The normalization process uses the Z-Score standardization method to calculate the mean and standard deviation of the image pixel gray values, converting the pixel values ​​to the range of [-1,1] to eliminate the influence of differences in pixel value magnitude on model training.

10. The method for intelligent classification and recognition of silk patterns, characterized in that: In step 3, the ratio of training set, validation set and test set is 7:2:

1. During the data augmentation process, the cropping size of random cropping is 192×192 pixels, the angle of slight rotation is between -15° and 15°, and the variance of Gaussian noise is set to 0.01-0.03 to ensure that the augmented data can still retain the core features of the silk pattern.