THz image detection method and equipment for wheat moisture distribution and medium
By using GoogleNet network in wheat moisture detection combined with SE and CBAM attention mechanism modules, the problems of insufficient feature extraction and inaccurate detection results in the prior art are solved, and the accurate detection and model generalization ability of wheat moisture distribution is achieved Improvement.
Patent Information
- Application Number
- CN202411057921.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-29
AI Technical Summary
The existing wheat moisture detection methods have problems such as insufficient feature extraction, low model generalization ability and inaccurate detection results, especially when processing THz images and video images, it is difficult to obtain accurate detection results.
GoogleNet network is used to combine attention mechanism modules SE and CBAM, and these modules are inserted into the Inception layer to enhance feature extraction and weighting processing, and improve the accuracy and generalization of detection results.
Accurate detection of wheat moisture distribution, suitable for analysis of THz images and videos, improve the accuracy of detection results and the generalization ability of the model, reduce the impact of useless features on the detection results, and the model training is faster and the quality is better. good.
Smart Images

Figure CN119048807A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of agricultural detection, and in particular to a THz image detection method, equipment and medium for wheat moisture distribution. Background Art
[0002] During the storage, transportation and processing of wheat, the detection of wheat quality is a crucial link. One of the important detection indicators is the moisture content and moisture distribution of wheat. The moisture level of wheat directly affects its quality. Whether the moisture content is too high or too low, it will reduce the quality of grain crops and affect the quality of grain. Therefore, it is necessary to conduct regular and accurate detection of wheat moisture in order to effectively control the quality of grain and realize the efficient use of wheat resources.
[0003] Traditional moisture detection methods, such as drying method, chemical method and nuclear magnetic resonance method, usually require destructive treatment of samples, the operation steps are cumbersome and the detection cycle is long, so there is a need for rapid and non-destructive detection of wheat moisture. In non-destructive testing technology, terahertz wave technology has become a good choice because of its fast imaging speed and sensitivity to moisture. Chinese patent publication number CN108458988A, published on August 28, 2018, named "Non-destructive rapid detection method of wheat flour using terahertz technology" discloses a wheat detection method, which collects and analyzes the absorption spectrum and refraction spectrum of wheat samples, and models and analyzes the moisture content of wheat. However, the machine learning technology used in this method still has the problems of simple structure and other problems commonly seen in conventional technologies. The detection data applicable to analysis is also limited to simple terahertz spectra. It is difficult to obtain accurate detection results for THz images and video images with greater information content. Summary of the invention
[0004] The present invention overcomes the problems of insufficient feature extraction, low model generalization ability and inaccurate detection results in the existing detection methods when detecting the moisture content of wheat, and provides a THz image detection method, device and medium for wheat moisture distribution. The method uses GoogleNet and combines the use of attention mechanism modules SE and CBAM in the Inception layer of the network to achieve accurate detection of wheat moisture distribution. The detection method has strong generalization ability and can be applied to the analysis and detection of THz images and videos.
[0005] In order to achieve the above object, the present invention adopts the following scheme:
[0006] The THz image detection method for wheat moisture distribution includes the following steps:
[0007] S1: Input the wheat moisture distribution THz image into the feature extraction module of the GoogleNet network, which consists of a convolution layer and a pooling layer to perform preliminary feature extraction on the input THz image;
[0008] S2: Input the feature map extracted by the feature extraction module into the Inception module of the network to further extract features, wherein the Inception module includes multiple Inception layers for deeply extracting feature map information;
[0009] S3: Use the attention mechanism modules SE and CBAM to obtain the weights of each part of the feature information in different channels and spaces, and strengthen or weaken the influence of each part of the feature information on the detection result according to the weight. The attention mechanism modules SE and CBAM are inserted between multiple Inception layers at intervals.
[0010] S4: The feature maps output by the Inception module, the attention mechanism module SE and the CBAM are output by a classification regression module, wherein the classification regression module includes a global average pooling layer and a fully connected layer, and outputs the wheat moisture distribution detection result in a classification or regression manner.
[0011] Preferably, in steps S2 and S3, the Inception module includes 9 Inception layers, and an attention mechanism module SE and a maximum pooling layer are inserted after the second Inception layer; and an attention mechanism module CBAM and a maximum pooling layer are inserted after the seventh Inception layer.
[0012] Preferably, in step S1, the feature extraction module includes three convolutional layers, and a maximum pooling layer is respectively arranged after the first and the last convolutional layers.
[0013] Preferably, in step S3, the attention mechanism module SE first uses a global average pooling operation to perform feature compression on the information of each feature channel, and then uses two fully connected layers to obtain the information weight of each feature channel in the characterization of wheat moisture distribution.
[0014] Preferably, in step S3, the attention mechanism module CBAM uses a channel attention mechanism to obtain the information weight of each feature channel in the characterization of wheat moisture distribution, and uses a spatial attention mechanism to obtain the information weight of each spatial position in the feature map in the characterization of wheat moisture distribution.
[0015] Preferably, in step S2, the Inception layer simultaneously performs convolution combination processing on the feature map input from the previous layer on four paths, the first path uses a convolution layer with a size of 1×1, the second path uses a front and back connected convolution layer with sizes of 1×1 and 3×3 respectively, the third path uses a front and back connected convolution layer with sizes of 1×1 and 5×5 respectively, the fourth path uses a front and back connected convolution layer with sizes of 3×3 and 1×1 respectively, and finally the convolution processing results of each path are connected by depth to obtain a new feature map to be input into the next layer.
[0016] Preferably, the wheat moisture distribution THz image in step S1 records the terahertz time-domain spectral information obtained by scanning the wheat with a terahertz spectral imaging device, and the terahertz time-domain spectral information is stored in the form of image data in a three-dimensional format, and each pixel point of the image data corresponds to a piece of terahertz time-domain spectral information of a specified time scale.
[0017] The present application also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the method described in any one of the above schemes.
[0018] The present application also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above solutions is implemented.
[0019] The present invention includes at least the following beneficial effects: (1) by combining a deep learning network model, the feature extraction capability of THz images is enhanced, and the invention can be applied to complex data detection of THz spectral images and videos, and has a wider range of applications; (2) by adding attention mechanism modules SE and CBAM to the network structure, the information of the feature map is weighted, and the influence of useless features on the moisture detection results is reduced, and the detection of wheat moisture is more accurate; (3) a feature extraction method that is easier to extract key feature information is adopted, and the model training is faster and the quality is better. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of the Google-SE-CBAM network structure of the present invention;
[0021] Figure 2 This is a schematic diagram of an Inception layer structure of the present invention;
[0022] Figure 3 This is a schematic diagram of the structure of a SE module of the present invention;
[0023] Figure 4A schematic diagram of the structure of a CBAM of the present invention;
[0024] Figure 5 It is a channel attention mechanism structure diagram of the CBAM module of the present invention;
[0025] Figure 6 It is a structural diagram of the spatial attention mechanism of the CBAM module of the present invention;
[0026] Figure 7 The accuracy and loss change graphs of the GoogleNet network and the Google-SE-CBAM network;
[0027] Figure 8 It is the confusion matrix of the detection results of the GoogleNet network;
[0028] Fig. 9 It is the detection result confusion matrix of Google-SE-CBAM network;
[0029] Fig.10 This is a comparison chart of the detection accuracy of various models. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.
[0031] like Figure 1 As shown, the THz image detection method for wheat moisture distribution provided by the present invention comprises the following steps:
[0032] S1: Input the wheat moisture distribution THz image into the feature extraction module of the GoogleNet network, which consists of a convolution layer and a pooling layer to perform preliminary feature extraction on the input THz image;
[0033] The GoogleNet network is a deep convolutional neural network, which is often used for image classification, target detection, and image segmentation. It can extract multi-scale feature information from images. In addition to the original main classifier, two auxiliary classifiers are added to the network. The auxiliary classifiers do not participate in the final decision and only play a role in calculating the total training loss. The total loss = main classifier loss + 0.3 × auxiliary classifier 1 loss + 0.3 × auxiliary classifier 2 loss. The auxiliary classifier is a small classifier at the middle level of the network, which is used to provide additional supervision signals, which helps prevent overfitting and enables the network to focus on learning useful features earlier.
[0034] S2: Input the feature map extracted by the feature extraction module into the Inception module of the network to further extract features, wherein the Inception module includes multiple Inception layers for deeply extracting feature map information;
[0035] like Figure 2 The figure shows the structure of the GoogleNet network used, where Filter Concatenation connects the input according to the depth; convolution is the convolution layer, which has different size combinations; Previous layer is the input of this layer and is also the output node of the previous layer. The Inception module in GoogleNet is used to solve possible problems such as gradient disappearance and gradient explosion. Its structure consists of convolution blocks and maximum pooling modules. This structure merges multiple convolutions, splices the extracted feature layers and outputs them to the next layer, and selects appropriate parameters to calculate the final result according to needs to improve feature extraction capabilities.
[0036] S3: Use the attention mechanism modules SE and CBAM to obtain the weights of each part of the feature information in different channels and spaces, and strengthen or weaken the influence of each part of the feature information on the detection result according to the weight. The attention mechanism modules SE and CBAM are inserted between multiple Inception layers at intervals.
[0037] like Figure 3 As shown in the figure, the attention mechanism module SE, as a squeeze-and-excitation module, is a channel attention mechanism. Its modeling is based on the relationship between channels and adaptively recalibrates the channel feature response to selectively emphasize the global information in the wheat moisture distribution THz image and suppress its useless features, so that the feature information extracted by the detection network can better reflect the moisture distribution of wheat.
[0038] The squeeze operation of the attention mechanism module SE uses global average pooling to generate channel statistics, compressing the global spatial information into the channel descriptor. The statistics z∈R are generated by shrinking U through its spatial dimensions H×W. c The cth element of z is calculated as follows:
[0039]
[0040] To capture channel dependencies, the excitation operation uses a simple gating mechanism with sigmoid activation:
[0041] s=F ex (z,W)=σ(g(z,W))=σ(W2δ(W1,z))
[0042] Where δ represents the ReLU function, The final output of the SE block is obtained by rescaling U with the activation s:
[0043]
[0044] in F scale (U c ,s c )Indicator quantity c And the feature map U c ∈R H×W The channel multiplication between .
[0045] The use of SE modules improves the learning quality of the detection network and enables it to benefit from specific tasks. The SENet network architecture can be formed by stacking multiple SE modules together. The SE block maps the input to a feature map, extracts features by applying a squeeze operation in the feature map, and aggregates its spatial dimensions to generate a channel descriptor that can perceive information globally. In the excitation operation, a set of channel modulation weights is applied to the feature map, and finally the modulated feature map is output.
[0046] like Figure 4 As shown in the figure, the attention mechanism module CBAM is a convolutional block attention module (Convolutional Block Attention Module), which is a feedforward convolutional neural network attention module. It can estimate the attention map in two dimensions, spatial and channel, and adaptively refine the input feature map. In the figure, Input Feature is the input feature map; Channel Attention Module is the channel attention module; Spatial Attention Module is the spatial attention module; Refined Feature represents the feature expression after a series of processing and optimization. Given an intermediate feature map F∈R C×H×W As input, CBAM sequentially derives a 1-dimensional channel attention map M c ∈R C×1×1 and a 2D spatial attention map M s ∈R 1×H×W , the whole attention process is:
[0047]
[0048]
[0049] in, represents element-by-element multiplication, and F″ is the final refined output.
[0050] like Figure 5 As shown in the figure, the channel attention mechanism of CBAM, Input Feature F is the input feature F; MaxPool is the maximum pooling operation; AvgPool is the average pooling operation; Shared MLP is the shared multi-layer perceptron; ChannelAttention represents channel attention. First, the spatial information of the feature map is aggregated by using the pooling operation to generate two different spatial descriptors: and denote the average pooling feature and the maximum pooling feature respectively. The two spatial descriptors are forwarded to a shared network consisting of a multi-layer perceptron (MLP) to produce a channel attention map M c ∈
[0051] R C×1×1 . It is calculated as follows:
[0052]
[0053] where σ represents the sigmoid function,
[0054] like Figure 6 As shown in the figure, the spatial attention mechanism of CBAM, where Channel refined feature F' is the refined feature F'; MaxPool is the maximum pooling operation; AvgPool is the average pooling operation; Conv layer is the convolution layer;
[0055] Spatial Attention stands for spatial attention. CBAM focuses on spatial information and complements channel attention. First, two valid 2D feature descriptors are generated through pooling operations. and Represents the average pooling feature and the maximum pooling feature in the channel. The convolution operation is used on the feature descriptor to generate the spatial attention map M s (F)∈R H×W , which is calculated as follows:
[0056]
[0057] Where σ represents the sigmoid function, f 7×7 represents a convolution operation with a filter size of 7×7.
[0058] S4: The feature maps output by the Inception module, the attention mechanism module SE and the CBAM are output by a classification regression module, wherein the classification regression module includes a global average pooling layer and a fully connected layer, and outputs the wheat moisture distribution detection result in a classification or regression manner.
[0059] As an example of a test experiment, the test environment conditions were uniformly configured. The wheat samples were first placed in a constant temperature drying oven and dried at a stable temperature of 60 degrees for 24 hours to ensure that all samples reached the same moisture content. The change in seed moisture content was controlled by controlling the time the seeds were soaked in distilled water. The initial moisture content can be calculated by measuring the mass change before and after the seeds were dried. The moisture content of the seeds at different soaking times can be calculated by measuring the mass change before and after the seeds were soaked. When collecting THz images, an all-fiber terahertz time-domain spectroscopy system was used, with a femtosecond laser wavelength of 1550 nanometers, a system bandwidth of 0.1THz-3.0THz, a spectral resolution of 8 GHz, and a spectral dynamic range of more than 60 decibels. All experiments were carried out under normal temperature and humidity conditions. Wheat samples soaked for different times were cut along the ventral groove of the wheat kernels, and the cut surface was placed with the inner side facing up on the scanning platform of the terahertz spectral imaging system. The wheat samples were scanned point by point using the terahertz time-domain spectroscopy transmission mode to obtain THz image information. It should be noted that cutting the wheat samples along the ventral groove of the wheat kernels is the wheat pretreatment method adopted in this experiment. In actual use, the wheat does not need to be cut.
[0060] The THz images are divided into six categories according to the soaking time: 0H, 2H, 4H, 6H, 8H, and 10H wheat moisture distribution THz images. Compared with the traditional machine learning method, because this application adopts the deep learning method, more parameters can be used for model training. Therefore, the original wheat moisture distribution THz input image is data enhanced by rotation, translation, scaling, etc. After the sample number is expanded, the samples of wheat moisture distribution THz image reach 4320, and the training set, validation set and test set are divided according to the ratio of 6:2:2. The training batch is 64, the training cycle is 200, the input image size is 225×225, the Adam optimizer is used, the learning rate is 1e-5, and the cross entropy is used as the loss function. The construction and training of the classification model are carried out on the TensorFlow deep learning framework. The computer configuration uniformly adopts the Windows 10 operating system, the graphics card is NVIDIA GeForce RTX 3060, and the processor is Intel 12th generation i5-12490F.
[0061] The confusion matrix of the detection results of wheat moisture distribution THz image using only GoogleNet network is as follows: Figure 8 As shown, the recognition results calculated according to the confusion matrix include precision, recall and performance indicator F1 value. The detection results are shown in Table 1:
[0062] Table 1
[0063] Soaking time / H Accuracy / % Recall / % F1-Score / % 0 100.00 100.00 100.00 2 100.00 100.00 100.00 4 100.00 98.60 99.30 6 98.62 100.00 99.31 8 100.00 100.00 100.00 10 100.00 100.00 100.00
[0064] From the confusion matrix and Table 1, we can see that in the process of GoogleNet predicting the moisture distribution of wheat, the wheat soaked for 0, 2, 6, 8, and 10 hours was correctly predicted; for the wheat soaked for 4 hours, 2 samples were predicted to be the wheat soaked for 6 hours. The performance index F1 value relationship under different soaking times is F0 = F2 = F8 = F 10 >F6>F4.
[0065] The confusion matrix of the detection results of wheat moisture distribution THz image using Google-SE-CBAM network is as follows Fig. 9 As shown, the recognition results calculated according to the confusion matrix include precision, recall and performance index F1 value. The detection results are shown in Table 2:
[0066] Table 2
[0067] Soaking time / H Accuracy / % Recall / % F1-Score / % 0 100.00 100.00 100.00 2 100.00 100.00 100.00 4 99.31 100.00 99.65 6 100.00 100.00 100.00 8 100.00 100.00 100.00 10 100.00 99.30 99.65
[0068] From the confusion matrix and Table 2, we can see that in the process of predicting wheat moisture distribution by Google-SE-CBAM network, all the wheat samples soaked for 0, 2, 4, 6, and 8 hours were predicted correctly; among the wheat samples soaked for 10 hours, only one sample was predicted to be soaked for 4 hours. The performance index F1 value relationship of wheat sample detection at different soaking times is F0=F2=F6=F8>F4=F 10 .
[0069] like Figure 7As shown in the figure, the original GoogleNet network is compared with the improved Google-SE-CBAM network. For the accuracy curve and the loss curve, the upper group (a) shows the detection data of the GoogleNet network, and the lower group (b) shows the detection data of the Google-SE-CBAM network. Among them, the left figure is the accuracy curve graph, and the right figure is the loss change curve graph. In the left figure, the dark train_accuracy curve represents the training accuracy, and the light val_accuracy curve represents the validation accuracy; in the right figure, the dark train_loss curve represents the training loss; the light val_accuracy curve represents the validation set loss; epochs represents the number of iteration rounds; accuracy represents the accuracy. It can be seen from the figure that when the number of iterations of the GoogleNet network is <50, the rising trend of the accuracy curve is obvious, and then it rises slowly. When the number of iterations reaches 100, the model accuracy begins to tend to a stable state; its loss curve is in a downward trend, and the loss curve of the validation set fluctuates greatly in the interval of 25 < epoch < 80, but the overall trend remains unchanged. When the number of iterations > 100, the model begins to gradually converge. The change law of the Google-SE-CBAM network is similar to that of the original GoogleNet network. One difference is that when the number of iterations is about 175, there is a fluctuation in the validation set of the original GoogleNet network, while there is a fluctuation in the training set of the improved GoogleNet network. It can be seen from the curves in the figure that the improved Google-SE-CBAM network converges significantly faster and has better performance than the original GoogleNet network.
[0070] Through the above comparative analysis, it can be seen that integrating the SE and CBAM attention mechanisms can effectively improve the feature extraction ability of the network, and these two attention mechanism modules can be well combined in the GoogleNet network, making the overall recognition effect of the improved Google-SE-CBAM network better than that of the original GoogleNet network.
[0071] Furthermore, the Google-SE-CBAM network used in the method provided by this application is compared and tested with other common detection networks, and the accuracy and training time are compared. The detection accuracy is as Fig.10 shown. It can be seen from the data comparison that the Google-SE-CBAM network of this application has the highest detection accuracy. Without considering the SVM network with too low accuracy, the model training time of the other networks is shown in Table 3:
[0072] Table 3
[0073]
[0074] By analyzing the accuracy data in the figure and the model training time shown in Table 3, it can be seen that the original GoogleNet network has a recognition accuracy of 99.77% for the wheat moisture distribution THz image, which is the same as the AlexNet network, but the training time is shortened by 196s compared with AlexNet. The Google-SE-CBAM network achieves the highest recognition accuracy of 99.88%. Compared with SVM, CNN, ResNet, AlexNet and GoogleNet, it is improved by 12.88%, 2.79%, 1.16%, 0.11% and 0.11% respectively, and the training time is effectively shortened. The experimental results show that the improved Google-SE-CBAM network effectively improves the detection and recognition ability of wheat moisture distribution compared with other networks, and the increase in model training time is negligible compared with the GoogleNet network before the improvement.
[0075] The model used in the method of this application is compared with other models using SE and CBAM modules. AlexNet-SE-CBAM, ResNet-SE-CBAM and GoogleNet-SE-CBAM network models are built to classify and detect images. The obtained accuracy results are shown in Table 4:
[0076] Table 4
[0077]
[0078] From the results, it can be seen that the recognition accuracy of the GoogleNet-SE-CBAM network model used in this application can be stabilized at a very high level, and the recognition and classification effect is significantly better than other comparison networks.
[0079] Combined with the above test data, it can be seen that the wheat moisture distribution THz image detection method adopted in this application strengthens the feature extraction capability of THz images by combining the deep learning network model, and can be applied to complex data detection of THz spectral images and videos, with a wider range of applications; by adding attention mechanism modules SE and CBAM to the network structure, the information of the feature map is weighted, and the influence of useless features on the moisture detection results is reduced, and the detection of wheat moisture is more accurate; because a feature extraction method that is easier to extract key feature information is adopted, the model training is faster and the quality is better.
[0080] In another technical solution, Figure 1As shown, in steps S2 and S3, the Inception module includes 9 Inception layers, and the attention mechanism module SE and the maximum pooling layer are inserted after the second Inception layer; the attention mechanism module CBAM and the maximum pooling layer are inserted after the seventh Inception layer.
[0081] In step S1, the feature extraction module includes three convolutional layers, and a maximum pooling layer is respectively arranged after the first and the last convolutional layers.
[0082] In another technical solution, in step S3, the attention mechanism module SE first uses a global average pooling operation to compress the information of each feature channel, and then uses two fully connected layers to obtain the information weight of each feature channel in the characterization of wheat moisture distribution.
[0083] In step S3, the attention mechanism module CBAM uses a channel attention mechanism to obtain the information weight of each feature channel in the characterization of wheat moisture distribution, and uses a spatial attention mechanism to obtain the information weight of each spatial position in the feature map in the characterization of wheat moisture distribution.
[0084] In another technical solution, Figure 2 As shown, in step S2, the Inception layer simultaneously performs convolution combination processing on the feature map input from the previous layer on four paths. The first path uses a convolution layer with a size of 1×1, the second path uses a convolution layer with sizes of 1×1 and 3×3 for the front and back connections, the third path uses a convolution layer with sizes of 1×1 and 5×5 for the front and back connections, and the fourth path uses a convolution layer with sizes of 3×3 and 1×1 for the front and back connections. Finally, the convolution processing results of each path are connected by depth to obtain a new feature map that is input to the next layer.
[0085] The wheat moisture distribution THz image in step S1 records the terahertz time-domain spectral information obtained by scanning the wheat with a terahertz spectral imaging device. The terahertz time-domain spectral information is stored in the form of three-dimensional image data, and each pixel point of the image data corresponds to a piece of terahertz time-domain spectral information of a specified time scale.
[0086] The present application also provides an electronic device, comprising: at least one processor, and a memory in communication with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor performs the wheat moisture distribution THz image detection method as described in any one of the above schemes. The electronic device can be any terminal device including a mobile phone, a laptop computer, a desktop computer, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, etc.
[0087] The present application also provides a storage medium on which a computer program is stored, characterized in that when the program is executed by a processor, a THz image detection method for wheat moisture distribution as described in any one of the above schemes is implemented.
[0088] Through the description of the above implementation mode, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present invention, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0089] It should be noted that, although the above describes the various steps in a specific order, it does not mean that the various steps must be performed in the above specific order. In fact, some of these steps can be performed concurrently or even in a different order, as long as the required functions can be achieved. The number of devices and processing scales described here are used to simplify the description of the present invention, and the application, modification and variation of the present invention are obvious to those skilled in the art.
[0090] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. A THz image detection method for wheat moisture distribution, characterized in that: The following steps are involved: S1: Input the wheat moisture distribution THz image into the feature extraction module of the GoogleNet network, which consists of a convolution layer and a pooling layer to perform preliminary feature extraction on the input THz image; S2: Input the feature map extracted by the feature extraction module into the Inception module of the network to further extract features, wherein the Inception module includes multiple Inception layers for deeply extracting feature map information; S3: Use the attention mechanism modules SE and CBAM to obtain the weights of each part of the feature information in different channels and spaces, and strengthen or weaken the influence of each part of the feature information on the detection result according to the weight. The attention mechanism modules SE and CBAM are inserted between multiple Inception layers at intervals. S4: The feature maps output by the Inception module, the attention mechanism module SE and the CBAM are output by a classification regression module, wherein the classification regression module includes a global average pooling layer and a fully connected layer, and outputs the wheat moisture distribution detection result in a classification or regression manner.
2. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: In steps S2 and S3, the Inception module includes 9 Inception layers, and the attention mechanism module SE and the maximum pooling layer are inserted after the second Inception layer; the attention mechanism module CBAM and the maximum pooling layer are inserted after the seventh Inception layer.
3. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: In step S1, the feature extraction module includes three convolutional layers, and a maximum pooling layer is respectively arranged after the first and the last convolutional layers.
4. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: In step S3, the attention mechanism module SE first uses a global average pooling operation to compress the information of each feature channel, and then uses two fully connected layers to obtain the information weight of each feature channel in the representation of wheat moisture distribution.
5. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: In step S3, the attention mechanism module CBAM uses a channel attention mechanism to obtain the information weight of each feature channel in the characterization of wheat moisture distribution, and uses a spatial attention mechanism to obtain the information weight of each spatial position in the feature map in the characterization of wheat moisture distribution.
6. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: In step S2, the Inception layer performs convolution combination processing on the feature map input from the previous layer on four paths at the same time. The first path uses a convolution layer with a size of 1×1, the second path uses a convolution layer with sizes of 1×1 and 3×3 for the front and back connections, the third path uses a convolution layer with sizes of 1×1 and 5×5 for the front and back connections, and the fourth path uses a convolution layer with sizes of 3×3 and 1×1 for the front and back connections. Finally, the convolution processing results of each path are connected by depth to obtain a new feature map that is input into the next layer.
7. The wheat moisture distribution THz image detection method according to claim 1, characterized in that: The wheat moisture distribution THz image in step S1 records the terahertz time-domain spectral information obtained by scanning the wheat with a terahertz spectral imaging device. The terahertz time-domain spectral information is stored in the form of three-dimensional image data, and each pixel point of the image data corresponds to a piece of terahertz time-domain spectral information of a specified time scale.
8. An electronic device, characterized in that include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the method described in any one of claims 1 to 7.
9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Automatic plantar pressure classification method and system based on multi-task learning framework
CN120046053A
Unmanned aerial vehicle hyperspectral image object-level target detection method based on spatial-spectral decoupling and double-flow interactive fusion
CN120823526A
