Fabric defect terahertz detection method and system based on improved convolutional neural network

By combining the terahertz time domain spectroscopy system and the improved convolutional neural network model, the problem of insufficient accuracy, efficiency and applicability of cloth defect identification and classification in the prior art is solved, and efficient and accurate cloth defect detection is achieved.

CN119810574AActive Publication Date: 2025-04-11QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)

Patent Information

Application Number
CN202510285944.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-04-11
Estimated Expiration
2045-03-12

AI Technical Summary

Technical Problem

The prior art has problems with insufficient detection accuracy, calculation efficiency and applicability in the identification and classification of fabric defects, which is difficult to meet the textile industry's demand for efficient and accurate fabric defect detection.

Method used

Combining the terahertz time domain spectroscopy system and the improved convolutional neural network model, the terahertz absorption coefficient is obtained by acquiring and preprocessing the terahertz time domain spectroscopy signals, and the absorption coefficient is fused with the imaging image, and the improved convolutional neural network model is input for identification and classification. The improved convolutional neural network model includes multiple layers of convolutional blocks and jump connections with asymmetric convolution kernels to improve the accuracy and classification speed of defect recognition.

Benefits of technology

It significantly improves the accuracy and classification speed of fabric defect identification, realizes efficient automatic identification and classification, and meets the textile industry's demand for efficient and accurate inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810574A_ABST
    Figure CN119810574A_ABST
Patent Text Reader

Abstract

The invention discloses a fabric defect terahertz detection method and system based on an improved convolutional neural network, and the method comprises the steps: obtaining an imaging image of a fabric sample according to a spectrum signal, carrying out the preprocessing, and obtaining a terahertz absorption coefficient of the sample according to the inversion of the spectrum signal; inputting input data obtained by fusing the absorption coefficient and the imaging image into a pre-trained improved convolutional neural network model for identification and classification to obtain a cloth defect classification result; the improved convolutional neural network model comprises an input layer, a convolutional layer, a connection layer, a global average pooling layer and a classification layer which are connected in sequence; the input layer receives input data and inputs the input data to the convolution layer for feature extraction; the convolution layer is a plurality of layers of convolution blocks with asymmetric convolution kernels, and jump connection is introduced between the convolution blocks. By combining a terahertz time-domain spectroscopy system and an improved convolutional neural network model, the accuracy of cloth defect identification and the performance of classification speed are improved, and efficient automatic identification and classification are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloth defect detection, and in particular to a terahertz cloth defect detection method and system based on an improved convolutional neural network. Background Art

[0002] The statements in this section merely provide background information related to the present disclosure and do not necessarily constitute prior art.

[0003] In today's textile industry, fabrics, as key raw materials, play a vital role in many fields such as clothing manufacturing and home decoration. However, during the production and transportation of fabrics, due to factors such as equipment failure and improper process control, defects such as snagging, holes, stains, twisting, yarn overlap, and yarn scraping often occur inside or on the surface of the fabric. These defects not only destroy the aesthetics of the finished product, but also seriously affect the durability and stability of the fabric, increase the difficulty of cutting, and thus reduce production efficiency and product quality. Therefore, how to efficiently and accurately detect, identify, and classify fabric defects has become a key issue that needs to be urgently solved in the textile industry.

[0004] Traditional fabric defect detection mainly relies on manual visual inspection. This method is not only time-consuming and labor-intensive, but also the detection accuracy is easily interfered by subjective factors, resulting in instability and inconsistency of the detection results. With the rapid development of computer vision and artificial intelligence technology, a series of methods for non-destructive detection of fabric defects have emerged, such as X-ray detection, ultrasonic detection, infrared detection, and detection methods based on machine vision. However, these methods have obvious shortcomings in practical applications. Although X-ray detection can penetrate a variety of fabrics, its equipment is expensive and has certain radiation, posing a potential threat to the health of operators. Ultrasonic technology can determine the internal structural integrity of fabrics, but its detection results are greatly affected by material properties, and it is more difficult to detect fabrics with complex shapes and structures. Infrared detection can quickly locate abnormal areas in fabrics through thermal imaging technology, but this method is greatly affected by the surface roughness of the material and the ambient temperature, making it difficult to ensure the stability and accuracy of the detection results. Although machine vision technology can clearly capture the subtle textures and defects on the surface of fabrics, it has strict requirements on light stability. Changes in ambient light can easily affect detection accuracy, limiting its application in complex environments. In recent years, the terahertz time-domain spectroscopy (THz-TDS) system has shown great application potential in the field of non-destructive testing of fabrics due to its strong penetration ability, high resolution, high safety, not easily affected by light, and fingerprint spectrum.

[0005] In terms of fabric detection, the THz-TDS system can identify the structure and composition of fabrics without damaging the material, providing a new technical means for fabric defect detection. However, in practical applications, in order to further improve the recognition accuracy and classification speed, it is necessary to automatically identify and classify fabric images containing defects. Previous research methods are mostly based on likelihood or feature classification, but these methods have problems such as insufficient computing power or insufficient signal feature engineering experience in practical applications, and it is difficult to meet the needs of automatic detection in industrial inspection. In order to overcome these difficulties, fabric defect classification methods based on image processing and deep learning have gradually become a research hotspot. Among them, Convolutional Neural Network (CNN) has become one of the mainstream technologies for solving the problem of fabric defect classification because it can automatically extract features at different levels from data and has good deep scalability. Although the terahertz characterization system based on the deformable attention convolutional neural network framework in the prior art realizes the automatic positioning of defects, it has poor accuracy in identifying some subtle or complex defect features; although the terahertz signal deep learning model based on the convolutional neural network in the prior art analyzes tiny defects inside the material, it has high computational complexity and long running time; the prior art proposes a multi-scale non-jump U-shaped deep convolutional autoencoder defect detection model based on hybrid attention, but with the increase of the number of network layers, there are problems of gradient vanishing and information loss.

[0006] In summary, the existing technology still has many deficiencies in fabric defect recognition and classification, especially in terms of detection accuracy, computational efficiency, and applicability, which makes it difficult to meet the textile industry's demand for efficient and accurate fabric defect detection. Therefore, it is urgent to develop a new fabric defect detection method to overcome the limitations of existing technology, improve recognition accuracy and classification efficiency, and promote the sustainable development of the textile industry. Summary of the invention

[0007] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides a terahertz detection method and system for fabric defects based on an improved convolutional neural network, which combines the terahertz time-domain spectroscopy system and the improved convolutional neural network model, improves the accuracy of fabric defect recognition and the performance of classification speed, and realizes efficient automatic recognition and classification.

[0008] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions: In a first aspect, the present invention provides a terahertz detection method for fabric defects based on an improved convolutional neural network, comprising: Acquire the terahertz time-domain spectrum signal of the fabric sample to be tested and perform preprocessing; Obtaining an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and performing preprocessing, obtaining a terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fusing the absorption coefficient and the preprocessed imaging image to obtain input data; The input data is input into a pre-trained improved convolutional neural network model for identification and classification to obtain a classification result of a fabric defect; the improved convolutional neural network model comprises an input layer, a convolutional layer, a connection layer, a global average pooling layer and a classification layer which are sequentially connected; the input layer fuses the received absorption coefficient and the pre-processed imaging image to obtain input data, and the input data is input into the convolutional layer for feature extraction; the convolutional layer is a multi-layer convolutional block with an asymmetric convolutional kernel, and jump connections are introduced between the convolutional blocks.

[0009] A further technical solution is to establish a terahertz transmission model based on the interaction between the terahertz wave and the fabric sample, and to obtain the terahertz absorption coefficient of the fabric sample to be tested by inverting the terahertz transmission model.

[0010] In a further technical solution, the absorption coefficient is expressed as:

[0011] in, represents the sample thickness, represents the real refractive index of the sample, Represents the magnitude response of the transfer function.

[0012] According to a further technical solution, the convolution layer includes a first convolution block, a pooling layer, a feature fusion module, an information enhancement module, and two depth processing modules which are connected in sequence.

[0013] A further technical solution is that the feature fusion module receives the first feature map output by the first convolution block, and inputs it to the first branch and the second branch respectively. The first branch is processed by the second convolution block and the pooling layer in turn to obtain a first fused feature map. The second branch is processed by the third convolution block to obtain a second fused feature map. The first fused feature map and the second fused feature map are jointly input into the connection layer for feature fusion to obtain a second feature map.

[0014] A further technical solution is that the information enhancement module receives the third feature map output by the pooling layer and inputs it into the third branch and the fourth branch respectively; the third feature map in the third branch is processed by the pooling layer and then input into the add layer; the third feature map in the fourth branch is processed by the pooling layer and the asymmetric convolution module in sequence to obtain a first enhanced feature map; the first enhanced feature map is input into the add layer of the third branch and feature fused with the third feature map processed by the pooling layer to obtain a second enhanced feature map; the second enhanced feature map is input into the next asymmetric convolution module for processing to obtain a third enhanced feature map; the third enhanced feature map and the second enhanced feature map are input into the add layer together for feature fusion to obtain a fourth feature map.

[0015] A further technical solution is that the depth processing module receives the fourth feature map output by the information enhancement module and inputs it into the fifth branch and the sixth branch respectively, the fourth feature map in the fifth branch is processed by the pooling layer and then input into the add layer, the fourth feature map in the sixth branch is processed by the first asymmetric convolution module to obtain a first depth feature map, the first depth feature map is input into the add layer of the fifth branch and feature fused with the fourth feature map processed by the pooling layer to obtain a second depth feature map, the second depth feature map is input into the asymmetric convolution module for processing to obtain a third depth feature map, the third depth feature map and the second depth feature map are input into the add layer together for feature fusion to obtain the fifth feature map.

[0016] In a second aspect, the present invention provides a terahertz detection system for fabric defects based on an improved convolutional neural network, comprising: A data acquisition module is configured to: acquire the terahertz time-domain spectrum signal of the fabric sample to be tested and perform preprocessing; A data processing module, which is configured to: obtain an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and perform preprocessing, obtain a terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fuse the absorption coefficient and the preprocessed imaging image to obtain input data; The model recognition module is configured to: input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain a cloth defect classification result; the improved convolutional neural network model includes an input layer, a convolution layer, a connection layer, a global average pooling layer and a classification layer connected in sequence; the input layer fuses the received absorption coefficient and the pre-processed imaging image to obtain input data, and inputs the input data into the convolution layer for feature extraction; the convolution layer is a multi-layer convolution block with an asymmetric convolution kernel, and jump connections are introduced between the convolution blocks.

[0017] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the terahertz detection method for fabric defects based on an improved convolutional neural network as described in the first aspect.

[0018] In a fourth aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the terahertz detection method for fabric defects based on an improved convolutional neural network as described in the first aspect are implemented.

[0019] One or more of the above technical solutions have the following beneficial effects: The present invention combines the terahertz time-domain spectroscopy system with an improved convolutional neural network model. This innovation significantly improves the defect recognition accuracy and classification speed, enhances the performance of fabric defect recognition accuracy and classification speed, and realizes efficient automatic recognition and classification.

[0020] For THz signals generated by complex fabric backgrounds, easily confused defect categories, and blurred fabric edges, the traditional convolutional neural network algorithm has insufficient feature extraction capabilities and a long algorithm running time, and cannot efficiently distinguish various types of defects. For this reason, the present invention combines the recognition advantages of the terahertz time-domain spectroscopy system and uses an improved convolutional neural network model for recognition and classification. First, the spectral signal of the sample is obtained using the terahertz time-domain spectroscopy system, and then the sample transmission model is established and the terahertz absorption coefficient is inverted and calculated; then the absorption coefficient and image data are correspondingly fused and used as a data set to train the improved convolutional neural network model; the model uses multiple layers of convolution blocks with asymmetric convolution kernels to improve the accuracy of defect recognition and classification speed, and uses a jump connection structure to resist the problems of gradient disappearance and overfitting, so as to achieve accurate recognition and efficient classification of different defects in fabrics. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0022] Figure 1 This is a schematic diagram of the transmission principle of a transmission type terahertz wave according to an embodiment of the present invention; Figure 2 is an architecture diagram of an improved convolutional neural network model according to an embodiment of the present invention; Figure 3 is a physical picture of an experimental sample of an embodiment of the present invention; Figure 4 is a schematic diagram of a terahertz time-domain spectroscopy system according to an embodiment of the present invention; Figure 5It is the original image of the imaging image of the sample of the embodiment of the present invention at 1.1 THz; Figure 6 is an image after median filtering in the imaging image of the sample of the embodiment of the present invention; Figure 7 is an image after grayscale stretching in the imaging image of the sample of the embodiment of the present invention; Figure 8 is a time domain diagram of a reference signal and a sample signal according to an embodiment of the present invention; Fig. 9 is a frequency domain diagram of a reference signal and a sample signal according to an embodiment of the present invention; Fig.10 is a curve chart of the accuracy of the improved convolutional neural network model in the model training of the embodiment of the present invention; Fig.11 is a graph of the loss function of the improved convolutional neural network model in the model training of the embodiment of the present invention; Fig.12 is the training set confusion matrix of the traditional CNN model in the embodiment of the present invention; Fig.13 is the training set confusion matrix of the improved CNN model according to an embodiment of the present invention; Fig.14 is the test set confusion matrix of the traditional CNN model in the embodiment of the present invention; Fig.15 is the test set confusion matrix of the improved CNN model according to an embodiment of the present invention; Fig.16 is the verification set confusion matrix of the traditional CNN model in the embodiment of the present invention; Fig.17 It is the verification set confusion matrix of the improved CNN model according to the embodiment of the present invention. DETAILED DESCRIPTION

[0023] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0024] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0025] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0026] Embodiment 1 This embodiment discloses a terahertz detection method and system for fabric defects based on an improved convolutional neural network. The method comprises the following steps: S1: Obtain the terahertz time domain spectrum signal of the fabric sample to be tested and perform preprocessing; In this embodiment, if Figure 3 As shown in the figure, in order to simulate different types of fabric defect modes, six types of defects, including holes, snagging, stains, unevenness, lamination of the same material, and lamination of different materials, and one type of fabric without defects were prepared on a piece of pure cotton fabric sample for comparison. Figure 4 As shown, the terahertz time-domain spectroscopy system of Zomega Company of the United States is used to scan the fabric sample point by point with a step length of 0.05 mm to obtain the terahertz time-domain spectral signal of each collection point, that is, the original spectral data.

[0027] The Savitzky-Golay filtering algorithm is used to preprocess the raw spectral data to reduce the noise interference caused by the instrument or environment, so as to improve the accuracy and reliability of the classification model. The basic formula of SG filtering can be expressed as: (1) in, yes The smoothing value at is the point of the original data, is the offset within the window, are the coefficients of the filter, is the half-width of the window.

[0028] S2: obtaining an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and performing preprocessing, obtaining the terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fusing the absorption coefficient and the preprocessed imaging image to obtain input data; In this embodiment, a specific frequency imaging method is used according to the terahertz time-domain spectroscopy signal to obtain the imaging results of the cloth sample at different frequencies, and the image is clearest at 1.1 THz. Figure 5 As shown in the figure, the image with the highest resolution of 1.1 THz is selected as the basic data, as shown in the figure Figure 6 , Figure 7 As shown, the image is preprocessed by median filtering, grayscale stretching and other operations to remove noise points and blurred areas in the image and enhance defect features.

[0029] The processed image data and spectral data are matched one by one to form a data set, and then the data set is marked. Among them, the area without defects is marked as 0, the defects of pure cotton-polyester material laminate are marked as 1, the defects of pure cotton material double laminate are marked as 2, the defects of stains are marked as 3, the defects of holes are marked as 4, the defects of snagging are marked as 5, and the defects of distortion and unevenness are marked as 6. Considering that the holes and snagging defects are close to each other, the areas containing both holes and snagging defects are defined as mixed defects and marked as 7. The 552,900 complete data sets containing multiple defect types are divided into training set, test set and validation set in a ratio of 7:1.5:1.5.

[0030] In this embodiment, a terahertz transmission model of a fabric sample is established based on the spectral signal measured by the terahertz time-domain spectroscopy system. The optical properties of the fabric sample in the terahertz frequency band, namely the absorption coefficient, are obtained by inverting the terahertz transmission model. The absorption coefficient can be used to determine the strength of the sample's ability to absorb terahertz waves, thereby distinguishing different defects in the sample.

[0031] The terahertz transmission model of the sample is established as follows: like Figure 1 As shown in the figure, assuming that in the transmission mode, the terahertz wave emitted by the THz-TDS system is a plane wave, and the incident terahertz wave is called When the terahertz wave passes directly through the air, without considering atmospheric loss and scattering, the received signal is called the reference wave. When a terahertz wave is incident from one medium (such as air) to another medium (such as a sample), the received signal is called the sample wave. .

[0032] The interaction between the terahertz wave and the sample is described by the Maxwell equations. The relationship between the electromagnetic field quantities is established based on its boundary conditions, and the reflection coefficient at the interface of different media is obtained by the Fresnel formula ( ) and the transmission coefficient ( ). The formula is as follows: (2) (3) in, represents the complex refractive index of terahertz wave in air, represents the complex refractive index of the terahertz wave in the sample, and represent the angle of incidence and the angle of refraction respectively.

[0033] The relationship between the refractive index and the refraction angle, namely the Snell formula, is then derived as follows: . (4) When the terahertz wave propagates in the sample, its amplitude will attenuate and its phase will be delayed. The changes are described by the propagation factor, which is expressed as: (5) in, represents the propagation factor, Complex refractive index, is the angular frequency, is the propagation distance, represents the imaginary unit, It's the speed of light.

[0034] It can be seen from formula (5) that this attenuation and delay is determined by the complex refractive index of the sample, which can be expressed as: (6) in, is the refractive index, represents the imaginary unit, is the extinction coefficient.

[0035] When a terahertz wave is incident on a sample at a certain angle, the Fabry-Perot effect (FP effect) occurs, part of the wave is reflected, and part of the wave penetrates the sample and is refracted and reflected multiple times inside. The terahertz signal is called .

[0036] Assuming that no sample is placed, the total path of terahertz propagation in the air is , the projection distance in the optical fiber propagation direction is , is the thickness of the sample, and the length of the light beam for a single reflection is ; After placing the sample, the propagation distance of the terahertz wave in the air is , and perform multiple echoes, as shown in formula (7): (7) in, represents the reference wave, represents the original terahertz wave, represents the airborne transmission factor, represents the sample wave, represents the original transmitted terahertz wave, Indicates Second transmission echo, Indicates the number of echoes. Represents the projection distance, represents the sample thickness, represents the length of the ray, represents the incident angle of the terahertz wave with the sample surface, represents the refraction angle between the terahertz wave and the sample surface.

[0037] The reference signal and sample signal are obtained as shown in formulas (8) and (9): (8) (9) in, represents the reference wave, represents terahertz waves, represents the complex refractive index in air, represents the propagation factor of terahertz in air, represents the transmittance from air to the sample, represents the terahertz propagation factor in the sample, represents the transmittance from the sample to the air, Represents the reflectivity of the sample.

[0038] Its transfer function is expressed as: (10) in, represents the sample wave, represents the reference wave, represents the complex refractive index of terahertz wave in air, represents the complex refractive index of the terahertz wave in the sample, and denote the angle of incidence and the angle of refraction respectively, represents the imaginary unit, represents the length of the ray, Represents the projection distance, represents the angular frequency, represents the speed of light, Indicates the number of echoes. represents the reflectivity of the sample, represents the terahertz propagation factor in the sample. Represents the transmission function, which is used to establish a mathematical description of the transmission behavior of the sample, also known as the terahertz transmission model.

[0039] The FP effect factor is expressed as: (11) in, Indicates the number of echoes. Represents the reflectivity of the sample.

[0040] In order to extract the correct target signal, it is assumed that the terahertz incident on the sample is vertical and the FP effect is 1, that is, , , and its transfer function is: . (12) In the case of weak absorption, when When . Based on the relationship between the modulus and the auxiliary angle and Lambert's law, it can be expressed as: (13) in, is the transfer function, represents the magnitude response of the transfer function, Indicates the phase, represents the real refractive index of the sample, represents the extinction coefficient of the sample, is the absorption coefficient, Represents the extinction coefficient.

[0041] The absorption coefficient is obtained, expressed as: (14) in, represents the real refractive index of the sample, represents the extinction coefficient, is the thickness of the sample.

[0042] S3: Input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain a cloth defect classification result.

[0043] like Figure 2 As shown in the figure, Convolutional Neural Network (CNN) is a deep learning architecture, which is mainly composed of input layer, convolution layer, pooling layer, fully connected layer and output layer. The large amount of data measured by the terahertz time-domain spectroscopy system leads to slow classification speed. The traditional CNN has poor recognition and classification effect based on single defect features, which requires the improvement of convolutional neural network to optimize and innovate in classification accuracy and classification speed. Therefore, an efficient classification convolutional neural network architecture is proposed.

[0044] The improved convolutional neural network model includes the input layer, convolution layer, connection layer, global average pooling layer, and classification layer (including fully connected layer and softmax layer) connected in sequence. The specific model architecture is shown in Table 1 below, which clearly shows the data dimensions of different layers after being processed by each module.

[0045] Table 1 Architecture details

[0046] (1) Improvement of the input layer The input layer receives input data and inputs it into the convolution layer for feature extraction. Specifically, the input layer is the starting point for the neural network to process data. When the input layer only receives a single data or image, the amount of information that the model can obtain is relatively limited, which may cause the model to perform poorly when processing complex tasks and fail to understand and analyze problems from multiple angles or dimensions. In order to solve this problem, the present invention converts the originally complex one-dimensional spectral data (i.e., the absorption coefficient) into a two-dimensional matrix form similar to the imaging image, and then corresponds one-to-one with the imaging image in the channel dimension, and after fusion, it is sent to the network model as input data. Among them, each signal frame of the data set is organized into a two-dimensional array of size 2×1024.

[0047] (2) Improvement of convolutional layer The convolution layer is a multi-layer convolution block with asymmetric convolution kernels, and jump connections are introduced between convolution blocks. The convolution layer includes the first convolution block, the pooling layer, the feature fusion module A, the information enhancement module B, and two depth processing modules C connected in sequence.

[0048] The input data passes through the first convolution block (i.e., convolution2dLayer convolution layer) to cover the common features and obtain the first feature map The first convolutional block has a kernel size of 3×7 and reduces the spatial dimension with a stride of (1, 2).

[0049] It should be noted that, considering Figure 2 The size of the activation function layer in the improved convolutional neural network model architecture is Figure 2 It is omitted and not drawn in the figure. Figure 2 Each convolutional layer conv in contains convolution2dLayer convolution layer and reluLayer activation function layer. And Figure 2 The concat connection layers are all spliced ​​according to the depth dimension through depthConcatenationLayer.

[0050] like Figure 2 As shown, the feature fusion module A includes a base layer base, a first branch and a second branch connected in sequence, and a connection layer concat; the first branch includes a second convolution block and a pooling layer connected in sequence, and the second branch includes a third convolution block. The convolution kernel size of the second convolution block is 3×1, and the convolution kernel size of the third convolution block is 1×3.

[0051] In order to minimize the number of trainable parameters and ensure that the quality of extracted features is not reduced, two layers of asymmetric convolution kernels are arranged in parallel in the feature fusion module A, namely a 3×1 vertical kernel (the second convolution block) and a 1×3 horizontal kernel (the third convolution block). It is worth noting that both convolution and pooling operations are performed with a step size of (1, 2), which can quickly reduce the horizontal dimension of the feature map and reduce the computational cost. Specifically, the base layer in the feature fusion module receives the first feature map And input into the first branch and the second branch respectively, in the first branch The first fusion feature map is obtained by processing the second convolution block and the pooling layer in sequence. , in the second branch After processing by the third convolution block, the second fused feature map is obtained , the first fusion feature map and the second fusion feature map The two are input to the connection layer concat for feature fusion to obtain the second feature map .

[0052] The second feature map output by the feature fusion module A Input to the pooling layer (i.e. maxPooling2dLayer maximum pooling layer), downsample the feature map to obtain the third feature map , to learn more explicit discriminative features.

[0053] like Figure 2 As shown, the information enhancement module B includes a base layer base, a third branch and a fourth branch connected in sequence, and an add layer (additionLayer). The third branch includes a pooling layer and an add layer connected in sequence; the fourth branch includes a pooling layer and two asymmetric convolution modules connected in sequence; the asymmetric convolution module includes a fourth convolution block connected in sequence, a second convolution block, a third convolution block and a fourth convolution block in parallel, and a connection layer concat; the convolution kernel of the fourth convolution block is 1×1. It should be noted that the output of the first asymmetric convolution module is connected to the add layer of the third branch, and the output of the add layer is connected to the second asymmetric convolution module. In other words, the two asymmetric convolution modules are connected through the add layer, and the input of the second asymmetric convolution module is a fusion of the output features of the first asymmetric convolution module and the third branch.

[0054] The information enhancement module B contains two asymmetric convolution modules, one of which is: the fourth convolution block is then connected to asymmetric convolution kernels of size 3×1, 1×3, and 1×1 respectively, and spliced ​​in depth dimension through depthConcatenationLayer in the connection layer; the fourth convolution block (1×1 convolution layer) directly connected after the output of the pooling layer is used for feature extraction, and the fourth convolution block parallel to the second and third convolution layers is used to reduce the channel dimension. The features obtained by the first asymmetric convolution module are fused with the features after maxpooling pooling in the third branch by additionlayer, which greatly enhances the overall feature expression ability compared with the single feature extraction path of traditional CNN. The fused features are input to the second asymmetric convolution module for processing, that is, 1×1 convolution, 3×1, 1×3, and 1×1 convolutions are performed again, and the output feature map is deeply spliced ​​by depthConcatenationLayer. The spliced ​​features are fused at the element level with the features output by the third branch through additionLayer to gradually learn feature information.

[0055] Specifically, the base layer in the information enhancement module B receives the third feature map And input to the third branch and the fourth branch respectively, the third feature map in the third branch After being processed by the pooling layer, it is input to the add layer. The third feature map in the fourth branch After being processed by the pooling layer and the asymmetric convolution module in sequence, the first enhanced feature map is obtained. ,Will The input to the add layer of the third branch and the input after the pooling layer Perform feature fusion to obtain the second enhanced feature map ,Will Input to the next asymmetric convolution module for processing to obtain the third enhanced feature map ,Will and The four feature maps are input into the add layer for feature fusion to obtain the fourth feature map. .

[0056] like Figure 2As shown, the depth processing module C includes a base layer base, a fifth branch and a sixth branch connected in sequence, and an add layer (additionLayer). The fifth branch includes a pooling layer and an add layer connected in sequence; the sixth branch includes a first asymmetric convolution module and an asymmetric convolution module connected in sequence; the first asymmetric convolution module includes a fourth convolution block connected in sequence, a second convolution block, a third convolution block and a fourth convolution block connected in parallel to the pooling layer, and a connection layer; the asymmetric convolution module includes a fourth convolution block connected in sequence, a second convolution block, a third convolution block and a fourth convolution block connected in parallel, and a connection layer concat; it should be noted that the output of the first asymmetric convolution module is connected to the add layer of the fifth branch, and the output of the add layer is connected to the asymmetric convolution module, that is, the first asymmetric convolution module is connected to the asymmetric convolution module through the add layer, and the input of the asymmetric convolution module is a fusion of the output features of the first asymmetric convolution module and the fifth branch.

[0057] The second convolution block in the first asymmetric convolution module is connected to the pooling layer to process the features and reduce the amount of calculation.

[0058] The depth processing module C includes the first asymmetric convolution module and the asymmetric convolution module. The first asymmetric convolution module first passes through a convolution layer with a convolution kernel of 1×1, and then performs asymmetric convolution kernels of 3×1, 1×3, and 1×1 in parallel. The convolution kernel of size 3×1 is connected to the pooling layer maxpooling to reduce the dimension of the features and reduce the amount of calculation. Then, the depthConcatenationLayer is fused with the convolution kernels of 1×3 and 1×1, and the fused features are spliced ​​with the features after pooling in the fifth branch through the addition layer, and the features of different dimensions are combined to enrich the feature information. The features after splicing and fusion of the addition layer are input to the asymmetric convolution module for processing. First, it passes through a convolution layer with a convolution kernel of 1×1, and then performs asymmetric convolution kernels of 3×1, 1×3, and 1×1 in parallel, and then spliced ​​in the connection layer according to the depth dimension; the spliced ​​features are fused at the element level with the features output by the fifth branch through the additionLayer to obtain a fused feature map.

[0059] Specifically, the base layer in the depth processing module C receives the fourth feature map And input into the fifth and sixth branches respectively. After being processed by the pooling layer, it is input to the add layer. The first depth feature map is obtained by processing with the first asymmetric convolution module ,Will The input to the add layer of the fifth branch and the processed by the pooling layer Perform feature fusion to obtain the second deep feature map ,Will Input to the asymmetric convolution module for processing to obtain the third depth feature map ,Will and The two are input to the add layer for feature fusion to obtain the fifth feature map. .

[0060] Fifth characteristic diagram Input to the next depth processing module C for the same processing operation to obtain the sixth feature map , and input to the connection layer for processing.

[0061] (3) Improvement of the connection layer In order to improve the accuracy of the classification model and alleviate the negative impact of the gradient vanishing problem caused by the activation function in the network, skip connections are introduced between the convolution blocks, which allows the various features extracted in each block to be integrated together to maintain the information identity in the entire network to enrich the classification model. It should be noted that this skip connection allows the module to learn residual information instead of the traditional true output. Therefore, the improved CNN model can resist the problems of gradient vanishing and overfitting during the network training stage.

[0062] At the end of the model, the feature map output by the last deep processing module C is combined with the output of the previous jump connection through the connection layer, and then the global average pooling layer (averagePooling2dLayer) is further connected to convert the feature map into a fixed-length vector, and then connected to the fully connected layer (fullyConnectedLayer), and the dropoutLayer is added to prevent overfitting and ensure the generalization ability of the model. Among them, the number of hidden units in the fully connected layer is represented by C, and the value of C is set to the same number of signal modulation methods in the provided data set; finally, softmax (softmaxLayer) is connected to realize multi-category classification tasks and output defect classification results.

[0063] Furthermore, the jump connection specifically refers to the add layer set in the information enhancement module B and the depth processing module C, through which the feature maps after the connection operation of multiple branches or convolutions are added and fused element by element.

[0064] The improved convolutional neural network model was trained using the training set data. The stochastic gradient descent optimization algorithm was used, combined with the cross entropy loss function, and the model weight parameters were dynamically adjusted. After 4500 iterations of training, the loss function value of the model on the training set converged to a stable low value. When the stochastic gradient descent method was used as the optimizer for model training, 128 samples were used for parameter update in each iteration to balance training efficiency and memory consumption. The maximum number of training rounds was set to 60, that is, the model would be trained 60 times on the entire training set. The initial learning rate was set to 0.01, and the segmented learning rate adjustment strategy was adopted. The learning rate was decayed to 0.1 times the original every 30 rounds, so as to gradually fine-tune the model parameters as the training progressed and avoid falling into the local optimal solution. Data shuffling was enabled before each round of training to ensure that the model was exposed to data of different orders in different training cycles and enhance the generalization ability. The validation set was used to monitor the model performance, and the validation frequency was set to every 30 rounds. When the validation set loss did not decrease continuously, the training would be terminated early.

[0065] The experimental results and analysis are as follows: like Figure 8 , Fig. 9 As shown in the figure, the data measured by the terahertz time-domain spectroscopy system are plotted to draw the time domain and frequency domain diagrams of the reference signal and sample signal. By comparing the time domain diagrams of passing through air (reference signal), defect-free cloth, holes, dyeing, snagging, unevenness, double-layered pure cotton material, and pure cotton-polyester laminated cloth, it can be seen that there is a time delay and amplitude attenuation between the time domain reference signal and the sample signal. The time delay is due to the different refractive indices of terahertz passing through different samples, and the amplitude attenuation is due to the absorption and random scattering of the sample. The corresponding frequency domain diagram is shown in the figure below. Fig. 9 As shown in the figure, it can be clearly seen that the electric field of the sample signal is weakened compared with the reference signal, which is due to the different absorption of terahertz waves by samples at different defects. These results show that different defects can be characterized by different features within the terahertz spectrum range, and terahertz time-domain spectroscopy imaging is feasible for fabric detection.

[0066] The nominal spectrum range of the terahertz time-domain spectroscopy system used in the experiment is 0.1-4.0 THz. In order to obtain a better signal-to-noise ratio, the spectrum analysis selected the spectrum range of 0.1 to 1.5 THz. The THz absorption coefficient of each defect is calculated by using formula (12), and the absorption coefficient data of different fabric defects are fused with the image data and input into the improved CNN model. After multiple rounds of iterative training, Fig.10 As shown in the figure, as the number of training rounds increases, the accuracy continues to rise and tends to stabilize at a high level. The improved CNN model achieves a classification accuracy of up to 99.4%. Fig.11The loss value shown decreases rapidly and gradually approaches 0, which indicates that the model has good learning ability and generalization performance and can accurately identify fabric defects.

[0067] The model comparison analysis is as follows: To further verify the advantages of the improved CNN method proposed in this invention, the traditional CNN model is used for comparison. The results show that although the traditional CNN model can use image information for classification, it is not capable of identifying subtle and hidden defects, with an accuracy of 93.3%, which is about 6% lower than that of the improved CNN method.

[0068] In order to more comprehensively evaluate the performance of the classification model, the present invention introduces the F1 score as a model evaluation indicator based on the classification accuracy of the comparison model. As shown in Table 2, the improved CNN model achieves good values ​​in the four evaluation indicators of accuracy, precision, recall rate, and F1 score, and is superior to the traditional CNN model.

[0069] Table 2 Performance comparison of different classification models

[0070] In order to more intuitively evaluate the classification performance of the model, the confusion matrix is ​​made for the traditional CNN model and the improved CNN model. Figure 12-Figure 17 As shown, the confusion matrix is ​​a two-dimensional matrix. The rows represent the true labels, the columns represent the labels predicted by the model, and each element of the matrix represents the number of samples for which the model predicts the true labels as the corresponding column labels. In the horizontal and vertical axes, 1 represents the classification of fabrics without defects, 2 represents the defect classification of pure cotton-polyester laminates, 3 represents the defect classification of pure cotton double laminates, 4 represents the defect classification of stains, 5 represents the defect classification of holes, 6 represents the defect classification of snagging, 7 represents the defect classification of distortion and unevenness, and 8 represents the mixed defect classification that contains both hole and snagging defect features. Fig.12 is the confusion matrix of the training set of the CNN model, and its accuracy is 93.5%. Fig.13 In order to improve the confusion matrix of the training set of the CNN model, the accuracy rate was 99.39%, and the two models whose accuracy tended to be stable after iteration were used for the classification of 8 kinds of fabrics. Fig.14 The test set confusion matrix of the CNN model is Fig.15The test set confusion matrix analysis of the improved CNN model shows that the CNN model uses the image data set as input data, and the model accuracy is 93.33%. The improved CNN model uses the THz absorption coefficient fusion image data as input data, and the accuracy is 98.49%. Among them, the improved CNN method model misjudged type 2 (cotton-polyester material lamination defect) as no defect in one place and misjudged as a hole defect in one place; there were 1 misjudgments for type 3 (cotton material double lamination defect), type 5 (hole defect), type 6 (snagging defect), and type 7 (distortion and unevenness defect); there were 1 misjudgments for type 8 (mixed defect) as a hole defect and 3 misjudged as snagging defects. Analysis shows that the reason for the misjudgment may be that the absorption peaks of the defects are similar, which makes the model unable to distinguish correctly. Fig.16 The accuracy of the confusion matrix for the CNN model validation set is 93.46%. Fig.17 To improve the CNN model, the accuracy of the validation set confusion matrix is ​​100%.

[0071] It can be seen that the improved CNN model can meet the classification and recognition requirements of 8 types of fabric defects, and its classification and recognition accuracy is higher than that of the traditional CNN model.

[0072] Therefore, the present invention uses a terahertz time-domain spectroscopy system to obtain the spectral signal of the fabric, establishes a terahertz transmission model of the fabric, obtains the absorption coefficient of the fabric by inverse calculation from the data, and adopts a specific frequency imaging method to obtain an imaging image of the fabric from the spectral signal; the absorption coefficient and the imaging image are fused as a data set and input into an improved CNN model. Numerical experiments verify that the terahertz time-domain spectroscopy system combined with the improved CNN model can achieve efficient recognition and classification of different fabric defects, which provides a new solution for the recognition and classification of fabric defects and has high application value and research significance.

[0073] Embodiment 2 This embodiment discloses a terahertz detection system for fabric defects based on an improved convolutional neural network, comprising: A data acquisition module is configured to: acquire the terahertz time-domain spectrum signal of the fabric sample to be tested and perform preprocessing; A data processing module, which is configured to: obtain an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and perform preprocessing, obtain a terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fuse the absorption coefficient and the preprocessed imaging image to obtain input data; The model recognition module is configured to: input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain a cloth defect classification result; the improved convolutional neural network model includes an input layer, a convolution layer, a connection layer, a global average pooling layer and a classification layer connected in sequence; the input layer fuses the received absorption coefficient and the pre-processed imaging image to obtain input data, and inputs the input data into the convolution layer for feature extraction; the convolution layer is a multi-layer convolution block with an asymmetric convolution kernel, and jump connections are introduced between the convolution blocks.

[0074] Embodiment 3 The purpose of this embodiment is to provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method of embodiment 1 when executing the program.

[0075] Embodiment 4 The purpose of this embodiment is to provide a computer-readable storage medium, a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of the method of embodiment 1 are performed.

[0076] The steps involved in the apparatus of the above embodiments 3 and 4 correspond to the method embodiment 1, and the specific implementation method can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.

[0077] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.

[0078] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

[0079] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A terahertz detection method for fabric defects based on an improved convolutional neural network, characterized in that: include: Acquire the terahertz time-domain spectrum signal of the fabric sample to be tested and perform preprocessing; Obtaining an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and performing preprocessing, obtaining a terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fusing the absorption coefficient and the preprocessed imaging image to obtain input data; The input data is input into a pre-trained improved convolutional neural network model for identification and classification to obtain a classification result of a fabric defect; the improved convolutional neural network model comprises an input layer, a convolutional layer, a connection layer, a global average pooling layer and a classification layer which are sequentially connected; the input layer fuses the received absorption coefficient and the pre-processed imaging image to obtain input data, and the input data is input into the convolutional layer for feature extraction; the convolutional layer is a multi-layer convolutional block with an asymmetric convolutional kernel, and jump connections are introduced between the convolutional blocks.

2. The terahertz detection method for cloth defects based on an improved convolutional neural network as claimed in claim 1, characterized in that: A terahertz transmission model is established based on the interaction between the terahertz wave and the fabric sample, and the terahertz absorption coefficient of the fabric sample to be tested is obtained by inverting the terahertz transmission model.

3. The terahertz detection method for cloth defects based on an improved convolutional neural network as claimed in claim 2, characterized in that: The absorption coefficient is expressed as: in, represents the sample thickness, represents the real refractive index of the sample, Represents the magnitude response of the transfer function.

4. The terahertz detection method for cloth defects based on an improved convolutional neural network as claimed in claim 1, characterized in that: The convolution layer includes a first convolution block, a pooling layer, a feature fusion module, an information enhancement module, and two depth processing modules which are connected in sequence.

5. The terahertz detection method for cloth defects based on an improved convolutional neural network as claimed in claim 4, characterized in that: The feature fusion module receives the first feature map output by the first convolution block and inputs it to the first branch and the second branch respectively. The first branch is processed by the second convolution block and the pooling layer in sequence to obtain a first fused feature map. The second branch is processed by the third convolution block to obtain a second fused feature map. The first fused feature map and the second fused feature map are jointly input to the connection layer for feature fusion to obtain a second feature map.

6. The terahertz detection method for cloth defects based on an improved convolutional neural network according to claim 5, characterized in that: The information enhancement module receives the third feature map output by the pooling layer and inputs it to the third branch and the fourth branch respectively; the third feature map in the third branch is processed by the pooling layer and then input to the add layer; the third feature map in the fourth branch is processed by the pooling layer and the asymmetric convolution module in sequence to obtain a first enhanced feature map; the first enhanced feature map is input to the add layer of the third branch and is subjected to feature fusion with the third feature map processed by the pooling layer to obtain a second enhanced feature map; the second enhanced feature map is input to the next asymmetric convolution module for processing to obtain a third enhanced feature map; the third enhanced feature map and the second enhanced feature map are input to the add layer together for feature fusion to obtain a fourth feature map.

7. The terahertz detection method for cloth defects based on an improved convolutional neural network according to claim 6, characterized in that: The depth processing module receives the fourth feature map output by the information enhancement module and inputs it into the fifth branch and the sixth branch respectively; the fourth feature map in the fifth branch is processed by the pooling layer and then input into the add layer; the fourth feature map in the sixth branch is processed by the first asymmetric convolution module to obtain a first depth feature map; the first depth feature map is input into the add layer of the fifth branch and is fused with the fourth feature map processed by the pooling layer to obtain a second depth feature map; the second depth feature map is input into the asymmetric convolution module for processing to obtain a third depth feature map; the third depth feature map and the second depth feature map are input into the add layer together for feature fusion to obtain a fifth feature map.

8. The terahertz detection system for fabric defects based on improved convolutional neural network is characterized by: include: A data acquisition module is configured to: acquire the terahertz time-domain spectrum signal of the fabric sample to be tested and perform preprocessing; A data processing module, which is configured to: obtain an imaging image of the fabric sample to be tested according to the preprocessed spectral signal and perform preprocessing, obtain a terahertz absorption coefficient of the fabric sample to be tested according to the preprocessed spectral signal inversion, and fuse the absorption coefficient and the preprocessed imaging image to obtain input data; The model recognition module is configured to: input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain a cloth defect classification result; the improved convolutional neural network model includes an input layer, a convolution layer, a connection layer, a global average pooling layer and a classification layer connected in sequence; the input layer fuses the received absorption coefficient and the pre-processed imaging image to obtain input data, and inputs the input data into the convolution layer for feature extraction; the convolution layer is a multi-layer convolution block with an asymmetric convolution kernel, and jump connections are introduced between the convolution blocks.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the terahertz detection method for cloth defects based on an improved convolutional neural network are implemented as described in any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the terahertz detection method for cloth defects based on an improved convolutional neural network are implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image filtering method and device and storage medium

    CN109815965A

  • Food-borne pathogenic bacterium classification method

    CN110245713A

  • Image processing method, image processing device and equipment

    CN111311629A

  • Rapid face detection and recognition method for DSP platform

    CN112749626A

  • Retinal vessel segmentation network and segmentation method based on improved Unet network, computer equipment and storage medium

    CN115546227A

Cited By

  • Wood surface defect online detection method based on image classification

    CN122347705A