CN115661544A - N-MobileNetXt-based spinach seedling water stress level classification system and method - Google Patents
N-MobileNetXt-based spinach seedling water stress level classification system and method Download PDFInfo
- Publication number
- CN115661544A CN115661544A CN202211389124.4A CN202211389124A CN115661544A CN 115661544 A CN115661544 A CN 115661544A CN 202211389124 A CN202211389124 A CN 202211389124A CN 115661544 A CN115661544 A CN 115661544A
- Authority
- CN
- China
- Prior art keywords
- image
- module
- spinach
- water stress
- feature extraction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 241000219315 Spinacia Species 0.000 title claims abstract description 121
- 235000009337 Spinacia oleracea Nutrition 0.000 title claims abstract description 121
- 208000005156 Dehydration Diseases 0.000 title claims abstract description 87
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000000605 extraction Methods 0.000 claims abstract description 48
- 238000007781 pre-processing Methods 0.000 claims abstract description 31
- 238000012545 processing Methods 0.000 claims abstract description 8
- 238000013145 classification model Methods 0.000 claims description 29
- 238000012549 training Methods 0.000 claims description 29
- 238000012360 testing method Methods 0.000 claims description 27
- 238000010586 diagram Methods 0.000 claims description 16
- 102000001068 Neural Cell Adhesion Molecules Human genes 0.000 claims description 13
- 108010069196 Neural Cell Adhesion Molecules Proteins 0.000 claims description 13
- 230000007246 mechanism Effects 0.000 claims description 13
- 230000004913 activation Effects 0.000 claims description 10
- 238000011176 pooling Methods 0.000 claims description 10
- 230000006835 compression Effects 0.000 claims description 7
- 238000007906 compression Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000013507 mapping Methods 0.000 claims description 6
- 230000008859 change Effects 0.000 claims description 5
- 230000002708 enhancing effect Effects 0.000 claims description 5
- 238000004140 cleaning Methods 0.000 claims description 3
- 238000013527 convolutional neural network Methods 0.000 abstract description 6
- 230000002262 irrigation Effects 0.000 abstract description 4
- 238000003973 irrigation Methods 0.000 abstract description 4
- 238000001514 detection method Methods 0.000 abstract description 3
- 238000013135 deep learning Methods 0.000 abstract description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 16
- 230000006870 function Effects 0.000 description 15
- 230000008569 process Effects 0.000 description 8
- 241000196324 Embryophyta Species 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- 239000002689 soil Substances 0.000 description 4
- 239000000758 substrate Substances 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000006872 improvement Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 238000003384 imaging method Methods 0.000 description 2
- 230000001965 increasing effect Effects 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000002073 fluorescence micrograph Methods 0.000 description 1
- 238000000799 fluorescence microscopy Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 208000024891 symptom Diseases 0.000 description 1
- 238000001931 thermography Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P60/00—Technologies relating to agriculture, livestock or agroalimentary industries
- Y02P60/20—Reduction of greenhouse gas [GHG] emissions in agriculture, e.g. CO2
- Y02P60/21—Dinitrogen oxide [N2O], e.g. using aquaponics, hydroponics or efficiency measures
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a spinach seedling water stress grade classification system and method based on N-mobileNetXt, belonging to the technical field of image recognition and deep learning, and comprising an image acquisition module, an image preprocessing module, an image feature extraction module and a display module; the image acquisition module loads one frame of a spinach seedling picture or video as input; the collected images are input into an image processing module for image preprocessing, the processed images to be detected are continuously input into an image feature extraction module, the image feature extraction module performs feature extraction and grading on the spinach leaf images sent by the image preprocessing module, and a grade result is output through a display module. The invention applies the convolutional neural network, and the water stress level of the spinach seedling is identified and classified according to the spinach leaf image, so that the rapid and effective detection of the water stress of the spinach seedling is realized to monitor the crop state, and scientific guidance is provided for crop irrigation.
Description
Technical Field
The invention belongs to the technical field of image recognition and deep learning, and particularly relates to a spinach seedling water stress grade classification system and method based on N-MobileNetXt.
Background
China is the largest industrialized agriculture production country in the world, but the problem of outstanding water resource supply and demand contradictions exists in the industrialized agriculture water in arid and semiarid regions, and the realization of efficient water-saving management of the industrialized crops is particularly important. Spinach has a very large demand in the market of China, and researches show that the physiological growth of crops is influenced by water stress in the growth and development process of spinach, so that the yield of spinach is reduced. Therefore, the reasonable irrigation strategy is an important way for realizing water saving and high yield of spinach planting; accurate identification and grading of water stress of crops can provide technical support for reasonable irrigation of facility agriculture.
Water stress can cause symptoms of plant phenotype, plant leaves can wither and droop under a certain period of water shortage, and leaf color and shape can be obviously changed compared with green leaves without water stress. Therefore, the method is effective and feasible for identifying the phenotypic characteristics of the crops under the water stress through the image technology and then grading the water stress, and the method is lossless identification and avoids the damage to the crops.
At present, four main images for exploring plant changes under water stress are fluorescence imaging, thermal imaging, hyperspectral image and RGB image; among them, fluorescence images are obtained in a controlled laboratory environment, which poses some challenges in the field of practical applications; thermal and hyperspectral images are particularly susceptible to background and illumination variations in the real world, and these imaging sensors are extremely costly and not suitable for use in the field of facility agriculture. In addition to the specific imaging sensor for capturing the physiological characteristics of plants, the conventional RGB digital image has the characteristics of low cost, portability and the like, and plays an important role in identifying the phenotypic characteristics of crops based on a computer vision method.
With the development of computer vision, image processing and machine learning technologies are widely applied to the agricultural field, and the convolutional neural network can extract different water stress phenotypic characteristics of plants from RGB images, has strong generalization capability and has better performance compared with the traditional machine learning characteristic extraction. Therefore, the invention provides a spinach seedling water stress grade classification system based on a convolutional neural network model, which realizes nondestructive detection of spinach seedling water stress.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a spinach seedling water stress grade classification method and system based on N-MobileNet Xt, wherein a convolutional neural network is applied to identify and classify the water stress grade of spinach seedlings according to spinach leaf images, so that the rapid and effective spinach seedling water stress detection is realized to monitor the crop state, and scientific guidance is provided for crop irrigation.
The invention is realized by the following technical scheme:
the N-mobileNetXt-based spinach seedling water stress level classification system comprises an image acquisition module, an image preprocessing module, an image feature extraction module and a display module;
the image acquisition module is used for acquiring spinach leaf images for identifying the water stress level and sending the spinach leaf images to the image preprocessing module;
the image preprocessing module is used for converting the spinach leaf image sent by the image acquisition module into an image format and size supported by the image feature extraction module and sending the image format and size to the image feature extraction module;
the image feature extraction module is used for extracting and grading the features of the spinach leaf image sent by the image preprocessing module; and sending to a display module;
the display module is used for displaying the classification result of the water stress level of the spinach image.
Further, when the pixel value of the spinach leaf image sent by the image acquisition module is greater than or less than 224px multiplied by 224px, the image preprocessing module adopts a reshape () function in a PyTorch frame to recombine tensor elements of the original image into the width and the height of a new target image in sequence, and returns a view of the new tensor to meet the requirement of the feature extraction module.
Further, the image formats supported by the image feature extraction module are JPG and PNG formats, and the pixels are three-channel RGB color images of 224px × 224 px.
On the other hand, the invention also provides a classification method of the N-MobileNetXt-based spinach seedling water stress grade classification system, which specifically comprises the following steps: the image acquisition module loads one frame of a spinach seedling picture or video as input; the collected images are input into an image processing module for image preprocessing, the processed images to be detected are continuously input into an image feature extraction module, the image feature extraction module performs feature extraction and grading on the spinach leaf images sent by the image preprocessing module, and a grade result is output through a display module.
Further, the image feature extraction module performs feature extraction and classification on the spinach leaf image sent by the image preprocessing module, and specifically comprises the following steps:
s1: constructing different water stress data sets of spinach seedlings and carrying out data cleaning, specifically comprising the following steps:
acquiring original images of spinach seedlings under different water stress, and deleting unclear and incomplete images;
s2: performing data enhancement operation on the image and dividing a training set and a test set, wherein the method specifically comprises the following steps:
carrying out data enhancement operation on the cleaned image, and then dividing the enhanced data into a training set and a test set;
s3: constructing a spinach seedling water stress level classification model, which comprises the following steps:
s31, selecting Relu6 as an activation function based on a MobileNet XT network model to obtain a characteristic diagram;
s32, inputting the extracted feature map into an improved hourglass residual error module, and performing convolution operation through a grouping and convolution module to obtain deep features of the image;
s33, introducing an NCMA attention mechanism into the N-MobileNet Xt network, and constructing a spinach seedling water stress level classification model;
s4: inputting the data set into a spinach seedling water stress grade classification model for training to obtain a trained grading model, which specifically comprises the following steps:
inputting the image data of the training set into a spinach seedling water stress level classification model for training, extracting image characteristics, and then testing and adjusting parameters by using the test set to finally obtain a spinach seedling water stress level classification model;
s5: obtaining an image of the spinach seedling to be graded, inputting the image into a classification model, and outputting a water stress level, wherein the water stress level comprises the following specific steps:
obtaining an image of the spinach seedling to be classified, processing the image according to the image preprocessing operation in the step S1 to obtain an image of the spinach seedling to be detected, which accords with the input size of the model, inputting the image into a classification model for classification, outputting a moisture stress grade result of the spinach seedling, and completing a moisture stress nondestructive classification task of the spinach seedling.
Further, in the step S1, the conditions for collecting the original images of the spinach seedlings under different water stresses comprise direct light, reverse light, sufficient sunlight and cloudy days.
Further, step S2 specifically includes the following steps:
s21: performing data enhancement operation on the original image data sets of all spinach seedlings obtained in the step S1 under different water stresses, and expanding the data sets;
s22: marking different water stress levels in the expanded data set to form a label, and constructing a sample data set;
s23: the sample data set is divided into a training set and a test set according to the proportion of 8:2.
Further, the data enhancement operation in step S21 adopts a brightness enhancement mode, a contrast enhancement mode, a rotation mode or a horizontal inversion mode.
Further, in step S3,
the improved hourglass residual module is used for feature extraction, the NCAM attention mechanism module is used for enhancing image features, and the grouping convolution module is used for feature map compression;
the hourglass residual error module comprises an Expansion layer (Expansion layer) module and a Projection layer (Projection layer) module, wherein the Projection layer module adopts a 1 x 1 convolution network structure and is used for mapping high-dimensional features to a low-dimensional space, the Expansion layer module adopts a 1 x 1 convolution network structure and is used for mapping the low-dimensional space to the high-dimensional space, and the accuracy and the model size are optimal when the dimension Expansion multiple is determined to be 5 times;
the NCAM attention mechanism comprises three parallel branches including an NAM attention layer, a same-average pooling layer and a maximum pooling layer, wherein the three parallel branches are connected with a shared network formed by a plurality of layers of perceptrons, in the shared network, channel number compression is realized through SimConv convolution, then a PReLU activation function is connected, and finally the original channel number is expanded through one SimConv layer; after passing through a shared network, generating three corresponding output results (nam _ out, avg _ out and max _ out), and performing element-by-element addition on output data of the three output results; finally, obtaining an output result of the NCAM through a sigmoid activation function;
and the grouping convolution module is used for grouping the characteristic graphs into four groups, so that the parameter quantity is changed into one fourth of the original quantity, and the calculation pressure of the model is effectively reduced. Further, step S4 specifically includes the following steps:
firstly, inputting a training set to train the model, judging whether the value of a loss function is reduced along with the change of time, when the value of the loss function is not changed within a period of time, indicating that the loss function is converged, judging by adopting a test set at the moment, and judging whether the model can learn the characteristics; if the result of the test set does not reach the standard, the model is trapped in a local optimal solution or the characteristic is not learned, the spinach seedling water stress level classification model or the initial parameter is readjusted, and training is carried out again; and if the result obtained by the test set meets the requirement, the training is finished, and the weight and the parameters of the trained optimal model are reserved.
Compared with the prior art, the invention has the following advantages:
1. the method is combined with an image technology, and the original convolutional neural network architecture is adopted to extract the characteristics of the image, so that the real-time identification of the moisture stress level of the spinach seedling is accurately and efficiently realized under the conditions of low cost and no damage to a sample;
2. the convolutional neural network model for classifying the water stress levels of the spinach seedlings obtains a good identification and classification effect in a large number of spinach images shot in a complex background environment, and has sufficient reliability;
3. according to the method, the improved hourglass residual error module is embedded into a network model framework to improve the performance of the model; an NCAM attention mechanism is introduced to replace CA attention, information loss in the spatial information extraction process is made up, and the feature extraction capability of the image is enhanced; the grouping convolution module is introduced to reduce the model parameter quantity and improve the model training speed;
4. the hourglass residual error module, the NCAM attention mechanism and the introduced grouping convolution module greatly reduce the parameter quantity of the model while enhancing the feature extraction capability of the model, fully embody the advantages of small volume, less parameter quantity and high efficiency of the lightweight network model, have the calculation time within an acceptable range and have sufficient practicability.
Drawings
In order to more clearly illustrate the detailed description of the invention or the technical solutions in the prior art, the drawings that are needed in the detailed description of the invention or the prior art will be briefly described below. Throughout the drawings, like elements or portions are generally identified by like reference numerals. In the drawings, elements or portions are not necessarily drawn to scale.
FIG. 1 is a system block diagram of an N-MobileNet Xt based water stress level classification system for spinach seedlings;
FIG. 2 is a schematic diagram of the operation of the image feature extraction module;
FIG. 3 is an image data enhancement diagram of spinach seedling;
FIG. 4 is a diagram of a MobileNetXt network architecture;
FIG. 5 is a diagram of an improved hourglass residual block in a network architecture;
wherein, a is a schematic diagram of an existing hourglass residual error module, and b is a schematic diagram of an improved hourglass residual error module;
FIG. 6 is a diagram of an attention module in a network architecture;
FIG. 7 is a block diagram of a packet volume module in a network architecture.
Detailed Description
For clearly and completely describing the technical scheme and the specific working process thereof, the specific implementation mode of the invention is as follows by combining the attached drawings of the specification:
in the description of the specification, reference to the description of "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Example 1
As shown in fig. 1, the system block diagram of an N-MobileNetXt-based spinach seedling water stress level classification system according to this embodiment is shown, where the level classification system includes an image acquisition module, an image preprocessing module, an image feature extraction module, and a display module; the image acquisition module, the image preprocessing module, the image feature extraction module and the display module are sequentially connected;
the image acquisition module is used for acquiring spinach leaf images for identifying the water stress level and sending the spinach leaf images to the image preprocessing module; the image acquisition module comprises local picture uploading and camera real-time acquisition; in the real-time shooting process of the camera, an image acquisition module identifies and classifies each frame of a video; the grade classification system does not require the size of the obtained image, but requires the collected or uploaded spinach leaves to be an RGB color image;
the image preprocessing module is used for converting the spinach leaf image sent by the image acquisition module into an image format and size supported by the image feature extraction module and sending the image format and size to the image feature extraction module; when the pixel value of the spinach leaf image sent by the image acquisition module is larger than or smaller than 224px multiplied by 224px, the image preprocessing module adopts a reshape () function in a PyTorch frame, sequentially recombines tensor elements of the original image into the width and the height of a new target image, and returns a view of the new tensor so as to meet the requirement of the feature extraction module.
The image feature extraction module is used for extracting and grading the features of the spinach leaf image sent by the image preprocessing module; and sending to a display module; the image formats supported by the image feature extraction module are JPG and PNG formats, and the pixels are three-channel RGB color images of 224px multiplied by 224 px.
And the display module is used for displaying the classification result of the water stress level of the spinach image.
The work flow of the N-mobileNet Xt-based spinach seedling water stress level classification system is as follows:
taking the classification of spinach seedling water stress level as an example, the image acquisition module needs to load one frame of a spinach seedling picture or video as input; inputting the collected image into the image processing module of the embodiment for image preprocessing, and when the input image does not meet the model requirement input size, correcting the image by the reshape () function operation; it should be noted that the data enhancement operation is only used in the process of training the model, the system has packaged the optimal model parameters, and the step is omitted when testing a single picture. The processed image to be detected is continuously input into a feature extraction module, and according to the extracted image features and the trained weights and parameters of the model, the module can classify the spinach image in different stress levels and output a level result; and in the display module, the output value of the image characteristic receiving module and the time for calculating and identifying the image are displayed, the identification process is stored in a log every time, and finally a txt file is generated, so that the follow-up tracing is facilitated.
Example 2
The embodiment provides a spinach seedling water stress grade classification model, which is based on MobileNetXt and is improved aiming at the classification problem of a complex background, wherein the network structure of an improved N-MobileNetXt is shown in fig. 4; firstly, spinach seedling images with the size of 224 multiplied by 3 are input, feature extraction is carried out through a 3 multiplied by 3 convolution layer, batch standardization and a ReLU6 activation function, and the extracted feature graph is used as the input of the next network layer. The improved hourglass residual error module provided by the invention is added into the layer1-layer5 and layer8 network layers in the model architecture, so that the effect of improving the model identification accuracy is achieved; introducing grouping convolution in the network layers of layer6 and layer7 of the model, aiming at reducing the parameter number, generating a corresponding characteristic diagram for each group of convolution, and fusing the obtained characteristics together to form a final characteristic diagram; in order to improve the accuracy of the classification model, an NCAM attention module is introduced behind a layer8 network layer, and the effect of characteristic enhancement is achieved at lower cost through multi-branch design; in order to compress calculated quantity and improve the robustness of the model, two-dimensional self-adaptive average pooling is used; and finally, connecting the Dropout layer and the full connection layer for classification task.
Specifically, as shown in fig. 2, a schematic flow diagram of the image feature extraction module performing feature extraction and classification on a spinach leaf image sent by the image preprocessing module is shown, and it should be noted that a spinach seedling water stress classification model is packaged in the module, and in the specific operation of the system, the model does not need to be trained and tested, and features of a picture sent by the image preprocessing module can be directly extracted and classified, which specifically includes the following steps:
s1: constructing different water stress data sets of spinach seedlings and carrying out data cleaning, specifically comprising the following steps:
collecting original images of spinach seedlings under different water stresses, and deleting unclear and incomplete images;
as a preferred embodiment, the spinach seedling water stress data set constructed in step S1 mainly uses spinach seedlings planted in strip pots as samples, as shown in fig. 3, where four strip pots correspond to four water stress levels, which are: the average water content of the non-stress treated T1 substrate is 37.5 percent, and the field water capacity is 75 to 85 percent; the average water content of the I-level stress T2 substrate is 21.1 percent, and the field water capacity is 55 to 65 percent; the average water content of the II-grade stress T3 substrate is 10.2 percent, and the field water capacity is 35 to 45 percent; the average water content of the III-level stress T4 substrate is 5.7 percent, and the field water capacity is 15 to 25 percent; the spinach is tested from the growth period to the seedling period, the test period is 14 days, the soil humidity is measured by using a soil multi-element sensor, and water is supplemented when the water content of the soil is reduced to the lower limit of the controlled water content range, so that the soil is kept in the corresponding water content range, and the reliability of the test is ensured. In the embodiment, the image data is acquired by adopting the smart phone, and in the shooting process, the image proportion is 1:1 and the resolution is 3000 multiplied by 3000; in the collection process, spinach seedlings with complex backgrounds and natural conditions are collected, wherein the spinach seedlings include the conditions of direct light, backlight, sufficient sunlight, cloudy days and the like, various environments in actual planting are covered, and the robustness of a model algorithm is enhanced.
S2: performing data enhancement operation on the image and dividing a training set and a test set, wherein the method specifically comprises the following steps:
carrying out data enhancement operation on the cleaned image, and then dividing the enhanced data into a training set and a test set;
the method specifically comprises the following steps:
s21: performing data enhancement operation on the original image data sets of all spinach seedlings obtained in the step S1 under different water stresses, and expanding the data sets;
s22: marking different water stress levels in the expanded data set to form a label, and constructing a sample data set;
s23: the sample data set is divided into a training set and a test set according to the proportion of 8:2.
As a preferred embodiment, the data enhancement operation in step S21 is performed by brightness enhancement, contrast enhancement, rotation or horizontal flipping; the number of data set samples can be increased, so that the model can obtain more accurate weight parameters for images shot under the complex background condition;
s3: as shown in FIG. 4, a spinach seedling water stress level classification model is constructed as follows:
s31, selecting Relu6 as an activation function based on a MobileNet XT network model to obtain a characteristic diagram;
s32, inputting the extracted feature map into an improved hourglass residual error module, and performing convolution operation through a grouping and convolution module to obtain deep features of the image;
s33, introducing an NCMA attention mechanism into the N-MobileNet Xt network, and constructing a spinach seedling water stress level classification model;
as a preferred embodiment, the hourglass residual module is used for feature extraction, the NCAM attention mechanism module is used for enhancing image features, and the packet convolution module is used for feature map compression;
as a preferred embodiment, as shown in fig. 5, fig. 5 (a) is an hourglass residual module of an original network, which has the problems of poor generalization capability, large calculation amount and deficient extraction capability for image feature information for an original hourglass residual structure; this embodiment makes the following improvements thereto, as shown in fig. 5 (b): the hourglass residual error module comprises an Expansion layer (Expansion layer) module and a Projection layer (Projection layer) module, wherein the Projection layer module adopts a 1 x 1 convolution network structure and is used for mapping high-dimensional features to a low-dimensional space, the Expansion layer module adopts a 1 x 1 convolution network structure and is used for mapping the low-dimensional space to the high-dimensional space, and the accuracy and the model size are optimal when the dimension Expansion multiple is determined to be 5 times;
the specific improvement points are explained as follows:
firstly, spatial information change is realized through 3 × 3 depth separable convolution, and because more characteristic information can be acquired through high dimensionality, 1 × 1 convolution dimensionality increasing operation is performed;
then, connecting a NAM non-attention mechanism module which does not increase the number of extra parameters while enhancing the image characteristics, and then connecting 1 × 1 convolution reduction and 3 × 3 depth separable convolution;
finally, a two-dimensional self-adaptive average pooling structure is added to a jump connection (shortcut) structure part, so that not only can the robustness of the model be improved, but also the effect of further concentrating data can be achieved, the accuracy of the model is improved, and the problem of large memory pressure in calculation is solved;
in addition, it should be noted that, during operation, the shortcut connection is triggered only when the step size (stride) is equal to 1 and the shapes (shape) of the input feature matrix and the output feature matrix are the same, otherwise, only the bottompiece part is executed.
As a preferred embodiment, as shown in fig. 6, the NCAM attention mechanism described in this embodiment includes three parallel branches, namely, NAM attention, a co-average pooling layer, and a maximum pooling layer, where the three parallel branches are connected to a shared network formed by multiple layers of perceptrons, and in the shared network, channel number compression is implemented by SimConv convolution, then a prellu activation function is connected, and finally an original channel number is expanded by an SimConv layer; after passing through a shared network, generating three corresponding output results (nam _ out, avg _ out and max _ out), and performing element-by-element addition on output data of the three output results; finally, obtaining an output result of the NCAM through a sigmoid activation function;
the specific improvement points are explained as follows:
since the spatial Attention SAM (spatial Attention Module) sub-Module is not suitable for spatial information extraction under a complex background, the embodiment deletes the SAM sub-Module in the CBAM Attention, introduces NAM Attention, and uses the same average pooling layer and the maximum pooling layer as three parallel branches, on one hand, makes up for the deficiency during spatial information extraction, and on the other hand, performs feature enhancement and dimension reduction compression operations on the feature map;
the NCAM attention mechanism module restrains the inconspicuous image information in the channel and the space, reduces the parameter quantity to a certain degree, and has a gain effect on the classification model.
As a preferred embodiment, as shown in fig. 7, the grouping convolution module in this embodiment is configured to, after the feature map is divided into four groups, change the parameter quantity to one fourth of the original parameter quantity, so as to effectively reduce the calculation pressure of the model.
Specifically, the input feature map can be divided into 4 groups according to channels, namely, each group of dimensions is (H, W, C/4), so that the filter is also divided into 4 groups, and the grouped dimensions are (H) ′ ,W ′ C/4), which is equivalent to splitting the original convolutional layer into 4 parallel convolutional layers, the number of filters is not changed at this time, but each filter is only responsible for C ′ And 4 channels of information, and finally combining and outputting 4 groups of convolution.
S4: inputting the data set into a spinach seedling water stress grade classification model for training to obtain a trained grading model, which specifically comprises the following steps:
inputting the image data of the training set into a spinach seedling water stress level classification model for training, extracting image characteristics, and then adopting a test set for testing and parameter adjustment to finally obtain a spinach seedling water stress level classification model;
as a preferred embodiment, firstly, inputting a training set to train the model, judging whether the value of the loss function is reduced along with the change of time, when the value of the loss function is not changed within a period of time, the value is already converged, and at this time, judging whether the model can learn the characteristics by adopting a test set; if the result of the test set does not reach the standard, the model is trapped in a local optimal solution or the characteristic is not learned, the spinach seedling water stress level classification model or the initial parameter is readjusted, and training is carried out again; and if the result obtained by the test set meets the requirement, the training is finished, and the weight and the parameters of the trained optimal model are reserved.
S5: obtaining an image of the spinach seedling to be graded, inputting the image into a classification model, and outputting a water stress level, wherein the water stress level comprises the following specific steps:
obtaining an image of the spinach seedling to be classified, processing the image according to the image preprocessing operation in the step S1 to obtain an image of the spinach seedling to be detected, which accords with the input size of the model, inputting the image into a classification model for classification, outputting a moisture stress grade result of the spinach seedling, and completing a moisture stress nondestructive classification task of the spinach seedling.
In the operation processes of steps S4 and S5, in order to evaluate the water stress level classification model result, 3 aspects of Precision (Precision), recall (Recall) and Specificity (Specificity) are selected and evaluated.
Each class classification performance evaluation is shown in Table 1
The classification performance evaluation of each category is shown in table 1; as can be seen from the table, the I-level stress has the highest precision rate which reaches 95.2%, the non-stress class recall rate is 95.7%, and the III-level stress has the highest specificity which reaches 98.5%, and the results show that the N-MobileNetXt model can accurately grade four water stresses of spinach seedlings and can meet the requirement of grading the water stresses of the spinach seedlings in practical application.
The preferred embodiments of the present invention have been described in detail with reference to the accompanying drawings, however, the present invention is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present invention within the technical idea of the present invention, and these simple modifications all fall within the protection scope of the present invention.
It should be noted that the various technical features described in the above embodiments can be combined in any suitable manner without contradiction, and the invention is not described in any way for the possible combinations in order to avoid unnecessary repetition.
In addition, any combination of the various embodiments of the present invention is also possible, and the same should be considered as the disclosure of the present invention as long as it does not depart from the spirit of the present invention.
Claims (10)
1. The spinach seedling water stress level classification system based on the N-MobileNet Xt is characterized by comprising an image acquisition module, an image preprocessing module, an image feature extraction module and a display module;
the image acquisition module is used for acquiring spinach leaf images for identifying the water stress level and sending the spinach leaf images to the image preprocessing module;
the image preprocessing module is used for converting the spinach leaf image sent by the image acquisition module into an image format and size supported by the image feature extraction module and sending the image format and size to the image feature extraction module;
the image feature extraction module is used for extracting and grading the features of the spinach leaf image sent by the image preprocessing module; and sending to a display module;
the display module is used for displaying the grade classification result of the spinach image and the grade classification of the water stress.
2. The N-MobileNetXt-based spinach seedling water stress level classification system as claimed in claim 1, wherein when the pixel value of the spinach leaf image sent by the image acquisition module is greater than or less than 224px × 224px, the image preprocessing module adopts a reshape () function in a PyTorch frame to recombine tensor elements of an original image into the width and height of a new target image in sequence, and returns a view of the new tensor to meet the requirement of the feature extraction module.
3. The N-MobileNetXt-based spinach seedling water stress level classification system as claimed in claim 1, wherein the image formats supported by the image feature extraction module are JPG and PNG formats, and the pixels are three-channel RGB color graph of 224px x 224 px.
4. The classification method of the N-MobileNetXt-based spinach seedling water stress level classification system as claimed in claim 1, which specifically comprises the following steps: the image acquisition module loads one frame of a spinach seedling picture or video as input; the collected images are input into an image processing module for image preprocessing, the processed images to be detected are continuously input into an image feature extraction module, the image feature extraction module performs feature extraction and grading on the spinach leaf images sent by the image preprocessing module, and a grade result is output through a display module.
5. The N-MobileNetXt-based classification method for the water stress level of spinach seedlings as claimed in claim 4, wherein the image feature extraction module performs feature extraction and classification on the spinach leaf images sent by the image preprocessing module, and the classification method comprises the following steps:
s1: constructing different water stress data sets of spinach seedlings and carrying out data cleaning, specifically comprising the following steps:
collecting original images of spinach seedlings under different water stresses, and deleting unclear and incomplete images;
s2: performing data enhancement operation on the image and dividing a training set and a test set, wherein the method comprises the following steps:
carrying out data enhancement operation on the cleaned image, and then dividing the enhanced data into a training set and a test set;
s3: constructing a spinach seedling water stress level classification model, which comprises the following steps:
s31, selecting Relu6 as an activation function based on a MobileNet XT network model to obtain a characteristic diagram;
s32, inputting the extracted feature map into an improved hourglass residual error module, and performing convolution operation through a grouping and convolution module to obtain deep features of the image;
s33, introducing an NCMA attention mechanism into the N-MobileNet Xt network, and constructing a spinach seedling water stress level classification model;
s4: inputting the data set into a spinach seedling water stress grade classification model for training to obtain a trained grading model, which specifically comprises the following steps:
inputting the image data of the training set into a spinach seedling water stress level classification model for training, extracting image characteristics, and then testing and adjusting parameters by using the test set to finally obtain a spinach seedling water stress level classification model;
s5: obtaining an image of the spinach seedling to be graded, inputting the image into a classification model, and outputting a water stress level, wherein the water stress level comprises the following specific steps:
obtaining an image of the spinach seedling to be classified, processing the image according to the image preprocessing operation in the step S1 to obtain an image of the spinach seedling to be detected, which accords with the input size of the model, inputting the image into a classification model for classification, outputting a moisture stress grade result of the spinach seedling, and completing a moisture stress nondestructive classification task of the spinach seedling.
6. The N-MobileNetXt-based classification method for water stress level of spinach seedlings as claimed in claim 4, wherein the conditions for collecting the different water stress original images of spinach seedlings in step S1 comprise direct light, reverse light, sunny and cloudy day.
7. The N-MobileNetXt-based spinach seedling water stress rating classification method as claimed in claim 4, wherein the step S2 specifically comprises the following steps:
s21: performing data enhancement operation on the original image data sets of all spinach seedlings obtained in the step S1 under different water stresses, and expanding the data sets;
s22: marking different water stress levels in the expanded data set to form a label, and constructing a sample data set;
s23: the sample data set is divided into a training set and a test set according to the proportion of 8:2.
8. The method for classifying N-MobileNetXt-based spinach seedling water stress levels as claimed in claim 4, wherein the data enhancement operation in step S21 is performed by brightness enhancement, contrast enhancement, rotation or horizontal inversion.
9. The method for classifying N-MobileNetXt-based spinach seedling water stress levels as claimed in claim 4, wherein in step S3,
the improved hourglass residual module is used for feature extraction, the NCAM attention mechanism module is used for enhancing image features, and the grouping convolution module is used for feature map compression;
the hourglass residual error module comprises an Expansion layer (Expansion layer) module and a Projection layer (Projection layer) module, wherein the Projection layer module adopts a 1 x 1 convolution network structure and is used for mapping high-dimensional features to a low-dimensional space, the Expansion layer module adopts a 1 x 1 convolution network structure and is used for mapping the low-dimensional space to the high-dimensional space, and the accuracy and the model size are optimal when the dimension Expansion multiple is determined to be 5 times;
the NCAM attention mechanism comprises three parallel branches including an NAM attention layer, a same-average pooling layer and a maximum pooling layer, wherein the three parallel branches are connected with a shared network formed by a plurality of layers of perceptrons, in the shared network, channel number compression is realized through SimConv convolution, then a PReLU activation function is connected, and finally the original channel number is expanded through one SimConv layer; after passing through a shared network, generating three corresponding output results (nam _ out, avg _ out and max _ out), and performing element-by-element addition on output data of the three output results; finally, obtaining an output result of the NCAM through a sigmoid activation function;
and the grouping convolution module is used for grouping the characteristic graphs into four groups, so that the parameter quantity is changed into one fourth of the original quantity, and the calculation pressure of the model is effectively reduced.
10. The N-MobileNetXt-based spinach seedling water stress level classification method as claimed in claim 4, wherein the step S4 specifically comprises the following steps:
firstly, inputting a training set to train the model, judging whether the value of a loss function is reduced along with the change of time, when the value of the loss function is not changed within a period of time, showing that the value is converged, and judging whether the model can learn the characteristics by adopting a test set at the moment; if the result of the test set does not reach the standard, the model is trapped in a local optimal solution or the characteristic is not learned, the spinach seedling water stress level classification model or the initial parameter is readjusted, and training is carried out again; and if the result obtained by the test set meets the requirement, the training is finished, and the weight and the parameters of the trained optimal model are reserved.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211389124.4A CN115661544B (en) | 2022-11-08 | 2022-11-08 | Spinach seedling water stress grade classification system and method based on N-MobileNetXt |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211389124.4A CN115661544B (en) | 2022-11-08 | 2022-11-08 | Spinach seedling water stress grade classification system and method based on N-MobileNetXt |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115661544A true CN115661544A (en) | 2023-01-31 |
CN115661544B CN115661544B (en) | 2024-04-05 |
Family
ID=85016968
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211389124.4A Active CN115661544B (en) | 2022-11-08 | 2022-11-08 | Spinach seedling water stress grade classification system and method based on N-MobileNetXt |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115661544B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117853801A (en) * | 2024-01-09 | 2024-04-09 | 华中农业大学 | Deep learning classification model and application thereof in corn multiple growth stage phenotype detection |
CN117929467A (en) * | 2024-03-25 | 2024-04-26 | 上海农林职业技术学院 | Blade moisture data detection system and method based on thermal imaging technology |
CN118365929A (en) * | 2024-04-03 | 2024-07-19 | 淮阴工学院 | Mung bean salt stress identification method based on LMS-Net lightweight model |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112488230A (en) * | 2020-12-07 | 2021-03-12 | 中国农业大学 | Crop water stress degree judging method and device based on machine learning |
WO2021203505A1 (en) * | 2020-04-09 | 2021-10-14 | 丰疆智能软件科技(南京)有限公司 | Method for constructing pest detection model |
CN114494689A (en) * | 2022-01-27 | 2022-05-13 | 中国科学院合肥物质科学研究院 | Identification method of tomato drought stress |
US20220230305A1 (en) * | 2019-05-16 | 2022-07-21 | Basf Se | System and method for plant disease detection support |
CN114972843A (en) * | 2022-04-26 | 2022-08-30 | 黑龙江省农业科学院农业遥感与信息研究所 | Agricultural pest diagnosis and early warning system based on big data |
CN115049902A (en) * | 2022-05-11 | 2022-09-13 | 华南农业大学 | Citrus leaf water content visual prediction method, system, equipment and storage medium |
CN115100148A (en) * | 2022-06-23 | 2022-09-23 | 安徽省农业科学院农业经济与信息研究所 | Crop pest detection method based on light-weight convolutional neural network |
-
2022
- 2022-11-08 CN CN202211389124.4A patent/CN115661544B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20220230305A1 (en) * | 2019-05-16 | 2022-07-21 | Basf Se | System and method for plant disease detection support |
WO2021203505A1 (en) * | 2020-04-09 | 2021-10-14 | 丰疆智能软件科技(南京)有限公司 | Method for constructing pest detection model |
CN112488230A (en) * | 2020-12-07 | 2021-03-12 | 中国农业大学 | Crop water stress degree judging method and device based on machine learning |
CN114494689A (en) * | 2022-01-27 | 2022-05-13 | 中国科学院合肥物质科学研究院 | Identification method of tomato drought stress |
CN114972843A (en) * | 2022-04-26 | 2022-08-30 | 黑龙江省农业科学院农业遥感与信息研究所 | Agricultural pest diagnosis and early warning system based on big data |
CN115049902A (en) * | 2022-05-11 | 2022-09-13 | 华南农业大学 | Citrus leaf water content visual prediction method, system, equipment and storage medium |
CN115100148A (en) * | 2022-06-23 | 2022-09-23 | 安徽省农业科学院农业经济与信息研究所 | Crop pest detection method based on light-weight convolutional neural network |
Non-Patent Citations (4)
Title |
---|
DAQUAN ZHOU: "Rethinking Bottleneck Structure for Efficient Mobile Network Design", ARXIV, 27 November 2020 (2020-11-27), pages 1 - 24 * |
QIBIN HOU: "Coordinate Attention for Efficient Mobile Network Design", AXXIV, 4 March 2021 (2021-03-04), pages 1 - 10 * |
YICHAO LIU: "NAM: Normalization-based Attention Module", ARXIV, 24 November 2021 (2021-11-24), pages 1 - 5 * |
房若民: "MobileNet算法的嵌入式农业病虫害识别系统", 单片机与嵌入式系统应用, 31 May 2020 (2020-05-31), pages 61 - 63 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117853801A (en) * | 2024-01-09 | 2024-04-09 | 华中农业大学 | Deep learning classification model and application thereof in corn multiple growth stage phenotype detection |
CN117929467A (en) * | 2024-03-25 | 2024-04-26 | 上海农林职业技术学院 | Blade moisture data detection system and method based on thermal imaging technology |
CN118365929A (en) * | 2024-04-03 | 2024-07-19 | 淮阴工学院 | Mung bean salt stress identification method based on LMS-Net lightweight model |
CN118365929B (en) * | 2024-04-03 | 2024-10-15 | 淮阴工学院 | Mung bean salt stress identification method based on LMS-Net lightweight model |
Also Published As
Publication number | Publication date |
---|---|
CN115661544B (en) | 2024-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115661544B (en) | Spinach seedling water stress grade classification system and method based on N-MobileNetXt | |
CN107067043A (en) | A kind of diseases and pests of agronomic crop detection method | |
CN114387520A (en) | Precision detection method and system for intensive plums picked by robot | |
CN109740483A (en) | A kind of rice growing season detection method based on deep-neural-network | |
CN111178177A (en) | Cucumber disease identification method based on convolutional neural network | |
CN116051996A (en) | Two-stage crop growth prediction method based on multi-mode information | |
CN113435254A (en) | Sentinel second image-based farmland deep learning extraction method | |
CN113011221A (en) | Crop distribution information acquisition method and device and measurement system | |
CN111967441A (en) | Crop disease analysis method based on deep learning | |
CN115019302A (en) | Improved YOLOX target detection model construction method and application thereof | |
CN116129260A (en) | Forage grass image recognition method based on deep learning | |
CN117456358A (en) | Method for detecting plant diseases and insect pests based on YOLOv5 neural network | |
CN117876823B (en) | Tea garden image detection method and model training method and system thereof | |
CN114937030A (en) | Phenotypic parameter calculation method for intelligent agricultural planting of lettuce | |
Zhao et al. | Transient multi-indicator detection for seedling sorting in high-speed transplanting based on a lightweight model | |
Guo et al. | Panicle Ratio Network: streamlining rice panicle measurement by deep learning with ultra-high-definition aerial images in the field | |
CN116052141B (en) | Crop growth period identification method, device, equipment and medium | |
CN113344009A (en) | Light and small network self-adaptive tomato disease feature extraction method | |
CN117197595A (en) | Fruit tree growth period identification method, device and management platform based on edge calculation | |
CN117079125A (en) | Kiwi fruit pollination flower identification method based on improved YOLOv5 | |
CN116740337A (en) | Safflower picking point identification positioning method and safflower picking system | |
CN115147835B (en) | Pineapple maturity detection method based on improved RETINANET natural orchard scene | |
CN111523503A (en) | Apple target detection method based on improved SSD algorithm | |
CN116188317A (en) | Method for acquiring lettuce growth information in plant factory based on oblique shooting image | |
Poorni et al. | Detection of rice leaf diseases using convolutional neural network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |