Oilseed rape root tumor level identification method, device and equipment and storage medium
By using a neural network model for grading rapeseed root tumors, combined with a basic residual module and an attention mechanism, the problem of poor accuracy in grading rapeseed root tumors was solved, achieving more efficient and accurate tumor grade identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN POLYTECHNIC UNIVERSITY
- Filing Date
- 2023-05-17
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for grading rapeseed root tumors are inaccurate, inefficient, unreliable, and time-sensitive, relying heavily on human experience and resulting in large errors.
A rapeseed root tumor grading neural network model is adopted, which combines a basic residual module and an attention mechanism. Through feature extraction and recognition, the ability to capture features in detail is improved. The model includes convolutional layers, pooling layers, a basic residual module, and a residual module with an attention mechanism. Transfer learning is used to optimize the model parameters.
It significantly improves the accuracy and efficiency of rapeseed root tumor grading, enabling more accurate identification of tumor levels, reducing human error, and enhancing the reliability and timeliness of grading.
Smart Images

Figure CN117115806B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and storage medium for identifying rapeseed root tumor levels. Background Technology
[0002] Rapeseed is an important oilseed crop in my country, accounting for one-quarter of the world's total planting area and yield. Moreover, as a major oilseed crop in my country, rapeseed has a wide planting area and a large consumer base; therefore, research on rapeseed clubroot disease is of great practical significance. However, rapeseed clubroot disease spreads rapidly and causes serious damage, becoming the biggest challenge facing rapeseed production. Currently, the classification of rapeseed clubroot disease in my country is mostly based on the experience of farmers and professionals. While this method can solve the problem of rapeseed clubroot disease to some extent, it lacks reliability and timeliness.
[0003] Currently, there are two main categories of methods for grading rapeseed clubroot disease. One category is based on traditional image processing techniques for classifying the severity of rapeseed root tumors. Continued research has shown that using convolutional neural networks for rapeseed root tumor grading can eliminate the influence of human factors on tumor classification, solving the limitations of manually designed features and the blindness of experience-based judgments. However, the accuracy of the model still needs improvement.
[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this invention is to provide a method for identifying the grade of rapeseed root tumors, aiming to solve the technical problems of poor accuracy and low efficiency in the existing traditional rapeseed root tumor grading technology.
[0006] To achieve the above objectives, the present invention provides a method for identifying the level of root tumors in rapeseed, the method comprising the following steps:
[0007] Obtain the image of rapeseed root tumor to be identified, and input the image of rapeseed root tumor grading neural network model;
[0008] The feature extraction layer of the rapeseed root tumor grading neural network model is used to extract features from the image to be identified, and the feature extraction layer includes a basic residual module and a residual module containing an attention mechanism.
[0009] The feature recognition layer of the rapeseed root tumor grading neural network model is used to identify the feature vector to be identified, thereby obtaining the tumor grade of the rapeseed root tumor.
[0010] Optionally, the feature extraction layer further includes a convolutional layer and a pooling layer;
[0011] The feature extraction process, performed using the feature extraction layer of the rapeseed root tumor grading neural network model, yields the features to be identified, including:
[0012] The image to be identified is subjected to feature extraction through a convolutional layer to obtain an initial feature vector;
[0013] The initial feature vector is filtered through the pooling layer to obtain a reference feature vector;
[0014] The reference feature vector is further processed by the basic residual module and the residual module containing the attention mechanism to obtain the feature vector to be identified.
[0015] Optionally, the step of extracting features from the reference feature vector again using a basic residual module and a residual module containing an attention mechanism to obtain the feature vector to be identified includes:
[0016] The basic feature vector is obtained by extracting features from the reference feature vector through the basic residual module. The rapeseed root tumor grading neural network model includes one basic residual module.
[0017] The basic feature vector is extracted by a residual module containing an attention mechanism to obtain the feature vector to be identified. The rapeseed root tumor grading neural network model includes three residual modules containing an attention mechanism.
[0018] Optionally, the step of extracting features from the basic feature vector using a residual module containing an attention mechanism to obtain the feature vector to be identified includes:
[0019] The basic feature vector is increased in dimensionality by a residual module containing an attention mechanism to obtain a first-order feature vector to be identified;
[0020] The convolutional feature vector is obtained by convolving the basic feature vector with a residual module containing an attention mechanism;
[0021] The initial feature vector to be identified is obtained by processing the first-order feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism;
[0022] The initial feature vector to be identified is obtained by extracting features from the residual module containing an attention mechanism.
[0023] Optionally, the step of processing the first-order feature vector to be identified and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism to obtain the initial feature vector to be identified includes:
[0024] The convolutional feature vector is reduced in dimension and then increased in dimension by using an attention mechanism to obtain the processed convolutional feature vector.
[0025] The initial feature vector to be identified is obtained by adding the processed convolutional feature vector and the first-order feature vector to be identified through an attention mechanism.
[0026] Optionally, before extracting features through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified, the process includes:
[0027] An initial hierarchical neural network model is obtained by setting the attention mechanism in a preset neural network.
[0028] The parameters of the initial hierarchical neural network model are adjusted by the pre-trained weights to obtain the initial hierarchical neural network model, the rapeseed root tumor hierarchical neural network model.
[0029] The rapeseed root tumor grading neural network model was modified and trained using the training dataset to obtain the training results.
[0030] Based on the training results, a loss function is constructed, and the parameters of the rapeseed root tumor grading neural network model are optimized based on the loss function to obtain the rapeseed root tumor grading neural network model.
[0031] Optionally, the step of extracting features through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified further includes:
[0032] The validation dataset is input into the rapeseed root tumor grading neural network model to obtain the validation grading results;
[0033] Evaluation parameters are obtained based on the true level of rapeseed root tumors in the validation dataset and the validation grading results.
[0034] The recognition accuracy of the rapeseed root tumor grading neural network model is determined based on the evaluation parameters.
[0035] Furthermore, to achieve the above objectives, the present invention also proposes a rapeseed root tumor level identification device, the rapeseed root tumor level identification device comprising:
[0036] The acquisition module is used to acquire the image to be identified of rapeseed root tumors and input the image to be identified into the rapeseed root tumor grading neural network model.
[0037] The feature extraction module is used to extract features from the image to be identified through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the feature vector to be identified. The feature extraction layer includes a basic residual module and a residual module containing an attention mechanism.
[0038] The feature recognition module is used to perform feature recognition on the feature vector to be identified through the feature recognition layer of the rapeseed root tumor grading neural network model to obtain the tumor grade of the rapeseed root tumor.
[0039] In addition, to achieve the above objectives, the present invention also proposes a rapeseed root tumor level identification device, which includes: a memory, a processor, and a rapeseed root tumor level identification program stored in the memory and executable on the processor. The rapeseed root tumor level identification program is configured to implement the steps of the rapeseed root tumor level identification method as described above.
[0040] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a rapeseed root tumor level identification program, wherein the rapeseed root tumor level identification program, when executed by a processor, implements the steps of the rapeseed root tumor level identification method as described above.
[0041] This invention uses the basic residual module in the rapeseed root tumor grading neural network model for preliminary feature extraction, and then uses an attention mechanism to improve the neural network's ability to capture detailed features in rapeseed root images, extracting more detailed rapeseed root tumor features. By recognizing detailed features, the neural network's ability to identify tumor grade features in rapeseed root disease areas can be effectively improved, thereby effectively improving the accuracy of negative rapeseed root tumor grading. Attached Figure Description
[0042] Figure 1 This is a schematic diagram of the structure of a rapeseed root tumor-level identification device in the hardware operating environment involved in the embodiments of the present invention;
[0043] Figure 2 This is a flowchart illustrating the first embodiment of the rapeseed root tumor level identification method of the present invention;
[0044] Figure 3 This is a schematic diagram of a rapeseed root image, representing an embodiment of the rapeseed root tumor level identification method of the present invention.
[0045] Figure 4 This is a schematic diagram of a rapeseed root tumor image according to an embodiment of the rapeseed root tumor level identification method of the present invention;
[0046] Figure 5 This is a schematic diagram of the residual structure of an embodiment of the rapeseed root tumor level identification method of the present invention;
[0047] Figure 6 This is a schematic diagram of a neural network model for classifying rapeseed root tumors, according to an embodiment of the rapeseed root tumor classification method of the present invention.
[0048] Figure 7This is a schematic diagram of a ResNet34 neural network in an embodiment of the rapeseed root tumor level identification method of the present invention;
[0049] Figure 8 This is a schematic diagram of rapeseed root tumor levels according to an embodiment of the rapeseed root tumor level identification method of the present invention;
[0050] Figure 9 This is a schematic diagram illustrating two attention mechanism enhancement strategies in an embodiment of the rapeseed root tumor level identification method of the present invention.
[0051] Figure 10 This is a flowchart illustrating the second embodiment of the rapeseed root tumor level identification method of the present invention;
[0052] Figure 11 This is a schematic diagram of the attention mechanism in an embodiment of the rapeseed root tumor level identification method of the present invention;
[0053] Figure 12 This is a schematic diagram of the attention mechanism feature extraction process in an embodiment of the rapeseed root tumor level identification method of the present invention;
[0054] Figure 13 This is a partial schematic diagram of the attention mechanism in an embodiment of the rapeseed root tumor level identification method of the present invention;
[0055] Figure 14 This is a schematic diagram of the training results of an embodiment of the rapeseed root tumor level identification method of the present invention;
[0056] Figure 15 This is a schematic diagram illustrating the verification results of an embodiment of the rapeseed root tumor level identification method of the present invention;
[0057] Figure 16 This is a structural block diagram of the first embodiment of the rapeseed root tumor level identification device of the present invention.
[0058] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0059] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0060] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a rapeseed root tumor level identification device in the hardware operating environment of an embodiment of the present invention.
[0061] like Figure 1As shown, the rapeseed root tumor-level identification device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0062] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the rapeseed root tumor level identification device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0063] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a rapeseed root tumor-level identification program.
[0064] exist Figure 1 In the rapeseed root tumor level identification device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the rapeseed root tumor level identification device of the present invention can be set in the rapeseed root tumor level identification device, and the rapeseed root tumor level identification device calls the rapeseed root tumor level identification program stored in the memory 1005 through the processor 1001 and executes the rapeseed root tumor level identification method provided in the embodiment of the present invention.
[0065] This invention provides a method for identifying the grade of rapeseed root tumors, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of a method for identifying the tumor level of rapeseed roots according to the present invention.
[0066] In this embodiment, the method for identifying the level of rapeseed root tumors includes the following steps:
[0067] Step S10: Obtain the image of the rapeseed root tumor to be identified, and input the image to be identified into the rapeseed root tumor grading neural network model.
[0068] Understandably, the image to be identified could be a rapeseed root image that needs to be identified at the tumor level.
[0069] It should be understood that the acquisition method can be either directly obtaining an image of the rapeseed root by taking a picture with a camera, or obtaining an image of only the rapeseed root after cropping a complete rapeseed image. For details, please refer to [reference needed]. Figure 3 and Figure 4 .
[0070] Understandably, the rapeseed root tumor grading neural network model here is a model obtained by adding an attention mechanism to the ResNet series of neural networks and transferring the pre-trained parameters to the neural network.
[0071] It should be noted that the rapeseed root tumor grading neural network model used in this embodiment employs ResNet34. An attention mechanism is added to the ResNet34 neural network model. This model mainly consists of three parts: 1. ResNet34 as the backbone convolutional neural network module, responsible for extracting basic image features and transmitting information; 2. An attention mechanism to enhance the network's ability to identify rapeseed root tumor lesion areas; 3. A transfer learning method to reduce training costs and accelerate network training. Compared with other classification networks, the model proposed in this paper has a shorter training time, stronger feature extraction ability, and higher accuracy.
[0072] It should be emphasized that the key point of ResNet lies in the introduction of residual structures, such as... Figure 5 As shown. The residual structure uses a shortcut connection method, which can also be understood as a shortcut, allowing the feature matrices to be added every other layer. The most essential and important formula for the residual neural network is as follows:
[0073] f(x)=g(x)+x
[0074] Here, f(x) is the output of the final residual block, g(x) is the output of the two convolutions in the residual network, and x is the sample dataset. During the process of adding the feature matrices across layers, it is necessary to ensure that g(x) and x have the same shape; the so-called addition refers to adding the numbers at the same positions in the feature matrices.
[0075] In practical implementation, the steps for completing the grading of rapeseed root tumors using the neural network model can be referenced. Figure 6 Compared to the original ResNet34 model Figure 7Comparative observations show that the rapeseed root tumor grading neural network model adds an attention mechanism to each residual module in the original ResNet34 neural network.
[0076] It is worth noting that, according to the rapeseed root nodule grading standards provided by oilseed suppliers (as shown in Table 1), rapeseed clubroot disease can be divided into five grades: N0 (normal), N1 (Grade 1), N2 (Grade 2), N3 (Grade 3), and N4 (Grade 4). Regarding the rapeseed growth stage biological characteristic description standard N0: no root nodules, please refer to... Figure 8 Figure A in the diagram; N1: Small bean-shaped or strip-shaped root nodules only on the lateral roots, see reference. Figure 8 Figure B in the diagram; N2: Both the main root and lateral roots have small root nodules, which can be referenced. Figure 8 Figure C in the diagram; N3: Both the main root and lateral roots have large root nodules, please refer to the diagram. Figure 8 Figure D in the diagram; N4: Both the main root and lateral roots have large and obvious root nodules, which can be referenced. Figure 8 Figure E in the diagram.
[0077] Step S20: Extract features from the image to be identified using the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the feature vector to be identified. The feature extraction layer includes a basic residual module and a residual module containing an attention mechanism.
[0078] Understandably, reference Figure 6 The feature extraction layer of the rapeseed root tumor grading neural network model includes a "convolutional layer: Conv 7*7 64" and a "pooling layer: max pool 3*3" as shown in the figure, as well as a basic residual module and three residual modules with attention mechanisms.
[0079] It should be noted that, Figure 6 The residual module containing the attention mechanism can be divided into two parts: the dashed part and the solid part. For the solid residual structure, g(x) can be directly added to x because they have the same shape. However, for the dashed residual structure, the output g(x) and the input x have different shapes. Therefore, a convolutional layer with a kernel size of 1x1 is used to change the shape of the input x so that it is consistent with the shape of g(x).
[0080] It should be noted that feature extraction is performed through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified, including: extracting features from the image to be identified through a convolutional layer to obtain an initial feature vector; filtering the initial feature vector through a pooling layer to obtain a reference feature vector; and extracting features from the reference feature vector again through a basic residual module and a residual module containing an attention mechanism to obtain the feature vector to be identified.
[0081] In specific implementation, refer to Figure 6 It can be clearly understood that in this rapeseed root tumor grading neural network model, the convolutional and pooling layers take an image to be identified with 3 channels and a size of 224x224 as input to the network; then a convolutional layer with a kernel size of 7x7 extracts features (a feature vector) from the image to capture the basic linear relationships in the image; and then a 3x3 pooling layer is applied, at which point the image size becomes 56x56 and the number of channels becomes 64.
[0082] It is worth noting that adding an attention mechanism during feature extraction can effectively improve the extraction of features in detail, thereby enabling more accurate feature recognition based on features.
[0083] To further explain, the process of extracting features from the reference feature vector using the basic residual module and the residual module containing the attention mechanism to obtain the feature vector to be identified includes: extracting features from the reference feature vector using the basic residual module to obtain a basic feature vector, wherein the rapeseed root tumor grading neural network model includes one basic residual module; and extracting features from the basic feature vector using the residual module containing the attention mechanism to obtain the feature vector to be identified, wherein the rapeseed root tumor grading neural network model includes three residual modules containing the attention mechanism.
[0084] It is worth further elaborating that the neural network structure of ResNet34 is used here. Adding an attention mechanism based on ResNet34 can achieve more accurate identification of rapeseed root tumor levels.
[0085] It should be emphasized that the step of extracting features from the basic feature vector using a residual module with an attention mechanism to obtain a feature vector to be identified includes: increasing the dimensionality of the basic feature vector using a residual module with an attention mechanism to obtain a first-order feature vector to be identified; performing convolution on the basic feature vector using a residual module with an attention mechanism to obtain a convolutional feature vector; processing the first-order feature vector to be identified and the convolutional feature vector using the attention mechanism in the residual module with an attention mechanism to obtain an initial feature vector to be identified; and extracting features from the initial feature vector to be identified using a residual module with an attention mechanism to obtain the feature vector to be identified.
[0086] Understandably, by processing the first-order feature vector to be identified and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism, the initial feature vector to be identified can be obtained as follows: Figure 9 The placement of the two attention mechanisms in the neural network is illustrated in this embodiment using the first position as an example.
[0087] In practice, Figure 9 Both models consist of four residual parts, each containing a different number of residual blocks: 3, 4, 6, and 3 blocks respectively. In the first residual part, all three residual blocks are solid-line residual structures. In the second residual part, the first residual block is a dashed-line structure, and the remaining three are solid-line structures. In the third residual part, all five residual blocks are solid-line structures except for the first dashed-line structure. In the fourth residual part, the first residual block is also a dashed-line structure, and the remaining two are solid-line structures. Finally, the outputs of the four residual parts are concatenated with a global average pooling layer and a fully connected layer to obtain the final output.
[0088] It is worth emphasizing that the attention mechanism in this neural network performs dimensionality reduction and expansion of features, adds nonlinear processing, can fit the complex correlations between channels, improve the perceptual ability during feature extraction, and thus obtain more useful features. Furthermore, based on these features, feature recognition can be performed more accurately.
[0089] It should be further emphasized that the initial feature vector to be identified is obtained by processing the first-order feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism, including:
[0090] The convolutional feature vector is reduced in dimension and then increased in dimension by using an attention mechanism to obtain the processed convolutional feature vector.
[0091] The initial feature vector to be identified is obtained by adding the processed convolutional feature vector and the first-order feature vector to be identified through an attention mechanism.
[0092] It should be noted that the reference is... Figure 9 As can be seen from the second model structure, the initial feature vector to be identified is obtained by processing the first-order feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism. This is achieved by adding the convolutional feature vector and the first-order feature vector to be identified, then performing dimensionality reduction and then dimensionality increase.
[0093] It is worth emphasizing the structural location of the attention mechanism. Accuracy varies depending on the location.
[0094] In the specific implementation, the deep learning framework used was PyTorch 1.13.0, CUDA 11.3, and Python version 3.10. The Python library was managed using Anaconda3. The system was Windows 10 Home Chinese Edition, the GPU was an NVIDIA GeForce GTX 1050Ti with 12GB of graphics memory, and the CPU was an Intel(R) Core(TM) i7-7700HQ to verify the effectiveness of the proposed rapeseed root tumor disease grading algorithm. It was compared and tested with the original ResNet34 network model and the ResNet34 network model with SE attention mechanism introduced at different positions. This experiment designed five network models: ResNet34; the ResNet34_Qianyi model with a ResNet34 backbone and employing transfer learning; the SE_ResNet34_Qianyi model with a ResNet34 backbone and incorporating the SE_Standard attention mechanism; the SE_Post_ResNet34 model with a ResNet34 backbone and incorporating the SE_Post attention mechanism; and the SE_Standard_ResNet34 model with a ResNet34 backbone and incorporating the SE_Standard attention mechanism. During training, all models maintained the same preprocessing methods and training parameters, except for the network architecture. Each neural network model was optimized using the Adam optimizer. The learning rate was 0.0001, the batch size was 64, and the number of epochs was 80.
[0095] The experiment used the cross-entropy loss function in conjunction with the Softmax classifier. The Softmax classifier classifies images by estimating the probability of each category, rather than directly scoring the image category like a Support Vector Machine (SVM) classifier. The Softmax classifier normalizes the output components corresponding to each category, ensuring that the sum of the components is 1. Its probability calculation formula is as follows:
[0096]
[0097] The accuracy of ranking strategies is assessed based on the calculated probabilities to determine which attention mechanism increases the accuracy of the strategy.
[0098] The formula for calculating the cross-entropy loss function is as follows:
[0099]
[0100] Among them, S i It is the Softmax probability function, Lc It is the cross-entropy loss function, where K is the total number of classes, and y is the cross-entropy loss function. i P is the true probability that the target belongs to the i-th class. i It is the probability that the target predicted by the network belongs to category i.
[0101] The model estimates the predicted probability density function that best approximates the target distribution from the training dataset based on the cross-entropy loss function.
[0102] Step S30: The feature recognition layer of the rapeseed root tumor grading neural network model is used to perform feature recognition on the feature vector to be identified, so as to obtain the tumor grade of the rapeseed root tumor.
[0103] Understandably, the feature recognition layer can include a global average pooling layer and a fully connected layer. The global average pooling layer can be referenced... Figure 9 The "avg pool" in the fully connected layer can be referenced. Figure 9 The "fc" in the text.
[0104] It should be understood that the extracted feature vectors to be identified are classified by the feature recognition layer to determine which level the feature vector belongs to among N0 (normal), N1 (level 1), N2 (level 2), N3 (level 3), and N4 (level 4), thereby obtaining the level of the rapeseed root tumor in the image.
[0105] This embodiment uses the basic residual module in the rapeseed root tumor grading neural network model for preliminary feature extraction, and then uses an attention mechanism to improve the neural network's ability to capture detailed features in rapeseed root images, extracting more detailed rapeseed root tumor features. By recognizing detailed features, the neural network's ability to identify tumor grade features in rapeseed root disease areas can be effectively improved, thereby effectively improving the accuracy of negative rapeseed root tumor grading.
[0106] refer to Figure 10 , Figure 10 This is a flowchart illustrating a second embodiment of a method for identifying the tumor level of rapeseed roots according to the present invention.
[0107] Based on the first embodiment described above, the rapeseed root tumor level identification method of this embodiment further includes, before step S20:
[0108] Step S201: Set the attention mechanism in the preset neural network to obtain the initial hierarchical neural network model.
[0109] Understandably, the initial hierarchical neural network model can be simply understood as a ResNet34 neural network model with an added attention mechanism. The default neural network can be a ResNet34 neural network.
[0110] Understandably, to address the issue that rapeseed root tumors are distributed in unpredictable locations across the entire image, and that the N1 and N2 level tumor regions are small, an SE attention module is introduced on top of ResNet34 as the backbone convolutional neural network to enhance the network's feature extraction of the rapeseed root tumor portion and improve recognition accuracy.
[0111] It should be understood that the attention mechanism added to the channel dimension mainly consists of two parts: squeeze and excitation, which correspond to... Figure 11 The dashed and solid border sections.
[0112] It should be noted that Squeeze ( Figure 11 The Fsq(·) operation uses global average pooling, compressing the two-dimensional features HxW of each channel to 1x1, that is, compressing the feature map from [H,W,C] to [1,1,C]. The calculation formula is as follows:
[0113]
[0114] Excitation Figure 11 The Fex(·,w) operation is implemented using two fully connected layers. To reduce computation, the first fully connected layer compresses the C channels into C / r channels at a ratio of 1 / r. The second fully connected layer then restores the original C channels, where r is the compression ratio, which defaults to 16. The specific formula is as follows:
[0115] s=Fex(z,W)=σ(g(z,W))=σ(W2δ(W1z))
[0116] σ represents the Sigmoid function, and δ represents the ReLU function.
[0117] In specific implementation, you can refer to Figure 12 The attention mechanism involves global pooling of an input feature map of H x W x C, resulting in a 1x1xC feature map. This is followed by two fully connected layers. The first fully connected layer has c / r neurons, and after dimensionality reduction, the second fully connected layer increases the dimensionality to c neurons. This is done to increase the non-linear processing and better fit the complex correlations between channels. A sigmoid layer then provides another 1x1xC feature map. Finally, a weighted multiplication operation is performed on the original H x W x C and the 1x1xC feature maps, thereby improving ResNet34's ability to perceive features related to rapeseed root tumors and further enhancing its interpretability and classification performance.
[0118] It is important to emphasize that there are several different ways to add the SE attention mechanism. Introducing the SE attention mechanism at different locations in the network will produce certain differences in the extracted rapeseed root tumor disease features. This embodiment mainly selects two different locations to introduce the SE attention mechanism. The first method is to insert an SE module between the residual modules, which can obtain a ResNet34-SE-Standard model, the network structure of which is as follows. Figure 13 As shown in the left figure; the second method uses an SE module inserted after the residual module, resulting in the ResNet34-SE-Post model structure as follows. Figure 13 As shown in the right figure. This embodiment uses the first structure as an example for illustration, and obtains a model with better accuracy through the first structure.
[0119] Step S202: Adjust the parameters of the initial hierarchical neural network model with the pre-trained weights to obtain the initial hierarchical neural network model, the rapeseed root tumor hierarchical neural network model.
[0120] Understandably, the pre-trained weights can be used to accelerate the training speed of the network model by using transfer learning to transfer the pre-trained parameter weights to the initial hierarchical neural network model for training.
[0121] It should be understood that by using transfer learning to train the model using existing relevant task datasets and transferring the learned features to this experiment, the problem of insufficient data can be alleviated, and the training efficiency of the model can be improved, the training cost can be reduced, and the performance of the model can be greatly improved.
[0122] Step S203: Modify and train the rapeseed root tumor grading neural network model using the training dataset to obtain the training results.
[0123] Understandably, the training dataset may be derived from the 2021 Hubei Provincial Department of Education Teaching Research Project "Research on the Construction of Case Database for Agricultural Engineering and Information Technology Professional Courses"; the rapeseed root tumor images used in the training dataset are all from the Oil Crops Research Institute of the Chinese Academy of Agricultural Sciences (hereinafter referred to as the Oil Crops Institute), totaling 4,000 images of rapeseed after it emerges from the soil, with ten rapeseed plants in each image, that is, a total of 40,000 root tumor sample images.
[0124] It should be understood that after obtaining the raw image data, these images must first be preprocessed. Only the image dataset obtained after preprocessing can be used for model training and testing, because raw image data is not always suitable for deep learning models. Therefore, the entire image needs to be preprocessed before training. In this experiment, the raw data was cropped manually / by computer image segmentation, cropping one raw image into 10 root images.
[0125] It should be noted that while cropping yields a large amount of image data, the number of images for different tumor grades is severely inconsistent, and this data imbalance can seriously affect model training. To prevent overfitting and improve the model's generalization performance, 3692 images, roughly the same number as the number of tumor grades, were ultimately selected for the experiment. Approximately 740 images were taken from each of grades 0-4 to form the final dataset. 80% of this dataset was used as the training dataset, and 20% as the test dataset.
[0126] It is important to emphasize that before inputting the image into the convolutional neural network, the image should first be scaled to 256x256 pixels, then the pixels should be normalized to between 0 and 1, and a standardization operation should be performed with a mean and standard deviation of 0.5. Standardizing the image size can improve the processing efficiency of the neural network for feature extraction.
[0127] It should be noted that before extracting features through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified, the process further includes: inputting a verification dataset into the rapeseed root tumor grading neural network model to obtain verification grading results; obtaining evaluation parameters based on the true level of rapeseed root tumors in the verification dataset and the verification grading results; and determining the recognition accuracy of the rapeseed root tumor grading neural network model based on the evaluation parameters.
[0128] It should be further explained that when training the rapeseed root tumor grading neural network model using training data, the model's accuracy (Acc), recall (R), precision (P), and F1 score were tested on images from the test dataset for each category. The calculation formulas are as follows:
[0129]
[0130]
[0131]
[0132]
[0133] Where P represents positive samples, N represents negative samples, T represents correct prediction, F represents incorrect prediction, TP represents the number of positive samples predicted as positive by the model, TN represents the number of negative samples predicted as negative by the model, FP represents the number of negative samples predicted as positive by the model, and FN represents the number of positive samples predicted as negative by the model. P = TP + FN, N = TN + FP.
[0134] In practice, multiple models are trained using a training dataset, and the loss curves of each network model are collected during training, such as... Figure 14As shown in the figure, the SE_ResNet34_Qianyi model, with a ResNet34 backbone and the addition of the SE_Standard attention mechanism, is not only more stable but also performs better during training. Among the three network models (ResNet34, SE_Post_ResNet34, and SE_Standard_ResNet34), compared to the other two, this network model has a larger loss value, poorer stability, and larger oscillations. SE_ResNet34_Qianyi and ResNet34_Qianyi have similar stability, but SE-ResNet34_Qianyi has a smaller loss.
[0135] It should be noted that SE_Standard_ResNet34 and SE-ResNet34_Qianyi describe two neural networks that add attention mechanisms at different locations within the ResNet34 neural network. For details, please refer to [link / reference needed]. Figure 9 The two images are shown in the middle and upper parts.
[0136] Step S204: Construct a loss function based on the training results, and optimize the parameters of the rapeseed root tumor grading neural network model based on the loss function to obtain the rapeseed root tumor grading neural network model.
[0137] Understandably, the number of accurately recognized images, the number of incorrectly recognized images, and the total number of images in SE-ResNet34_Qianyi during training are used to construct a time-varying function. The weight parameters of the pre-trained model are then adjusted using a loss function to obtain the final rapeseed root tumor grading neural network model.
[0138] It is worth noting that the accuracy of the rapeseed root tumor grading neural network model can be effectively improved by determining whether this model can improve accuracy.
[0139] In practice, the results of different rapeseed root tumor disease image grading models are shown in the table below:
[0140]
[0141]
[0142] As shown in the table above, the ResNet34_Qianyi model with ResNet34 as the backbone network and employing transfer learning, and the SE_ResNet34_Qianyi model with ResNet34 as the backbone network and incorporating the SE_Standard attention mechanism, achieved accuracy of 84.90% and 86.39% respectively in grading rapeseed root tumors, which are superior to the original ResNet34 (54.15%).
[0143] At the same time, refer to Figure 15 As can be seen, the SE_Standard_ResNet34 model, which only adds the SE attention mechanism to the ResNet34 network, shows an overall improvement in accuracy compared to the original ResNet34, but the improvement is not significant. The SE_Post_ResNet34 model's accuracy is even lower than the original ResNet34 model. The ResNet34_Qianyi model based on transfer learning shows a significant improvement in grading performance compared to the original ResNet34 model. The SE_ResNet34_Qianyi model, which adds the SE attention mechanism to the ResNet34_Qianyi model, achieves the highest accuracy at the same learning rate and epochs. Therefore, the SE_ResNet34_Qianyi model proposed in this invention effectively improves the accuracy of rapeseed root tumor grading, providing technical support for the prevention and control of rapeseed clubroot disease.
[0144] This embodiment addresses the issue of the variable distribution of rapeseed root tumors across an image, particularly the small size of N1 and N2 tumor regions. Evaluation metrics demonstrate that by introducing an SE attention module on top of a ResNet34-based convolutional neural network, the network's feature extraction of rapeseed root tumors is enhanced, improving recognition accuracy. Furthermore, the use of transfer learning, training the model on existing datasets, alleviates the data shortage problem, improves training efficiency, reduces training costs, and significantly enhances model performance.
[0145] Furthermore, this embodiment of the invention also proposes a storage medium storing a rapeseed root tumor level identification program, which, when executed by a processor, implements the steps of the rapeseed root tumor level identification method described above.
[0146] Reference Figure 16 , Figure 16 This is a structural block diagram of the first embodiment of the rapeseed root tumor level identification device of the present invention.
[0147] like Figure 16 As shown, the rapeseed root tumor level identification device proposed in this embodiment of the invention includes:
[0148] The acquisition module 10 is used to acquire the image to be identified of rapeseed root tumors and input the image to be identified into the rapeseed root tumor grading neural network model.
[0149] The feature extraction module 20 is used to extract features from the image to be identified through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the feature vector to be identified. The feature extraction layer includes a basic residual module and a residual module containing an attention mechanism.
[0150] The feature recognition module 30 is used to perform feature recognition on the feature vector to be identified through the feature recognition layer of the rapeseed root tumor grading neural network model to obtain the tumor level of the rapeseed root tumor.
[0151] This embodiment uses the basic residual module in the rapeseed root tumor grading neural network model for preliminary feature extraction, and then uses an attention mechanism to improve the neural network's ability to capture detailed features in rapeseed root images, extracting more detailed rapeseed root tumor features. By recognizing detailed features, the neural network's ability to identify tumor grade features in rapeseed root disease areas can be effectively improved, thereby effectively improving the accuracy of negative rapeseed root tumor grading.
[0152] In one embodiment, the feature extraction module 20 is further configured to extract features from the image to be identified through a convolutional layer to obtain an initial feature vector;
[0153] The initial feature vector is filtered through the pooling layer to obtain a reference feature vector;
[0154] The reference feature vector is further processed by the basic residual module and the residual module containing the attention mechanism to obtain the feature vector to be identified.
[0155] In one embodiment, the feature extraction module 20 is further configured to extract features from the reference feature vector through the basic residual module to obtain a basic feature vector, and the rapeseed root tumor grading neural network model includes one basic residual module;
[0156] The basic feature vector is extracted by a residual module containing an attention mechanism to obtain the feature vector to be identified. The rapeseed root tumor grading neural network model includes three residual modules containing an attention mechanism.
[0157] In one embodiment, the feature extraction module 20 is further configured to increase the dimensionality of the basic feature vector through a residual module containing an attention mechanism to obtain a first-order feature vector to be identified.
[0158] The convolutional feature vector is obtained by convolving the basic feature vector with a residual module containing an attention mechanism;
[0159] The initial feature vector to be identified is obtained by processing the first-order feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism;
[0160] The initial feature vector to be identified is obtained by extracting features from the residual module containing an attention mechanism.
[0161] In one embodiment, the feature extraction module 20 is further configured to reduce the dimensionality of the convolutional feature vector and then increase its dimensionality using an attention mechanism to obtain a processed convolutional feature vector.
[0162] The initial feature vector to be identified is obtained by adding the processed convolutional feature vector and the first-order feature vector to be identified through an attention mechanism.
[0163] In one embodiment, the feature extraction module 20 is further configured to set an attention mechanism in a preset neural network to obtain an initial hierarchical neural network model;
[0164] The parameters of the initial hierarchical neural network model are adjusted by the pre-trained weights to obtain the initial hierarchical neural network model, the rapeseed root tumor hierarchical neural network model.
[0165] The rapeseed root tumor grading neural network model was modified and trained using the training dataset to obtain the training results.
[0166] Based on the training results, a loss function is constructed, and the parameters of the rapeseed root tumor grading neural network model are optimized based on the loss function to obtain the rapeseed root tumor grading neural network model.
[0167] In one embodiment, the feature extraction module 20 is further configured to input the verification dataset into the rapeseed root tumor grading neural network model to obtain the verification grading result;
[0168] Evaluation parameters are obtained based on the true level of rapeseed root tumors in the validation dataset and the validation grading results.
[0169] The recognition accuracy of the rapeseed root tumor grading neural network model is determined based on the evaluation parameters.
[0170] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.
[0171] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.
[0172] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0173] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0174] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0175] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for identifying the grade of rapeseed root tumors, characterized in that, The method for identifying the grade of rapeseed root tumors includes: Obtain the image of rapeseed root tumor to be identified, and input the image of rapeseed root tumor grading neural network model; The feature extraction layer of the rapeseed root tumor grading neural network model is used to extract features from the image to be identified, and the feature extraction layer includes a basic residual module, a residual module with an attention mechanism, a convolutional layer, and a pooling layer. The feature recognition layer of the rapeseed root tumor grading neural network model is used to identify the feature vector to be identified, thereby obtaining the tumor grade of the rapeseed root tumor. The feature extraction layer of the rapeseed root tumor grading neural network model is used to extract features from the image to be identified, resulting in a feature vector to be identified, including: The convolutional layer is used to extract features from the image to be identified, resulting in an initial feature vector. The initial feature vector is filtered through the pooling layer to obtain a reference feature vector; The basic feature vector is obtained by extracting features from the reference feature vector through the basic residual module. The rapeseed root tumor grading neural network model includes one basic residual module. The basic feature vector is increased in dimensionality by a residual module containing an attention mechanism to obtain a first-order feature vector to be identified; The convolutional feature vector is obtained by convolving the basic feature vector with a residual module containing an attention mechanism; The initial feature vector to be identified is obtained by processing the first-order feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism; The rapeseed root tumor grading neural network model obtains the feature vector to be identified by extracting features from the initial feature vector to be identified through a residual module containing an attention mechanism. The model includes three residual modules containing an attention mechanism.
2. The method for identifying rapeseed root tumor levels as described in claim 1, characterized in that, The process of obtaining the initial feature vector to be identified by processing the primary feature vector and the convolutional feature vector through the attention mechanism in the residual module containing the attention mechanism includes: The convolutional feature vector is reduced in dimension and then increased in dimension by using an attention mechanism to obtain the processed convolutional feature vector. The initial feature vector to be identified is obtained by adding the processed convolutional feature vector and the first-order feature vector to be identified through an attention mechanism.
3. The method for identifying rapeseed root tumor levels as described in claim 2, characterized in that, Before extracting features through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified, the process includes: An initial hierarchical neural network model is obtained by setting the attention mechanism in a preset neural network. The parameters of the initial hierarchical neural network model are adjusted using the pre-trained weights to obtain the initial hierarchical neural network model, the rapeseed root tumor hierarchical neural network model. The rapeseed root tumor grading neural network model was modified and trained using the training dataset to obtain the training results; Based on the training results, a loss function is constructed, and the parameters of the rapeseed root tumor grading neural network model are optimized based on the loss function to obtain the rapeseed root tumor grading neural network model.
4. The method for identifying rapeseed root tumor levels as described in claim 3, characterized in that, The feature extraction process, which extracts features through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the features to be identified, also includes: The validation dataset is input into the rapeseed root tumor grading neural network model to obtain the validation grading results; Evaluation parameters are obtained based on the true level of rapeseed root tumors in the validation dataset and the validation grading results. The recognition accuracy of the rapeseed root tumor grading neural network model is determined based on the evaluation parameters.
5. A device for identifying the level of rapeseed root tumors, characterized in that, The rapeseed root tumor level identification device includes: The acquisition module is used to acquire the image to be identified of rapeseed root tumors and input the image to be identified into the rapeseed root tumor grading neural network model. The feature extraction module is used to extract features from the image to be identified through the feature extraction layer of the rapeseed root tumor grading neural network model to obtain the feature vector to be identified. The feature extraction layer includes a basic residual module, a residual module with an attention mechanism, a convolutional layer, and a pooling layer. The feature recognition module is used to perform feature recognition on the feature vector to be identified through the feature recognition layer of the rapeseed root tumor grading neural network model to obtain the tumor grade of the rapeseed root tumor; The feature extraction module is further configured to extract features from the image to be identified through the convolutional layer to obtain an initial feature vector; filter the initial feature vector through the pooling layer to obtain a reference feature vector; extract features from the reference feature vector through the basic residual module to obtain a basic feature vector. The rapeseed root tumor grading neural network model includes one basic residual module; the basic feature vector is up-dimensioned through a residual module containing an attention mechanism to obtain a first-order feature vector to be identified; the basic feature vector is convolved through a residual module containing an attention mechanism to obtain a convolutional feature vector; the first-order feature vector to be identified and the convolutional feature vector are processed through the attention mechanism in the residual module containing an attention mechanism to obtain an initial feature vector to be identified; and the initial feature vector to be identified is extracted through a residual module containing an attention mechanism to obtain a feature vector to be identified. The rapeseed root tumor grading neural network model includes three residual modules containing attention mechanisms.
6. A device for identifying rapeseed root tumor levels, characterized in that, The device includes: a memory, a processor, and a rapeseed root tumor level identification program stored in the memory and executable on the processor, the rapeseed root tumor level identification program being configured to implement the rapeseed root tumor level identification method as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores a rapeseed root tumor level identification program, which, when executed by a processor, implements the rapeseed root tumor level identification method as described in any one of claims 1 to 4.