Terahertz Detection Method and System for Fabric Defects Based on Improved Convolutional Neural Network
By combining the terahertz time domain spectroscopy system and the improved convolutional neural network model, the problems of insufficient detection accuracy, computing efficiency and applicability in fabric defect identification and classification are solved, and efficient and accurate fabric defect detection is achieved.
Patent Information
- Application Number
- CN202510285944.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-03-12
AI Technical Summary
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.
Combining the terahertz time domain spectroscopy system and the improved convolutional neural network model, the terahertz time domain spectroscopy signal and imaging images of the fabric are obtained, and the terahertz absorption coefficient is fused with the image data, 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.
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 fabric defect detection.
Smart Images

Figure CN119810574B_ABST
Abstract
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 the aspect of fabric detection, the THz-TDS system can identify the fabric structure and composition 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. Most of the previous research methods are based on likelihood or features for classification, but these methods have problems such as insufficient computing power or lack of signal feature engineering experience in practical applications, and it is difficult to meet the requirements of automatic detection in industrial inspection. To overcome these problems, the fabric defect classification method based on image processing and deep learning has gradually become a research hotspot. Among them, the Convolutional Neural Network (CNN) has become one of the mainstream technologies for solving fabric defect classification problems because it can automatically extract features at different levels from data and has good depth scalability. Although the terahertz characterization system based on the deformable attention convolutional neural network framework in the existing technology realizes the automatic positioning of defects, the accuracy is poor in the recognition of some subtle or complex defect features; although the deep learning model of terahertz signals based on convolutional neural network in the existing technology analyzes the tiny defects inside the material, the computational complexity is high and the running time is long; the existing technology proposes a multi-scale non-jumping U-shaped deep convolutional autoencoder defect detection model based on hybrid attention, but problems such as gradient disappearance and information loss occur as the number of network layers increases.
[0006] In summary, there are still many deficiencies in the existing technology in fabric defect recognition and classification, especially in terms of detection accuracy, computational efficiency, and applicability, which are difficult to meet the requirements of the textile industry for efficient and accurate fabric defect detection. Therefore, it is urgent to develop a new fabric defect detection method to overcome the limitations of the existing technology, improve the recognition accuracy and classification efficiency, and promote the sustainable development of the textile industry. Summary of the Invention
[0007] To overcome the above deficiencies of the existing technology, the present invention provides a terahertz detection method and system for fabric defects based on an improved convolutional neural network, which combines a terahertz time-domain spectroscopy system and an improved convolutional neural network model, improves the performance of fabric defect recognition accuracy and classification speed, and realizes efficient automatic recognition and classification.
[0008] To achieve the above object, one or more embodiments of the present invention provide the following technical solutions:
[0009] In the first aspect, the present invention provides a terahertz detection method for fabric defects based on an improved convolutional neural network, including:
[0010] Obtain the terahertz time-domain spectral signal of the fabric sample to be tested and perform preprocessing;
[0011] An imaging image of the cloth sample to be measured is obtained based on the preprocessed spectral signal and preprocessed. The terahertz absorption coefficient of the cloth sample to be measured is inversely obtained based on the preprocessed spectral signal. The absorption coefficient and the preprocessed imaging image are fused to obtain input data;
[0012] The input data is input 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 includes an input layer, a convolutional 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 preprocessed 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 asymmetric convolutional kernels, and skip connections are introduced between the convolutional blocks.
[0013] In a further technical solution, a terahertz transmission model is established based on the interaction between terahertz waves and the cloth sample, and the terahertz absorption coefficient of the cloth sample to be measured is inversely obtained through the terahertz transmission model.
[0014] In a further technical solution, the absorption coefficient is expressed as:
[0015]
[0016] where, represents the sample thickness, represents the real refractive index of the sample, represents the amplitude response of the transfer function.
[0017] In a further technical solution, the convolutional layer includes a first convolutional block, a pooling layer, a feature fusion module, an information enhancement module, and two depth processing modules connected in sequence.
[0018] In a further technical solution, the feature fusion module receives the first feature map output by the first convolutional block and inputs it into the first branch and the second branch respectively. In the first branch, it is processed by a second convolutional block and a pooling layer in sequence to obtain a first fusion feature map. In the second branch, it is processed by a third convolutional block to obtain a second fusion feature map. The first fusion feature map and the second fusion feature map are jointly input into the connection layer for feature fusion to obtain a second feature map.
[0019] Further technical solution: 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. In the third branch, the third feature map is input into the add layer after being processed by the pooling layer. In the fourth branch, the third feature map is sequentially processed by the pooling layer and the asymmetric convolution module to obtain the first enhanced feature map. The first enhanced feature map is input into the add layer of the third branch to perform feature fusion with the third feature map processed by the pooling layer to obtain the second enhanced feature map. The second enhanced feature map is input into the next asymmetric convolution module for processing to obtain the third enhanced feature map. The third enhanced feature map and the second enhanced feature map are jointly input into the add layer for feature fusion to obtain the fourth feature map.
[0020] Further technical solution: 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. In the fifth branch, the fourth feature map is input into the add layer after being processed by the pooling layer. In the sixth branch, the fourth feature map is processed by the first asymmetric convolution module to obtain the first depth feature map. The first depth feature map is input into the add layer of the fifth branch to perform feature fusion with the fourth feature map processed by the pooling layer to obtain the second depth feature map. The second depth feature map is input into the asymmetric convolution module for processing to obtain the third depth feature map. The third depth feature map and the second depth feature map are jointly input into the add layer for feature fusion to obtain the fifth feature map.
[0021] In a second aspect, the present invention provides a terahertz detection system for fabric defects based on an improved convolutional neural network, including:
[0022] A data acquisition module, which is configured to: acquire the terahertz time-domain spectral signal of the fabric sample to be measured and perform preprocessing;
[0023] A data processing module, which is configured to: obtain the imaging image of the fabric sample to be measured according to the preprocessed spectral signal and perform preprocessing, invert the terahertz absorption coefficient according to the preprocessed spectral signal, and fuse the absorption coefficient and the preprocessed imaging image to obtain input data;
[0024] A model recognition module, which is configured to: input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain a fabric defect classification result; the improved convolutional neural network model includes an input layer, a convolutional 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 preprocessed imaging image to obtain input data, and inputs the input data into the convolutional layer for feature extraction; the convolutional layer is a multi-layer convolutional block with asymmetric convolutional kernels, and skip connections are introduced between the convolutional blocks.
[0025] In a third aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, 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.
[0026] In a fourth aspect, the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. 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.
[0027] The above one or more technical solutions have the following beneficial effects:
[0028] The present invention combines a terahertz time-domain spectroscopy system and 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.
[0029] For THz signals generated by complex fabric backgrounds, easily confused defect categories, and blurred fabric edges, traditional convolutional neural network algorithms have insufficient feature extraction capabilities and long algorithm running times, and cannot efficiently distinguish various defects. Therefore, 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 terahertz time-domain spectroscopy system is used to obtain the spectral signal of the sample, and then a sample transmission model is established and the absorption coefficient of terahertz is obtained by inversion calculation; then the absorption coefficient and image data are fused correspondingly as a data set to train the improved convolutional neural network model; on the model, convolutional blocks with asymmetric convolutional kernels are used in multiple layers to improve the defect recognition accuracy and classification speed, and a skip connection structure is selected to resist the problems of gradient disappearance and overfitting, realizing accurate recognition and efficient classification of different fabric defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings forming a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.
[0031] Figure 1 is a schematic diagram of the transmission of terahertz waves in an embodiment of the present invention;
[0032] Figure 2 is an architecture diagram of an improved convolutional neural network model in an embodiment of the present invention;
[0033] Figure 3 is a physical diagram of an experimental sample in an embodiment of the present invention;
[0034] Figure 4It is the schematic diagram of the terahertz time-domain spectroscopy system in the embodiment of the present invention;
[0035] Figure 5 It is the original image at 1.1 THz in the imaging image of the sample in the embodiment of the present invention;
[0036] Figure 6 It is the image after median filtering in the imaging image of the sample in the embodiment of the present invention;
[0037] Figure 7 It is the image after gray-scale stretching in the imaging image of the sample in the embodiment of the present invention;
[0038] Figure 8 It is the time-domain diagram of the reference signal and the sample signal in the embodiment of the present invention;
[0039] Figure 9 It is the frequency-domain diagram of the reference signal and the sample signal in the embodiment of the present invention;
[0040] Figure 10 It is the accuracy curve graph of the improved convolutional neural network model in the model training of the embodiment of the present invention;
[0041] Figure 11 It is the loss function curve graph of the improved convolutional neural network model in the model training of the embodiment of the present invention;
[0042] Figure 12 It is the training set confusion matrix of the traditional CNN model in the embodiment of the present invention;
[0043] Figure 13 It is the training set confusion matrix of the improved CNN model in the embodiment of the present invention;
[0044] Figure 14 It is the test set confusion matrix of the traditional CNN model in the embodiment of the present invention;
[0045] Figure 15 It is the test set confusion matrix of the improved CNN model in the embodiment of the present invention;
[0046] Figure 16 It is the validation set confusion matrix of the traditional CNN model in the embodiment of the present invention;
[0047] Figure 17 It is the validation set confusion matrix of the improved CNN model in the embodiment of the present invention. Detailed implementation manners
[0048] It should be noted that the following detailed description is exemplary and is intended to provide further illustration of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0049] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they specify the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0050] In the case of no conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0051] Embodiment 1
[0052] This embodiment discloses a terahertz detection method and system for fabric defects based on an improved convolutional neural network. The method includes the following steps:
[0053] S1: Obtain the terahertz time-domain spectral signal of the fabric sample to be measured and perform preprocessing;
[0054] In this embodiment, as Figure 3 shown, in order to simulate different types of fabric defect patterns, 6 types of defects including holes, snagging, stains, warping, same-material lamination, and different-material lamination and 1 type of defect-free fabric were prepared on a pure cotton fabric sample for comparison. As Figure 4 shown, a terahertz time-domain spectral system of the American company Zomega was used to scan the fabric sample point by point at a step size of 0.05 mm to obtain the terahertz time-domain spectral signal of each acquisition point, that is, the original spectral data.
[0055] The original spectral data was preprocessed using the Savitzky-Golay filtering algorithm to reduce the noise interference generated by the instrument or environment, etc., so as to improve the accuracy and reliability of the classification model. The basic formula of S-G filtering can be expressed as:
[0056] (1)
[0057] Among them, is the smoothed value at , is the point of the original data, is the offset within the window, is the coefficient of the filter, is the half-width of the window.
[0058] S2: Obtain the imaging image of the fabric sample to be measured according to the preprocessed spectral signal and perform preprocessing. Invert the preprocessed spectral signal to obtain the terahertz absorption coefficient of the fabric sample to be measured, and fuse the absorption coefficient and the preprocessed imaging image to obtain the input data;
[0059] In this embodiment, according to the terahertz time-domain spectroscopy signal and the specific frequency imaging method, the imaging results of the fabric sample at different frequencies are obtained, and it is found that the image is the clearest at 1.1 THz. As Figure 5 shown, the image at 1.1 THz with the highest clarity is selected as the basic data. As Figure 6 , Figure 7 shown, preprocessing operations such as median filtering and gray stretching are performed on the image to remove the noise points and blurred areas in the image and enhance the defect features.
[0060] The processed image data and spectral data are put into one-to-one correspondence to form a data set, and then the data set is labeled. Among them, the places without defects are labeled as 0, the defects of the cotton-polyester material laminate are labeled as 1, the defects of the double laminate of cotton material are labeled as 2, the defects of stains are labeled as 3, the defects of holes are labeled as 4, the defects of snagging are labeled as 5, and the defects of twisting and unevenness are labeled as 6. Considering that the hole and snagging defects are close to each other, for the area that simultaneously contains the defect features of holes and snagging, it is defined as a mixed defect and labeled as 7. The 552,900 data sets that are complete and contain multiple defect types are divided into a training set, a test set, and a validation set according to the ratio of 7:1.5:1.5.
[0061] In this embodiment, according to the spectral signal measured by the terahertz time-domain spectroscopy system, a terahertz transmission model of the fabric sample is established , and the optical properties of the fabric sample in the terahertz frequency band, that is, the absorption coefficient, are inversely obtained through the terahertz transmission model. According to the magnitude of the absorption coefficient, it can be known how strong the sample's absorption ability of terahertz waves is, so as to distinguish different defects of the sample.
[0062] Specifically, establishing the terahertz transmission model of the sample is as follows:
[0063] As Figure 1 shown, 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 directly passes through the air without considering the atmospheric loss and scattering effects, the received signal is called the reference wave . When the terahertz wave is incident from one medium (such as air) to another medium (such as the sample), the received signal is called the sample wave .
[0064] The interaction between the terahertz wave and the sample is described by the Maxwell equations. According to its boundary conditions, the connection between the electromagnetic field quantities is established, and the reflection coefficient ( ) and the transmission coefficient ( ) at the interface of different media are obtained through the Fresnel formula. The formula is expressed as follows:
[0065] (2)
[0066] (3)
[0067] Among them, represents the complex refractive index of the terahertz wave in air, represents the complex refractive index of the terahertz wave in the sample, and represent the incident angle and the refraction angle respectively.
[0068] Furthermore, the relationship between the refractive index and the refraction angle is deduced, that is, Snell's law, which is expressed as follows:
[0069] . (4)
[0070] When the terahertz wave propagates in the sample, its amplitude will decay and the phase will be delayed. The change is described by the propagation factor, which is expressed as:
[0071] (5)
[0072] Among them, represents the propagation factor, is the complex refractive index, is the angular frequency, is the propagation distance, represents the imaginary unit, is the speed of light.
[0073] It can be seen from formula (5) that this attenuation and delay are determined by the complex refractive index of the sample, and the complex refractive index can be expressed as:
[0074] (6)
[0075] Among them, is the refractive index, represents the imaginary unit, is the extinction coefficient.
[0076] When the terahertz wave is incident on the sample at a certain angle, the Fabry - Perot effect (F - P effect) will occur. 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 .
[0077] Assume that when there is no sample, the total path of the terahertz wave propagating in air is , and the projected distance in the fiber propagation direction is , is the thickness of the sample, and the light path length of a single reflection is ; after placing the sample, the propagation distance of the terahertz wave in air is , and perform multiple echoes, as shown in Equation (7):
[0078] (7)
[0079] Among them, represents the reference wave, represents the original terahertz wave, represents the propagation factor of air, represents the sample wave, represents the original transmitted terahertz wave, represents the th transmitted echo, represents the number of echo times, represents the projection distance, represents the sample thickness, represents the optical path length, represents the incident angle of the terahertz wave with the sample surface, represents the refraction angle of the terahertz wave with the sample surface.
[0080] Obtain the reference signal and the sample signal, as shown in Equations (8) and (9):
[0081] (8)
[0082] (9)
[0083] Among them, represents the reference wave, represents the terahertz wave, 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 propagation factor of terahertz in the sample, represents the transmittance from the sample to air, represents the reflectivity of the sample.
[0084] Its transfer function is expressed as:
[0085] (10)
[0086] Among them, represents the sample wave, represents the reference wave, represents the complex refractive index of the terahertz wave in air, represents the complex refractive index of the terahertz wave in the sample, and respectively represent the incident angle and the refraction angle, represents the imaginary unit, represents the optical path length, represents the projection distance, represents the angular frequency, represents the speed of light, represents the number of echo times, represents the reflectivity of the sample, represents the propagation factor of terahertz in the sample. represents the transfer function, which is used to establish a mathematical description of the transmission behavior of the sample, and is also called the terahertz transmission model.
[0087] The obtained F-P effect factor is expressed as:
[0088] (11)
[0089] where, represents the number of echo times, represents the reflectivity of the sample.
[0090] To extract the correct target signal, it is assumed that terahertz is incident on the sample vertically, and the F-P effect is 1, that is, , , and its transfer function is obtained as:
[0091] . (12)
[0092] In the case of weak absorption, when , can be ignored. From the relationship between the modulus and the argument and Lambert's law, it is expressed as:
[0093] (13)
[0094] where, is the transfer function, represents the amplitude response of the transfer function, represents the phase, represents the real refractive index of the sample, represents the extinction coefficient of the sample, represents the absorption coefficient, represents the extinction coefficient.
[0095] The absorption coefficient is obtained and expressed as:
[0096] (14)
[0097] where, represents the real refractive index of the sample, represents the extinction coefficient, is the thickness of the sample.
[0098] S3: Input the input data into a pre-trained improved convolutional neural network model for recognition and classification to obtain the classification result of fabric defects.
[0099] As Figure 2 shown, a convolutional neural network (CNN) is a deep learning architecture mainly composed of an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer. Due to the large amount of data measured by the terahertz time-domain spectroscopy system, the classification speed is slow, and the traditional CNN has poor recognition and classification effects based on a single defect feature. This requires the improvement of the convolutional neural network to optimize and innovate in terms of classification accuracy and classification speed. Therefore, an efficient classification convolutional neural network architecture is proposed.
[0100] The improved convolutional neural network model includes an input layer input, a convolutional layer, a concatenation layer concat, a global average pooling layer avg_pool, and a classification layer classification (including a fully connected layer fully connect and a softmax layer) connected in sequence. The specific model architecture is shown in Table 1 below, and it can be clearly seen the data dimensions output by different layers after being processed by each module.
[0101] Table 1 Architecture Details Table
[0102]
[0103] (1) Improvement of the input layer
[0104] The input layer receives the input data and inputs it to the convolutional 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 single data or an image, the amount of information that the model can obtain is relatively limited, which may lead to poor performance of the model in dealing with complex tasks and inability to understand and analyze problems from multiple angles or dimensions. To solve this problem, the present invention converts the original complex one-dimensional spectral data (i.e., absorption coefficient) into a two-dimensional matrix form similar to an imaging image, and then corresponds one by one with the imaging image in the channel dimension. After fusion, it is used as input data and sent into the network model. Among them, each signal frame of the data set is organized into a two-dimensional array with a size of 2×1024.
[0105] (2) Improvement of the convolutional layer
[0106] The convolutional layer is a multi-layer convolutional block with an asymmetric convolutional kernel, and a skip connection is introduced between the convolutional blocks. The convolutional layer includes a first convolutional block, a pooling layer pool, a feature fusion module A, an information enhancement module B, and two depth processing modules C connected in sequence.
[0107] The input data passes through the first convolutional block (i.e., the convolution2dLayer convolutional layer) to cover general features and obtain the first feature map. The convolutional kernel size of the first convolutional block is 3×7, and the spatial dimension is reduced with a stride of (1, 2).
[0108] It should be noted that considering Figure 2 the size of, the activation function layer in the improved convolutional neural network model architecture is omitted in Figure 2 and not drawn in the figure. Figure 2 Each convolutional layer conv in Figure 2 includes the convolution2dLayer convolutional layer and the reluLayer activation function layer. And
[0109] As Figure 2 shown, the feature fusion module A includes a base layer base, a first branch and a second branch in parallel, and a connection layer concat connected in sequence; the first branch includes a second convolutional block and a pooling layer connected in sequence, and the second branch includes a third convolutional block. The convolutional kernel size of the second convolutional block is 3×1, and the convolutional kernel size of the third convolutional block is 1×3.
[0110] To minimize the number of trainable parameters and ensure that the quality of the extracted features does not decline, two layers of asymmetric convolutional kernels are juxtaposed in the feature fusion module A, namely the 3×1 vertical kernel (the second convolutional block) and the 1×3 horizontal kernel (the third convolutional block). It should be noted that both the convolution and pooling operations are performed with a stride of (1, 2), which can quickly reduce the horizontal dimension of the feature map and reduce the computational cost. Specifically, the base layer base in the feature fusion module receives the first feature map and inputs it to the first branch and the second branch respectively. In the first branch it is sequentially processed by the second convolutional block and the pooling layer to obtain the first fused feature map , and in the second branch it is processed by the third convolutional block to obtain the second fused feature map . The first fused feature map and the second fused feature map are jointly input to the connection layer concat for feature fusion to obtain the second feature map .
[0111] The second feature map output by the feature fusion module A is input to the pooling layer (i.e., the maxPooling2dLayer max pooling layer), and the feature map is downsampled to obtain the third feature map , perform more explicit learning discriminant features.
[0112] As Figure 2 shown, the information enhancement module B includes a base layer base, a third branch and a fourth branch in parallel, and an add layer (additionLayer) connected in sequence. 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, a second convolution block and 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. That is to say, the two asymmetric convolution modules are connected through the add layer, and the input of the second asymmetric convolution module is the fusion of the output features of the first asymmetric convolution module and the third branch.
[0113] The information enhancement module B contains two asymmetric convolution modules. One is that the fourth convolution block is then connected to asymmetric convolution kernels of sizes 3×1, 1×3, and 1×1 respectively, and is concatenated in the depth dimension through the 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 of the third branch through the additionlayer, which greatly enhances the overall feature expression ability compared with the single feature extraction path of the traditional CNN. The fused features are input into the second asymmetric convolution module for processing. That is to say, a 1×1 convolution, 3×1 and 1×3 and 1×1 convolutions in parallel are performed again, and the output feature map is depth concatenated through the depthConcatenationLayer. The concatenated features are element-wise fused with the features output by the third branch through the additionLayer to gradually learn the feature information.
[0114] Specifically, the base layer in the information enhancement module B receives the third feature map and inputs it into the third branch and the fourth branch respectively. In the third branch, the third feature map is input into the add layer after being processed by the pooling layer. In the fourth branch, the third feature map is processed by the pooling layer and the asymmetric convolution module in sequence to obtain the first enhanced feature map , and is input into the add layer of the third branch to perform feature fusion with after being processed by the pooling layer to obtain the second enhanced feature map , input to the next asymmetric convolution module for processing to obtain the third enhanced feature map , input and into the add layer for feature fusion to obtain the fourth feature map .
[0115] As Figure 2 shown, the depth processing module C includes a base layer base, a fifth branch and a sixth branch in parallel, and an add layer (additionLayer) connected in sequence. 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, a second convolution block and 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, a second convolution block and a third convolution block and a fourth convolution block connected in parallel, and a connection layer concat; it should be noted that after the output of the first asymmetric convolution module is connected to the add layer of the fifth branch, the output of the add layer is connected to the asymmetric convolution module, that is, the first asymmetric convolution module and the asymmetric convolution module are connected through the add layer, and the input of the asymmetric convolution module is the fusion of the output features of the first asymmetric convolution module and the fifth branch.
[0116] In the first asymmetric convolution module, the second convolution block is connected to the pooling layer to process the features and reduce the computational complexity.
[0117] The depth processing module C includes a first asymmetric convolution module and an 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. Then, the convolution kernel with a size of 3×1 is connected to the pooling layer maxpooling to reduce the dimensionality of the features and reduce the computational complexity. Then, it is fused with the convolution kernels of 1×3 and 1×1 through the depthConcatenationLayer. The fused features and the features after pooling processing in the fifth branch are concatenated through the addition layer to combine features of different dimensions and enrich the feature information. The features after concatenation and fusion by 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. Then, it is concatenated in the connection layer according to the depth dimension; the concatenated features and the features output by the fifth branch are fused at the element level through the additionLayer to obtain the fused feature map.
[0118] Specifically, the base layer in the depth processing module C receives the fourth feature map and are respectively input into the fifth branch and the sixth branch. In the fifth branch after being processed by the pooling layer, it is input into the add layer. In the sixth branch it is processed by the first asymmetric convolution module to obtain the first depth feature map , and is input into the add layer of the fifth branch and is feature-fused with after being processed by the pooling layer to obtain the second depth feature map , and is input into the asymmetric convolution module for processing to obtain the third depth feature map , and and are jointly input into the add layer for feature fusion to obtain the fifth feature map .
[0119] The fifth feature map is input into the next depth processing module C for the same processing operation to obtain the sixth feature map , and is input into the connection layer for processing.
[0120] (3) Improvement of the connection layer
[0121] To improve the accuracy of the classification model and mitigate the negative impact of the gradient vanishing problem caused by the activation function in the network, skip connections are introduced between the convolutional blocks, which enables the various features extracted in each block to be jointly integrated with the information identity maintained throughout the network to enrich the classification model. It should be noted that this skip connection allows the module to learn the residual information rather than the traditional true output. Therefore, the improved CNN model can resist the problems of gradient vanishing and overfitting during the network training stage.
[0122] At the end of the model, after combining the feature map output by the last depth processing module C with the output of the previous skip connection through the connection layer, it is further connected to the global average pooling layer (averagePooling2dLayer) to convert the feature map into a fixed-length vector, which is then connected to the fully connected layer (fullyConnectedLayer), and a 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 be the same as the number of types of signal modulation methods in the provided dataset; finally, a softmax (softmaxLayer) is connected to implement the multi-class classification task and output the defect classification result.
[0123] Further, the skip connection specifically refers to the add layer set in the information enhancement module B and the depth processing module C. Through the add layer, the feature maps after the connection operations of multiple branches or convolutions are fused by element-wise addition.
[0124] The improved convolutional neural network model was trained using the training set data. The stochastic gradient descent optimization algorithm was adopted, combined with the cross-entropy loss function, to dynamically adjust the model weight parameters. After 4500 iterations of training, until the loss function value of the model on the training set converged to a stable low value. When using the stochastic gradient descent method as the optimizer for model training, 128 samples were used for parameter update in each iteration to balance the training efficiency and memory consumption. The maximum number of training epochs was set to 60, that is, the model would perform 60 complete iterations of training on the entire training set. The initial learning rate was set to 0.01, and a piecewise learning rate adjustment strategy was adopted. The learning rate decayed to 0.1 times the original every 30 epochs to gradually fine-tune the model parameters as the training process progressed and avoid falling into local optimal solutions. Data shuffling was enabled before each round of training to ensure that the model encountered data in 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 epochs. When the validation set loss did not decrease continuously, the training would be terminated early.
[0125] The experimental results and analysis are as follows:
[0126] As Figure 8 、 Figure 9 shown, through the data measured by the terahertz time-domain spectroscopy system, the time-domain and frequency-domain diagrams of the reference signal and the sample signal were plotted. By comparing the time-domain diagrams of the reference signal passing through air (reference signal), defect-free fabric, holes, dyeing, snagging, unevenness, double-layer pure cotton fabric, and laminated fabric of pure cotton-polyester material, it can be seen that there are time delays and amplitude attenuations 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 samples. The corresponding frequency-domain diagram is as Figure 9 shown. 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 the samples at different defects. These results indicate that different defects can be characterized by different features in the terahertz frequency range, and terahertz time-domain spectroscopy imaging is feasible for fabric detection.
[0127] The nominal spectral 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 spectral range of 0.1 to 1.5 THz was selected for this spectral analysis. By using formula (12) to calculate the THz absorption coefficient of each defect, the absorption coefficient data of different fabric defects and the image data were fused and then input into the improved CNN model. After multiple rounds of iterative training, as Figure 10As shown, as the number of training rounds increases, the accuracy continues to rise and stabilizes at a high level. The improved CNN model achieved a classification accuracy of up to 99.4%. As Figure 11 shown, the loss value drops rapidly and gradually approaches 0, indicating that the model has good learning ability and generalization performance and can accurately identify fabric defects.
[0128] The model comparison and analysis are as follows:
[0129] To further verify the advantages of the improved CNN method proposed in the present invention, a traditional CNN model was used for comparison next. The results show that although the traditional CNN model can use image information for classification, it has insufficient ability to identify subtle and hidden defects, and its accuracy is 93.3%, which is about 6% lower than that of the improved CNN method.
[0130] To more comprehensively evaluate the performance of the classification model, based on comparing the classification accuracy of the models, the present invention introduces the F1 score as a model evaluation index. As shown in Table 2, the improved CNN model achieved good values in the four evaluation indexes of accuracy, precision, recall, and F1 score, and was superior to the traditional CNN model.
[0131] Table 2 Performance comparison of different classification models
[0132]
[0133] To more intuitively evaluate the classification performance of the model, confusion matrices were made for the traditional CNN model and the improved CNN model respectively. As Figures 12 - 17 shown, the confusion matrix is a two-dimensional matrix. The rows represent the true labels, and the columns represent the labels predicted by the model. Each element of the matrix represents the number of samples in which the model predicts the true label as the corresponding column label. Among them, 1 in the horizontal and vertical coordinates represents the classification of fabrics without defects, 2 represents the classification of defects in the cotton-polyester material laminate, 3 represents the classification of defects in the double laminate of cotton material, 4 represents the classification of defects of stains, 5 represents the classification of defects of holes, 6 represents the classification of defects of snagging, 7 represents the classification of defects of twisting and unevenness, and 8 represents the classification of mixed defects with both hole and snagging defect features. Figure 12 is the confusion matrix of the training set of the CNN model, and its accuracy is 93.5%. Figure 13 is the confusion matrix of the training set of the improved CNN model, and its accuracy is 99.39%. The two models with stable accuracy after iteration were respectively used for the classification of 8 kinds of fabrics. Through Figure 14 the confusion matrix of the test set of the CNN model and Figure 15Analysis of the confusion matrix of the test set of the improved CNN model shows that the CNN model uses an image dataset as input data, and the accuracy of the model is 93.33%. The improved CNN model uses the THz absorption coefficient fused with image data as input data, and the accuracy is 98.49%. Among them, the improved CNN method model misjudges 1 case of type 2 (cotton-polyester material laminated defect) as no defect and 1 case as hole defect; there is 1 misjudgment for type 3 (double-laminated defect of cotton material), type 5 (hole defect), type 6 (snagging defect), and type 7 (twisted and uneven defect); for type 8 (mixed defect), there is 1 misjudgment as hole defect and 3 misjudgments as snagging defect. The reason for the misjudgment may be that the absorption peaks of the defects are similar, resulting in the model being unable to correctly distinguish them. Figure 16 The accuracy of the confusion matrix of the validation set for the CNN model is 93.46%, Figure 17 The accuracy of the confusion matrix of the validation set for the improved CNN model is 100%.
[0134] It can be seen from this that the improved CNN model can meet the classification and recognition requirements of 8 types of fabric defects, and the classification and recognition accuracy is higher than that of the traditional CNN model.
[0135] 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, inversely calculates the absorption coefficient of the fabric from the data, and uses a specific frequency imaging method to obtain the imaging image of the fabric from the spectral signal; fuses the absorption coefficient with the imaging image as the dataset and inputs it into the improved CNN model. Through numerical experiments, it is verified that the terahertz time-domain spectroscopy system combined with the improved CNN model can efficiently identify and classify different fabric defects, providing a new solution for fabric defect identification and classification, and having high application value and research significance.
[0136] Embodiment 2
[0137] This embodiment discloses a terahertz detection system for fabric defects based on an improved convolutional neural network, including:
[0138] A data acquisition module, which is configured to: acquire the terahertz time-domain spectral signal of the fabric sample to be tested and perform preprocessing;
[0139] A data processing module, which is configured to: obtain the imaging image of the fabric sample to be tested from the preprocessed spectral signal and perform preprocessing, inversely obtain the terahertz absorption coefficient of the fabric sample to be tested from the preprocessed spectral signal, and fuse the absorption coefficient with the preprocessed imaging image to obtain input data;
[0140] A model recognition module, which 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 convolutional 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 preprocessed imaging image to obtain input data, and inputs the input data into the convolutional layer for feature extraction; the convolutional layer is a multi-layer convolutional block with asymmetric convolutional kernels, and skip connections are introduced between the convolutional blocks.
[0141] Embodiment III
[0142] The purpose of this embodiment is to provide a computing device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the method in Embodiment I are implemented.
[0143] Embodiment IV
[0144] The purpose of this embodiment is to provide a computer-readable storage medium. A computer-readable storage medium stores a computer program, and when the program is executed by a processor, the steps of the method in Embodiment I are executed.
[0145] The steps involved in the devices in the above Embodiments III and IV correspond to those in Method Embodiment I. For specific implementation manners, reference may be made to the relevant description part of Embodiment I. The term "computer-readable storage medium" should be understood to include 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.
[0146] Those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computer device. Optionally, they can be implemented by program codes 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 separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.
[0147] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
[0148] Although the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, they are 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 without creative efforts on the basis of the technical solutions of the present invention 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, and a cloth defect classification result is obtained; 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 the input data is input into the convolution layer for feature extraction; the convolution layer is a multi-layer convolution block with an asymmetric convolution kernel, and a jump connection is introduced between the convolution blocks; 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; The feature fusion module receives the first feature map output by the first convolution block, and inputs the first feature map to 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 input to the connection layer for feature fusion to obtain a second feature map. 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 for feature fusion to obtain a fourth feature map; The depth processing module includes a first asymmetric convolution module and an asymmetric convolution module. The depth processing module receives the fourth feature map output by the information enhancement module and inputs them 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 subjected to feature fusion 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. The third depth feature map is obtained by processing, and the third depth feature map and the second depth feature map are input into the add layer for feature fusion to obtain the fifth feature map; wherein, the first asymmetric convolution module first passes through the 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 connects the convolution kernel of size 3×1 to the pooling layer; 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; the features after splicing and fusion of the addition layer are input into the asymmetric convolution module for processing, first pass through the convolution layer with a convolution kernel of 1×1, and then perform asymmetric convolution kernels of 3×1, 1×3, and 1×1 in parallel, and then are spliced according to the depth dimension in the connection layer; the spliced features are fused element-wise with the features output by the fifth branch through the additionLayer to obtain a fused feature map.
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 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, and obtain a classification result of a fabric defect; 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 a jump connection is introduced between the convolution blocks; 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; The feature fusion module receives the first feature map output by the first convolution block, and inputs the first feature map to 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 input to the connection layer for feature fusion to obtain a second feature map. 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 for feature fusion to obtain a fourth feature map; The depth processing module includes a first asymmetric convolution module and an asymmetric convolution module. The depth processing module receives the fourth feature map output by the information enhancement module and inputs them 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 subjected to feature fusion 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. The third depth feature map is obtained by processing, and the third depth feature map and the second depth feature map are input into the add layer for feature fusion to obtain the fifth feature map; wherein, the first asymmetric convolution module first passes through the 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 connects the convolution kernel of size 3×1 to the pooling layer; 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; the features after splicing and fusion of the addition layer are input into the asymmetric convolution module for processing, first pass through the convolution layer with a convolution kernel of 1×1, and then perform asymmetric convolution kernels of 3×1, 1×3, and 1×1 in parallel, and then are spliced according to the depth dimension in the connection layer; the spliced features are fused element-wise with the features output by the fifth branch through the additionLayer to obtain a fused feature map.
5. 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 3.
6. 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 3.