Textile fabric image classification method and device based on enhanced deep features
By combining two-dimensional discrete Fourier transform, band-stop filtering, grayscale conversion, and convolutional neural networks, image texture features, RGB histogram statistical features, and depth features of textile fabrics are extracted and fused, solving the problem of background texture and process influence in textile fabric classification and improving the accuracy of textile fabric classification.
Patent Information
- Application Number
- CN202310661984.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-06-05
AI Technical Summary
Existing technologies struggle to effectively distinguish and classify textile fabrics, especially due to the difficulty in identification caused by the fabric's texture and processing, which affects the accuracy of textile fabric classification.
By combining two-dimensional discrete Fourier transform, band-stop filtering, grayscale conversion and convolutional neural network, image texture features, RGB histogram statistical features and depth features of textile fabrics are extracted and fused to form enhanced depth features for textile fabric classification.
It improves the accuracy of textile fabric classification, effectively removes the influence of fibers and processes, and improves the accuracy of identification results.
Smart Images

Figure CN116721290B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and specifically to a method and apparatus for classifying textile fabric images based on enhanced depth features. Background Technology
[0002] Currently, with the development of the textile industry, the types and quantities of textile fabrics are increasing. Textile fabric factories classify them according to different patterns, such as geometric, striped, and camouflage. Textile fabric classification facilitates subsequent management and is a crucial prerequisite for implementing granular fabric retrieval. Due to advancements in computer vision theory, especially deep learning, how to utilize computer vision to replace traditional, inefficient manual textile fabric classification has become a technical challenge that those skilled in the art need to overcome. Summary of the Invention
[0003] To address the aforementioned shortcomings, this invention discloses a textile fabric image classification method based on enhanced depth features, which fuses and enhances the extracted depth features to improve the accuracy of the final textile fabric classification.
[0004] The first aspect of this invention discloses a method for classifying textile fabric images based on enhanced depth features, comprising:
[0005] Acquire images of textile fabrics;
[0006] The textile fabric image is transformed from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is:
[0007] Where W is the width of the textile fabric image and H is the height of the textile fabric image.
[0008] Based on the textile fabric image, a corresponding band-stop filter is constructed, and the first frequency domain image is band-stop filtered according to the band-stop filter to obtain a second frequency domain image with the background pattern removed.
[0009] The second frequency domain image after removing the background texture is grayscale processed by a grayscale conversion algorithm to obtain a grayscale frequency domain image. Feature extraction is performed on the grayscale frequency domain image to obtain image texture features and RGB histogram statistical features of the second frequency domain image are extracted in the RGB color space.
[0010] The second frequency domain image after removing the background texture is input into the pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structure is used to perform multi-layer encoding on the second frequency domain image after removing the background texture in order to extract the image depth features of the second frequency domain image.
[0011] The image texture features, RGB histogram statistical features, and image depth features are fused to obtain enhanced depth features. The enhanced depth features are then input into an image classification model to classify the image and determine the classification category of the textile fabric image.
[0012] As an optional implementation, in a first aspect of the present invention, the step of constructing a corresponding band-stop filter based on the textile fabric image, and performing band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed, includes:
[0013] The textile fabric image is binarized using the Otsu threshold segmentation algorithm to obtain a textile binarized image, which is then divided into a background region, a main peak region, and a secondary peak region.
[0014] The main peak region and secondary peak region are extracted from the textile binarized image, and the seed growth algorithm is used to grow the image at the center of the main peak to fill the main peak region in the textile binarized image.
[0015] The binarized textile image after filling is inverted to obtain a frequency domain bandstop filter with 0 in the secondary peak region and 1 in other positions.
[0016] The first frequency domain image of the textile fabric is filtered using the frequency domain band-stop filter to obtain a second frequency domain image with the background pattern removed.
[0017] As an optional implementation, in the first aspect of the present invention, the step of performing grayscale processing on the second frequency domain image after removing the background texture using a grayscale conversion algorithm to obtain a grayscale frequency domain image, and performing feature extraction on the grayscale frequency domain image to obtain image texture features, includes:
[0018] The second frequency domain image after removing the background texture is converted from an RGB three-channel image to a single-channel grayscale frequency domain image using a grayscale conversion algorithm.
[0019] Gaussian blur image denoising processing is performed on the grayscale frequency domain image;
[0020] The denoised grayscale spectrum image is divided into a first preset number of sub-regions, where the first preset number is 16*16.
[0021] For each pixel in each sub-region, the gray value is compared with the gray value of the 8 neighboring pixels. If the gray value of the surrounding pixels is greater than that of the pixel, the position of the surrounding pixels is marked as 1; otherwise, the position of the surrounding pixels is marked as 0.
[0022] The textile texture value of the pixel is calculated based on the marking information of the surrounding pixels;
[0023] Calculate the distribution histogram of textile texture values in each sub-region, and normalize the distribution histogram;
[0024] The distribution histograms of each sub-region after normalization are connected to obtain the image texture features associated with the grayscale spectrum image.
[0025] As an optional implementation, in a first aspect of the present invention, after concatenating the distribution histograms of each sub-region after normalization to obtain image texture features associated with the grayscale spectrum image, the method further includes:
[0026] The image texture features are reduced to 64-dimensional image texture features using a fully connected layer. The reduced image texture features are the texture feature vector of the entire image.
[0027] As an optional implementation, in a first aspect of the present invention, the step of extracting the RGB histogram statistical features of the second frequency domain image in the RGB color space includes:
[0028] Extract the color values of each pixel in the second frequency domain image in the R, G, and B channels in the RGB color space;
[0029] Color histogram statistics are performed on the extracted color values to obtain the color vectors corresponding to the R, G, and B channels of the second spectral image;
[0030] The extracted color vectors are normalized to obtain normalized color vectors.
[0031] The color orthogonal vectors of the three channels are concatenated to obtain the RGB histogram statistical features, and a fully connected layer is used to perform dimensionality reduction processing on the RGB histogram statistical features to obtain 64-dimensional RGB histogram statistical features.
[0032] As an optional implementation, in a first aspect of the present invention, the second frequency domain image after removing the background texture is input into a pre-constructed convolutional neural network depth feature extractor. The convolutional neural network with residual structures performs multi-layer encoding on the second frequency domain image after removing the background texture to extract the image depth features of the second frequency domain image, including:
[0033] The first depth feature map is obtained by extracting depth features from the second frequency domain image after removing the background texture through convolutional layers and pooling layers.
[0034] The depth feature map is passed sequentially through a 1*1 convolutional layer and a ReLU activation layer, then through a 3*3 convolutional layer and a ReLU activation layer, and finally through a 1*1 convolutional layer to obtain the second depth feature map.
[0035] The second depth feature map output is added to the first depth feature map to form a residual connection, so as to obtain the 512-dimensional depth features of the textile fabric image.
[0036] As an optional implementation, in a first aspect of the present invention, the step of fusing the image texture features, RGB histogram statistical features, and image depth features to obtain enhanced depth features, and inputting the enhanced depth features into an image classification model to perform image classification to determine the classification category of the textile fabric image, includes:
[0037] A fully connected layer is used to reduce the dimensionality of image texture features and RGB histogram statistical features to obtain 64-dimensional image texture features and RGB histogram statistical features;
[0038] The 64-dimensional image texture features, RGB histogram statistical features, and image depth features are concatenated to form a 1*1*640-dimensional feature vector.
[0039] The 1*1*640-dimensional feature vectors were fused and dimensionality-reduced using 1*1 convolution to obtain 1*1*512-dimensional feature vectors.
[0040] A batch normalization (BN) layer is used to process the 1*1*512 dimensional feature vector to obtain enhanced deep features;
[0041] The enhanced depth features are input into an image classification model for image classification, and the cross-loss entropy function is used to constrain the classification results.
[0042] A second aspect of this invention discloses a textile fabric image classification device based on enhanced depth features, comprising:
[0043] Acquisition module: used to acquire images of textile fabrics;
[0044] Frequency domain transformation module: used to transform the textile fabric image from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is:
[0045] Where W is the width of the textile fabric image and H is the height of the textile fabric image.
[0046] Filtering module: used to construct a corresponding band-stop filter based on the textile fabric image, and to perform band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed;
[0047] Grayscale conversion module: used to perform grayscale processing on the second frequency domain image after removing the background texture to obtain a grayscale frequency domain image by using a grayscale conversion algorithm, extract features from the grayscale frequency domain image to obtain image texture features, and extract the RGB histogram statistical features of the second frequency domain image in the RGB color space;
[0048] Depth Extraction Module: The second frequency domain image after removing the background texture is input into the pre-built convolutional neural network's depth feature extractor. The convolutional neural network with residual structure performs multi-layer encoding on the second frequency domain image after removing the background texture to extract the image depth features of the second frequency domain image.
[0049] The classification module is used to perform feature fusion on the image texture features, RGB histogram statistical features and image depth features to obtain enhanced depth features, and input the enhanced depth features into the image classification model to perform image classification to determine the classification category of the textile fabric image.
[0050] A third aspect of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute the textile fabric image classification method based on enhanced depth features disclosed in the first aspect of the present invention.
[0051] A fourth aspect of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program causes a computer to execute the textile fabric image classification method based on enhanced depth features disclosed in the first aspect of the present invention.
[0052] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0053] The textile fabric image classification method based on enhanced depth features in this embodiment of the invention can effectively remove the influence of fibers and different processes on textile identification by processing the texture of the textile fabric. The obtained image texture features and RGB histogram statistical features are fused with depth features to obtain enhanced depth features. Finally, the textile fabric is classified based on the enhanced depth features, thereby improving the accuracy of the final recognition result. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the 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.
[0055] Figure 1 This is a flowchart illustrating the textile fabric image classification method based on enhanced depth features disclosed in an embodiment of the present invention.
[0056] Figure 2 This is a schematic diagram of the band-stop filtering process disclosed in an embodiment of the present invention;
[0057] Figure 3 This is a schematic diagram of the image texture feature extraction process disclosed in an embodiment of the present invention;
[0058] Figure 4 This is a flowchart illustrating the histogram statistical features disclosed in an embodiment of the present invention;
[0059] Figure 5 This is a schematic diagram of the image depth feature extraction process disclosed in an embodiment of the present invention;
[0060] Figure 6 This is a schematic diagram of the process for acquiring and processing enhanced depth features as disclosed in an embodiment of the present invention;
[0061] Figure 7 This is an image spectrum diagram disclosed in an embodiment of the present invention;
[0062] Figure 8 This refers to the background texture image that has been removed, as disclosed in the embodiments of the present invention.
[0063] Figure 9 This is a schematic diagram of the feature enhancement strategy according to an embodiment of the present invention;
[0064] Figure 10 This is a schematic diagram of the structure of a textile fabric image classification device based on enhanced depth features provided in an embodiment of the present invention;
[0065] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0066] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0067] It should be noted that the terms "first," "second," "third," "fourth," etc., in the specification and claims of this invention are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "having," and any variations thereof, in the embodiments of this invention are intended to cover non-exclusive inclusion. Exemplarily, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0068] The key to image classification lies in extracting features that accurately describe and distinguish images. In recent years, neural networks, especially convolutional neural networks (CNNs), have demonstrated strong feature extraction capabilities through extensive training on numerous samples. CNNs extract deep features that characterize images through multi-layered feature encoding. These deep features extracted by neural networks have been applied to image classification with promising results. To enhance the network's feature representation capabilities and make deep features of different types of textile fabric images easier to distinguish, early work primarily focused on increasing network depth. However, with increasing depth, problems such as gradient vanishing become increasingly severe, and with iterative deep encoding, some important image features represented by shallow layers are lost. Since attention mechanisms allow networks to learn autonomously through extensive training, filtering out less valuable parts of deep features and enhancing useful parts, attention mechanisms have also been used to improve feature extraction capabilities. Introducing spatial, channel, and layer-level attention mechanisms has effectively improved the performance of classification networks. However, these methods all rely on extensive and effective training of the network. In textile fabric classification, how to effectively improve the distinguishability of deep features in fabric images remains a subject for further research. Based on this, embodiments of the present invention disclose a method, apparatus, electronic device, and storage medium for classifying textile fabric images based on enhanced depth features. By processing the texture of the textile fabric, the method can effectively remove the influence of fibers and different processes on textile identification. The obtained image texture features and RGB histogram statistical features are fused with depth features to obtain enhanced depth features. Finally, the textile fabric is classified based on the enhanced depth features, thereby improving the accuracy of the final identification result.
[0069] Example 1
[0070] Please see Figure 1 , Figure 1This is a flowchart illustrating the textile fabric image classification method based on enhanced depth features disclosed in this invention. The execution entity of the method described in this embodiment is an execution entity composed of software and / or hardware. This execution entity can receive relevant information via wired or / or wireless means and can send certain instructions. It may also have certain processing and storage functions. This execution entity can control multiple devices, such as remote physical servers or cloud servers and related software, or local hosts or servers and related software that perform related operations on devices located in a certain location. In some scenarios, it can also control multiple storage devices, which may be placed in the same location as the devices or in different locations. Figure 1 As shown, this textile fabric image classification method based on enhanced depth features includes the following steps:
[0071] S101: Acquire an image of the textile fabric;
[0072] S102: The textile fabric image is transformed from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is:
[0073] Where W is the width of the textile fabric image and H is the height of the textile fabric image.
[0074] This step primarily involves acquiring the basic recognition object, which serves as the foundation for subsequent image processing. Then, frequency domain transformation is used to convert the image to the frequency domain for processing. The resulting first frequency domain image is shown below. Figure 7 As shown.
[0075] S103: Construct a corresponding band-stop filter based on the textile fabric image, and perform band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed.
[0076] More preferably, Figure 2 This is a schematic diagram of the band-stop filtering process disclosed in an embodiment of the present invention, as shown below. Figure 2 As shown, the step of constructing a corresponding band-stop filter based on the textile fabric image, and performing band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed, includes:
[0077] S1031: The textile fabric is binarized based on the Otsu threshold segmentation algorithm to obtain a textile binarized image, and the textile binarized image is divided into a background region, a main peak region and a secondary peak region.
[0078] S1032: Extract the main peak region and secondary peak region from the textile binarized image, and use the seed growth algorithm to grow the image at the center of the main peak to fill the main peak region in the textile binarized image.
[0079] S1033: Invert the phase of the binarized textile image after filling to obtain a frequency domain bandstop filter with 0 in the secondary peak region and 1 in other positions.
[0080] S1034: The first frequency domain image of the textile fabric is subjected to frequency domain filtering according to the frequency domain band-stop filter to obtain a second frequency domain image with the background pattern removed.
[0081] The image's spectrogram is obtained, and then binarized using the Otsu thresholding algorithm. The advantage of the Otsu thresholding algorithm is its ability to quickly find the inter-class segmentation threshold and accurately binarize the image based on this threshold. After binarization using the Otsu thresholding algorithm, the image is divided into two parts: the background and the main peak and secondary peak, thus obtaining the main peak and secondary peak regions in the spectrogram. The main peak region is located in the center of the image, representing the frequency domain corresponding to the main pattern content information, while the secondary peak region represents the frequency domain corresponding to the fabric texture information. To ensure that the final band-stop filter only contains the secondary peak region and avoids filtering out the main pattern information of the image, the main peak region needs to be filled with 0s. Therefore, a seed growth algorithm is used to grow at the center of the main peak to fill the main peak region. Since the position of the main peak region is fixed, the seed growth method can simply and quickly fill the region corresponding to the main peak in the binarized image completely and accurately through a step-by-step growth method. Finally, the filled image is inverted to obtain a frequency domain band-stop filter with the secondary peak position set to 0 and all other positions set to 1. By using this band-stop filter to perform frequency domain filtering on the image's spectrogram, and then performing an inverse frequency domain transform, the background texture of the textile fabric image can be removed. The removed background texture is as follows: Figure 8 As shown.
[0082] S104: The second frequency domain image after removing the background texture is processed into grayscale by a grayscale conversion algorithm to obtain a grayscale frequency domain image. The grayscale frequency domain image is then processed to extract image texture features and RGB histogram statistical features of the second frequency domain image in the RGB color space.
[0083] More preferably, Figure 3 This is a schematic diagram of the image texture feature extraction process disclosed in an embodiment of the present invention, as shown below. Figure 3 As shown, the process of converting the second frequency domain image after removing the background texture using a grayscale conversion algorithm to obtain a grayscale frequency domain image, and then extracting features from the grayscale frequency domain image to obtain image texture features, includes:
[0084] S1041: Convert the second frequency domain image after removing the background texture from an RGB three-channel image to a single-channel grayscale frequency domain image using a grayscale conversion algorithm;
[0085] S1042: Perform Gaussian blur image denoising processing on the grayscale frequency domain image;
[0086] S1043: Divide the denoised grayscale spectrum image into a first preset number of sub-regions, where the first preset number is 16*16;
[0087] S1044: For each pixel in each sub-region, compare its gray value with the gray values of the 8 neighboring pixels. If the gray value of the surrounding pixels is greater than that of the current pixel, the position of the surrounding pixels is marked as 1; otherwise, the position of the surrounding pixels is marked as 0.
[0088] S1045: Calculate the textile texture value of the pixel based on the marking information of the surrounding pixels;
[0089] S1046: Calculate the distribution histogram of textile texture values in each sub-region, and normalize the distribution histogram;
[0090] S1047: Connect the distribution histograms of each sub-region after normalization to obtain the image texture features associated with the grayscale spectrum image.
[0091] More preferably, after concatenating the distribution histograms of each normalized sub-region to obtain the image texture features associated with the grayscale spectral image, the method further includes:
[0092] The image texture features are reduced to 64-dimensional image texture features using a fully connected layer. The reduced image texture features are the texture feature vector of the entire image.
[0093] More preferably, Figure 4 This is a flowchart illustrating the histogram statistical features disclosed in an embodiment of the present invention, as shown below. Figure 4 As shown, the step of extracting the RGB histogram statistical features of the second frequency domain image in the RGB color space includes:
[0094] S104a: Extract the color values of each pixel in the second frequency domain image in the R, G, and B channels in the RGB color space;
[0095] S104b: Perform color histogram statistics on the extracted color values to obtain the color vectors corresponding to the R, G, and B channels of the second spectral image;
[0096] S104c: Normalize the extracted color vectors to obtain normalized color vectors.
[0097] S104d: The color orthogonal vectors of the three channels are concatenated together to obtain the RGB histogram statistical features, and a fully connected layer is used to perform dimensionality reduction processing on the RGB histogram statistical features to obtain 64-dimensional RGB histogram statistical features.
[0098] The image is converted from an RGB three-channel to a single-channel grayscale image. A Gaussian blur is then applied to the grayscale image for noise reduction. Next, the detection window is divided into 16×16 cells. For each pixel in each cell, its grayscale value is compared with that of its eight neighboring pixels. If the neighboring pixel value is greater than the current pixel value, the position of the neighboring pixel is marked as 1; otherwise, it is marked as 0, thus obtaining the LBP value of that pixel. Then, a histogram of the LBP values in each cell is calculated, representing the frequency of each digit, and this histogram is normalized. Finally, the statistical histograms of each cell are concatenated into a feature vector, and a fully connected layer is used to reduce the dimensionality of this feature vector to 64 dimensions, resulting in the final LBP feature vector for the entire image.
[0099] The RGB histogram statistical feature extraction process is as follows: In the RGB color space of the image, the color distribution of the R channel, G channel and B channel are divided into 256 blocks, and the color histograms of these three channels are calculated based on this. At the same time, in order to ensure that the amplitude is consistent with the depth features, the extracted color histogram vectors of the three channels are normalized. The normalization formula is shown below.
[0100]
[0101] Where h' is the normalized color histogram vector, h' is the initial color histogram vector, H represents the height of the image, and W represents the width of the image. The normalized color histogram feature vector for each channel has a dimension of 256. Then, the color histogram vectors of the two channels are concatenated together to obtain the final feature description of the image color, thus obtaining the RGB histogram statistical features, with a feature dimension of 768. A fully connected layer is then used to reduce the dimensionality of the RGB histogram statistical features from 768 to 64.
[0102] S105: The second frequency domain image after removing the background texture is input into the pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structure is used to perform multi-layer encoding on the second frequency domain image after removing the background texture in order to extract the image depth features of the second frequency domain image.
[0103] More preferably, Figure 5 This is a schematic diagram of the image depth feature extraction process disclosed in an embodiment of the present invention, as shown below. Figure 5 As shown, the second frequency domain image after removing the background texture is input into a pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structures performs multi-layer encoding on the second frequency domain image after removing the background texture to extract the image depth features of the second frequency domain image, including:
[0104] S1051: Depth features are extracted from the second frequency domain image after removing the background texture using convolutional layers and pooling layers to obtain the first depth feature map;
[0105] S1052: The depth feature map is passed through a 1*1 convolutional layer and a ReLU activation layer in sequence, then through a 3*3 convolutional layer and a ReLU activation layer, and then through a 1*1 convolutional layer to obtain the second depth feature map.
[0106] S1053: Add the output second depth feature map to the first depth feature map to form a residual connection, so as to obtain the 512-dimensional depth features of the textile fabric image.
[0107] The image after removing the texture is input into a deep feature extractor based on a convolutional neural network (CNN). A CNN with residual structures is used as the deep feature extraction network. This CNN continuously encodes the input image using convolutional and pooling layers to extract its depth features. Simultaneously, a residual connection structure is introduced during the depth feature extraction process. The depth feature map extracted by the backbone network is first passed through a 1x1 convolution and a ReLU activation layer, then through a 3x3 convolutional layer and a ReLU activation layer, followed by a 1x1 convolutional layer to obtain the output. This output is added to the initially input feature map to form a residual connection. In this implementation, a ResNet18 network with residual structures is used to ultimately extract 512-dimensional depth features from the textile fabric image.
[0108] S106: Perform feature fusion on the image texture features, RGB histogram statistical features and image depth features to obtain enhanced depth features, and input the enhanced depth features into the image classification model to perform image classification to determine the classification category of the textile fabric image.
[0109] More preferably, Figure 6 This is a schematic diagram of the process for acquiring and processing enhanced depth features disclosed in an embodiment of the present invention, as shown below. Figure 6As shown, the step of fusing the image texture features, RGB histogram statistical features, and image depth features to obtain enhanced depth features, and then inputting the enhanced depth features into an image classification model to perform image classification and determine the classification category of the textile fabric image, includes:
[0110] S1061: A fully connected layer is used to reduce the dimensionality of image texture features and RGB histogram statistical features to obtain 64-dimensional image texture features and RGB histogram statistical features;
[0111] S1062: Concatenate 64-dimensional image texture features, RGB histogram statistical features and image depth features to form a 1*1*640-dimensional feature vector;
[0112] S1063: Use 1*1 convolution to fuse and reduce the dimensions of the spliced 1*1*640-dimensional feature vector to obtain a 1*1*512-dimensional feature vector;
[0113] S1064: A BN layer is used to process the 1*1*512 dimensional feature vector to obtain enhanced deep features;
[0114] S1065: Input the enhanced depth features into the image classification model to classify the image, and use the cross-loss entropy function to constrain the classification results of the image.
[0115] The extracted depth features, LBP features, and RGB histogram statistical features are fused to enhance the depth features. These enhanced depth features are then used for the classification of textile fabric images. The specific strategy is as follows: Figure 9 As shown. To avoid diminishing the effectiveness of deep features due to excessively high dimensionality of the two low-level features, we use fully connected layers to reduce the dimensionality of both the extracted LBP features and RGB histogram statistical features to 64 dimensions. The 64-dimensional LBP and RGB histogram statistical features are then concatenated with the deep features to form a 1*1*640-dimensional feature vector. To promote information interaction between the deep features and the LBP and RGB histogram features and effectively enhance the deep features, this implementation uses 1*1 convolutions to fuse and reduce the 1*1*640-dimensional feature vector to 1*1*512 dimensions. This feature vector is then processed using a Batch Normalization (BN) layer to obtain the enhanced deep feature vector. The enhanced deep features will be used as the final features for classification, and a cross-loss entropy function will be used to constrain the image classification results.
[0116] The textile fabric image classification method based on enhanced depth features in this embodiment of the invention can effectively remove the influence of fibers and different processes on textile identification by processing the texture of the textile fabric. The obtained image texture features and RGB histogram statistical features are fused with depth features to obtain enhanced depth features. Finally, the textile fabric is classified based on the enhanced depth features, thereby improving the accuracy of the final recognition result.
[0117] Example 2
[0118] Please see Figure 10 , Figure 10 This is a schematic diagram of the structure of the textile fabric image classification device based on enhanced depth features disclosed in an embodiment of the present invention. Figure 10 As shown, the textile fabric image classification device based on enhanced depth features may include:
[0119] Acquisition module 21: Used to acquire images of textile fabrics;
[0120] Frequency domain conversion module 22: used to convert the textile fabric image from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is:
[0121] Where W is the width of the textile fabric image and H is the height of the textile fabric image.
[0122] Filtering module 23: is used to construct a corresponding band-stop filter based on the textile fabric image, and to perform band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed.
[0123] Grayscale conversion module 24: used to perform grayscale processing on the second frequency domain image after removing the background texture through a grayscale conversion algorithm to obtain a grayscale frequency domain image, perform feature extraction on the grayscale frequency domain image to obtain image texture features, and extract the RGB histogram statistical features of the second frequency domain image in the RGB color space;
[0124] Depth extraction module 26: The second frequency domain image after removing the background texture is input into the pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structure performs multi-layer encoding on the second frequency domain image after removing the background texture to extract the image depth features of the second frequency domain image.
[0125] Classification module 26: used to perform feature fusion on the image texture features, RGB histogram statistical features and image depth features to obtain enhanced depth features, and input the enhanced depth features into the image classification model to perform image classification to determine the classification category of the textile fabric image.
[0126] The textile fabric image classification method based on enhanced depth features in this embodiment of the invention can effectively remove the influence of fibers and different processes on textile identification by processing the texture of the textile fabric. The obtained image texture features and RGB histogram statistical features are fused with depth features to obtain enhanced depth features. Finally, the textile fabric is classified based on the enhanced depth features, thereby improving the accuracy of the final recognition result.
[0127] Example 3
[0128] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device can be a computer, a server, etc. Of course, in certain cases, it can also be a mobile phone, tablet computer, monitoring terminal, or other smart device, as well as an image acquisition device with processing capabilities. Figure 11 As shown, the electronic device may include:
[0129] Memory 510 storing executable program code;
[0130] Processor 520 coupled to memory 510;
[0131] The processor 520 calls the executable program code stored in the memory 510 to execute some or all of the steps in the textile fabric image classification method based on enhanced depth features in Embodiment 1.
[0132] This invention discloses a computer-readable storage medium storing a computer program that causes a computer to perform some or all of the steps in the textile fabric image classification method based on enhanced depth features in Embodiment 1.
[0133] This invention also discloses a computer program product, wherein when the computer program product is run on a computer, the computer performs some or all of the steps in the textile fabric image classification method based on enhanced depth features in Embodiment 1.
[0134] This invention also discloses an application publishing platform, which is used to publish computer program products. When the computer program products are run on a computer, the computer performs some or all of the steps in the textile fabric image classification method based on enhanced depth features in Embodiment 1.
[0135] In various embodiments of the present invention, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0136] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0137] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0138] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several requests to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute some or all of the steps of the methods described in the various embodiments of the present invention.
[0139] In the embodiments provided by this invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0140] Those skilled in the art will understand that some or all of the steps in the various methods of the embodiments described can be implemented by a program instructing related hardware. This program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0141] The foregoing has provided a detailed description of the textile fabric image classification method, apparatus, electronic device, and storage medium based on enhanced depth features disclosed in the embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for classifying textile fabric images based on enhanced depth features, characterized in that, include: Acquire images of textile fabrics; The textile fabric image is transformed from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is: Where W is the width of the textile fabric image and H is the height of the textile fabric image. Based on the textile fabric image, a corresponding band-stop filter is constructed, and the first frequency domain image is band-stop filtered according to the band-stop filter to obtain a second frequency domain image with the background pattern removed. The second frequency domain image after removing the background texture is grayscale processed by a grayscale conversion algorithm to obtain a grayscale frequency domain image. Feature extraction is performed on the grayscale frequency domain image to obtain image texture features and RGB histogram statistical features of the second frequency domain image are extracted in the RGB color space. The second frequency domain image after removing the background texture is input into the pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structure is used to perform multi-layer encoding on the second frequency domain image after removing the background texture in order to extract the image depth features of the second frequency domain image. The image texture features, RGB histogram statistical features, and image depth features are fused to obtain enhanced depth features. The enhanced depth features are then input into an image classification model to classify the image and determine the classification category of the textile fabric image.
2. The textile fabric image classification method based on enhanced depth features as described in claim 1, characterized in that, The step of constructing a corresponding band-stop filter based on the textile fabric image, and performing band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed, includes: The textile fabric image is binarized using the Otsu threshold segmentation algorithm to obtain a textile binarized image, which is then divided into a background region, a main peak region, and a secondary peak region. The main peak region and secondary peak region are extracted from the textile binarized image, and the seed growth algorithm is used to grow the image at the center of the main peak to fill the main peak region in the textile binarized image. The binarized textile image after filling is inverted to obtain a frequency domain bandstop filter with 0 in the secondary peak region and 1 in other positions. The first frequency domain image of the textile fabric is filtered using the frequency domain band-stop filter to obtain a second frequency domain image with the background pattern removed.
3. The textile fabric image classification method based on enhanced depth features as described in claim 1, characterized in that, The process of converting the second frequency domain image after removing the background texture using a grayscale conversion algorithm to obtain a grayscale frequency domain image, and then extracting features from the grayscale frequency domain image to obtain image texture features, includes: The second frequency domain image after removing the background texture is converted from an RGB three-channel image to a single-channel grayscale frequency domain image using a grayscale conversion algorithm. Gaussian blur image denoising processing is performed on the grayscale frequency domain image; The denoised grayscale spectrum image is divided into a first preset number of sub-regions, where the first preset number is 16*16. For each pixel in each sub-region, the gray value is compared with the gray value of the 8 neighboring pixels. If the gray value of the surrounding pixels is greater than that of the pixel, the position of the surrounding pixels is marked as 1; otherwise, the position of the surrounding pixels is marked as 0. The textile texture value of the pixel is calculated based on the marking information of the surrounding pixels; Calculate the distribution histogram of textile texture values in each sub-region, and normalize the distribution histogram; The distribution histograms of each sub-region after normalization are connected to obtain the image texture features associated with the grayscale spectrum image.
4. The textile fabric image classification method based on enhanced depth features as described in claim 3, characterized in that, After concatenating the distribution histograms of each sub-region after normalization to obtain the image texture features associated with the grayscale spectral image, the method further includes: The image texture features are reduced to 64-dimensional image texture features using a fully connected layer. The reduced image texture features are the texture feature vector of the entire image.
5. The textile fabric image classification method based on enhanced depth features as described in claim 1, characterized in that, The step of extracting the RGB histogram statistical features of the second frequency domain image in the RGB color space includes: Extract the color values of each pixel in the second frequency domain image in the R, G, and B channels in the RGB color space; Color histogram statistics are performed on the extracted color values to obtain the color vectors corresponding to the R, G, and B channels of the second frequency domain image; The extracted color vectors are normalized to obtain normalized color vectors. The color orthogonal vectors of the three channels are concatenated to obtain the RGB histogram statistical features, and a fully connected layer is used to perform dimensionality reduction processing on the RGB histogram statistical features to obtain 64-dimensional RGB histogram statistical features.
6. The textile fabric image classification method based on enhanced depth features as described in claim 1, characterized in that, The second frequency domain image after removing the background texture is input into a pre-constructed convolutional neural network's depth feature extractor. The convolutional neural network with residual structures performs multi-layer encoding on the second frequency domain image to extract its image depth features, including: The first depth feature map is obtained by extracting depth features from the second frequency domain image after removing the background texture through convolutional layers and pooling layers. The depth feature map is passed sequentially through a 1*1 convolutional layer and a ReLU activation layer, then through a 3*3 convolutional layer and a ReLU activation layer, and finally through a 1*1 convolutional layer to obtain the second depth feature map. The second depth feature map output is added to the first depth feature map to form a residual connection, so as to obtain the 512-dimensional depth features of the textile fabric image.
7. The textile fabric image classification method based on enhanced depth features as described in claim 1, characterized in that, The process of fusing the image texture features, RGB histogram statistical features, and image depth features to obtain enhanced depth features, and then inputting these enhanced depth features into an image classification model to perform image classification and determine the classification category of the textile fabric image, includes: A fully connected layer is used to reduce the dimensionality of image texture features and RGB histogram statistical features to obtain 64-dimensional image texture features and RGB histogram statistical features; The 64-dimensional image texture features, RGB histogram statistical features, and image depth features are concatenated to form a 1*1*640-dimensional feature vector. The 1*1*640-dimensional feature vectors were fused and dimensionality-reduced using 1*1 convolution to obtain 1*1*512-dimensional feature vectors. A batch normalization (BN) layer is used to process the 1*1*512 dimensional feature vector to obtain enhanced deep features; The enhanced depth features are input into an image classification model for image classification, and the cross-loss entropy function is used to constrain the classification results.
8. A textile fabric image classification device based on enhanced depth features, characterized in that, include: Acquisition module: used to acquire images of textile fabrics; Frequency domain transformation module: used to transform the textile fabric image from the spatial domain to the frequency domain using a two-dimensional discrete Fourier transform formula to obtain a first frequency domain image of the textile fabric; the two-dimensional discrete Fourier transform formula is: Where W is the width of the textile fabric image and H is the height of the textile fabric image. Filtering module: used to construct a corresponding band-stop filter based on the textile fabric image, and to perform band-stop filtering on the first frequency domain image according to the band-stop filter to obtain a second frequency domain image with the background pattern removed; Grayscale conversion module: used to perform grayscale processing on the second frequency domain image after removing the background texture to obtain a grayscale frequency domain image by using a grayscale conversion algorithm, extract features from the grayscale frequency domain image to obtain image texture features, and extract the RGB histogram statistical features of the second frequency domain image in the RGB color space; Depth Extraction Module: The second frequency domain image after removing the background texture is input into the pre-built convolutional neural network's depth feature extractor. The convolutional neural network with residual structure performs multi-layer encoding on the second frequency domain image after removing the background texture to extract the image depth features of the second frequency domain image. The classification module is used to perform feature fusion on the image texture features, RGB histogram statistical features and image depth features to obtain enhanced depth features, and input the enhanced depth features into the image classification model to perform image classification to determine the classification category of the textile fabric image.
9. An electronic device, characterized in that, include: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the textile fabric image classification method based on enhanced depth features as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program causes a computer to perform the textile fabric image classification method based on enhanced depth features as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Face counterfeit image detection method and device, terminal and storage medium
CN115601820A
Intelligent processing technology and system of textile fabric
CN115661090A