Agricultural vegetable growth detection method and system based on artificial intelligence
Through the narrowband IoT sensor, YOLOv5-VE model and multi-label classification model, combined with the policy gradient algorithm, the complex environmental, pest and disease detection and data classification problems in agricultural vegetable growth detection are solved, and the analysis and yield of vegetable growth are improved.
Patent Information
- Application Number
- CN202311170550.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-09-12
AI Technical Summary
Existing agricultural vegetable growth detection methods have complex outdoor planting environments, weak generalization capabilities of pest and disease detection models, inaccurate data classification, and detection difficulties caused by differences in growing environments, which affect the analysis and prediction of vegetable growth processes.
Wireless sensors based on narrowband Internet of Things are used to obtain environmental parameters. The lightweight YOLOv5-VE model is used to optimize the pest and disease detection model. The multi-label vegetable classification model is used for data classification and annotation. The policy gradient algorithm is used to interact with the general growth detection model to optimize decision-making. Strategy.
It improves the accuracy of environmental parameter collection, generalization ability of pest and disease detection, data classification accuracy and vegetable growth effect, and enhances the evaluation of vegetable growth status and optimization of yield.
Smart Images

Figure CN117609895B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of agricultural information technology, and specifically relates to an agricultural vegetable growth detection method and system based on artificial intelligence. Background Art
[0002] Agricultural vegetable growth detection is a technical means that uses sensors, image recognition and data analysis. It monitors and records the temperature, humidity and light intensity parameters of the agricultural vegetable growth environment, identifies the growth status and pests and diseases of vegetables, and aims to achieve accurate monitoring and management of agricultural vegetable growth and improve the production efficiency and quality of agricultural vegetables. However, the existing agricultural vegetable growth detection methods have the following technical problems: the outdoor planting environment is complex, and the collection of environmental parameters during the vegetable growth process is subject to many restrictions, which affects the analysis and prediction of the vegetable growth process; the vegetable pest and disease detection model has weak generalization ability and high small target miss detection rate, resulting in the real-time detection and early warning of pests and diseases failing to meet the requirements; there is a technical problem that large-scale vegetable data cannot be accurately classified, resulting in the inability to accurately evaluate the multiple growth states of vegetables, which limits the growers from optimizing the vegetable planting process; there are differences in the growth environment of agricultural vegetables, and the generalization ability of the model is limited in the new growth environment, resulting in the inability to accurately detect the growth of agricultural vegetables. Summary of the invention
[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides an agricultural vegetable growth detection method and system based on artificial intelligence. In view of the technical problem that the outdoor planting environment is complex and the collection of environmental parameters during the vegetable growth process is subject to many restrictions, thereby affecting the analysis and prediction of the vegetable growth process, a wireless sensor based on narrowband Internet of Things is used to obtain environmental parameters in real time; in view of the technical problem that the vegetable disease and insect pest detection model has weak generalization ability and high small target missed detection rate, resulting in the real-time detection and early warning of diseases and insect pests failing to meet the requirements, a YOLOv5-VE model with a lightweight network structure is used as the disease and insect pest detection model, and an adaptive knowledge extraction method is used to optimize the model to improve the disease and insect pest detection model. The generalization ability of the model can be improved to reduce the missed detection of small targets; in order to solve the technical problem that large-scale vegetable data cannot be accurately classified, resulting in the inability to accurately evaluate the multiple growth states of vegetables and restricting growers from optimizing the vegetable planting process, a multi-label vegetable classification model is used for multi-label classification and annotation to record the comprehensive growth states of agricultural vegetables; in order to solve the technical problem that there are differences in the growth environment of agricultural vegetables and the generalization ability of the model is limited under the new growth environment, resulting in the inability to accurately detect the growth conditions of agricultural vegetables, a general growth detection model is used to continuously interact with the environment, and a policy gradient algorithm is used to introduce an advantage function to reduce the variance of gradient estimation, optimize and improve the decision-making strategy, and maximize the growth effect and yield of vegetables.
[0004] The technical solution adopted by the present invention is as follows: The agricultural vegetable growth detection method based on artificial intelligence provided by the present invention comprises the following steps:
[0005] Step S1: Environmental parameter collection, specifically deploying wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time;
[0006] Step S2: Extracting vegetable features, specifically using a hyperspectral imager to obtain hyperspectral data of agricultural vegetables and preprocessing them to extract feature data of the vegetables;
[0007] Step S3: Pest and disease detection, specifically using the YOLOv5-VE model with a lightweight network structure as the pest and disease detection model, and using an adaptive knowledge extraction method to optimize the model to improve the generalization ability of the pest and disease detection model;
[0008] Step S4: multi-label classification and annotation, specifically, building a multi-label vegetable classification model, after training in the general field, migrating to the target field single-label vegetable dataset after upsampling equalization for fine-tuning, and finally migrating to the multi-label vegetable dataset to achieve multi-label classification and annotation, and record the comprehensive growth status of agricultural vegetables;
[0009] Step S5: Universal detection of vegetable growth, specifically, building a universal detection model for vegetable growth to continuously interact with the environment, obtain actual data on vegetable growth, use the policy gradient algorithm, introduce the advantage function to reduce the variance of the gradient estimate, and adjust and optimize according to the actual data to maximize the growth effect and yield of vegetables.
[0010] Furthermore, in step S1, the environmental parameter collection includes the following steps:
[0011] Step S11: sensor selection and configuration, selecting appropriate sensors according to environmental monitoring requirements, including soil moisture sensors, soil temperature sensors, air humidity sensors, air temperature sensors and light intensity sensors, configuring the sensor's communication module and the frequency of collecting environmental parameters;
[0012] Step S12: deploying sensor nodes, deploying the sensor nodes according to the distribution of agricultural vegetables, ensuring that the sensors can cover key agricultural vegetable growing areas, and that the communication ranges between the nodes intersect with each other to form a stable sensor network;
[0013] Step S13: Data transmission and storage, connecting the sensor node to the narrowband Internet of Things communication network, the sensor node regularly collects environmental parameters, and transmits the environmental parameters to the cloud platform and terminal devices through the narrowband Internet of Things. The cloud platform provides storage, processing and analysis of environmental parameters, and the environmental parameters are received and viewed in real time through the terminal devices.
[0014] Further, in step S2, the vegetable feature extraction includes the following steps:
[0015] Step S21: data acquisition and processing, using a hyperspectral imager to obtain hyperspectral data of agricultural vegetables, and preprocessing the collected hyperspectral data, including spectral correction, noise removal and atmospheric correction;
[0016] Step S22: extracting hyperspectral features, extracting a large number of hyperspectral features, including absorption line intensity, spectral bandwidth and wavelength peak, reflecting the characteristic data of different types of vegetables, including color, morphology and tissue structure.
[0017] Furthermore, in step S3, the pest detection includes the following steps:
[0018] Step S31: Collect representative vegetable pest and disease samples as a pest and disease detection data set, and ensure that the pest and disease detection data set contains different types of pests and diseases and different types of vegetable species;
[0019] Step S32: training a pest detection model, using a YOLOv5-VE model with a lightweight network structure as the pest detection model, performing diversity expansion, and training on a pest detection dataset. During the training process, a variety of data enhancement techniques are used, including random scaling, random rotation, and random cropping, to increase the diversity of the pest detection dataset;
[0020] Step S33: Optimizing model parameters and loss functions, using an adaptive knowledge extraction method to introduce knowledge of a deep neural network model that has been trained on a large-scale training data set into the pest detection model, the adaptive knowledge extraction method comprising the following steps:
[0021] Step S331: Select a deep neural network model that has been trained on a large-scale training data set as a knowledge source, so that the pest detection model learns the knowledge of the deep neural network model that has been trained on the large-scale training data set;
[0022] Step S332: using the pest detection training data set to train the deep neural network model that has been trained on the large-scale training data set, obtaining the detection results of the pest detection training and performing softening processing, and then smoothing the detection results using the softmax function to obtain softened detection results;
[0023] Step S333: training a pest detection model using the pest detection training data set and the softened detection results;
[0024] Step S334: Define the output of the deep neural network model that has been trained on a large-scale training dataset as Z t, the output of the pest detection model is Z s , the temperature parameter is T, the total loss function of the adaptive knowledge extraction method includes the loss function of the detection result and the loss function of the knowledge extraction. The total loss function of the adaptive knowledge extraction method is calculated using the following formula:
[0025] ;
[0026] Where, L total is the total loss function of the adaptive knowledge extraction method, α is the weight coefficient of the loss function of the detection result, L cls is the loss function of the detection result, β is the weight coefficient of the loss function of knowledge extraction, L distill is the loss function for knowledge extraction;
[0027] Step S335: The loss function of the detection result is calculated based on the cross entropy, so that the pest detection model can correctly classify the samples and learn the prediction distribution of the deep neural network model that has been trained on a large-scale training data set. The loss function of the detection result is calculated using the following formula:
[0028] ;
[0029] Where N is the number of samples in the pest detection training data set, is the predicted distribution of the pest and disease detection model for the i-th sample, is the predicted distribution of the i-th sample by the deep neural network model that has been trained on a large-scale training dataset, C is the number of categories for pest and disease detection classification, c represents the c-th category, and i represents the i-th sample;
[0030] Step S336: The loss function of knowledge extraction constrains the output distribution of the pest detection model to be close to the output distribution of the deep neural network model that has been trained on a large-scale training data set, and calculates the loss function of knowledge extraction. The formula used is as follows:
[0031] ;
[0032] Where T is the temperature parameter;
[0033] Step S337: Optimizing the total loss function of the adaptive knowledge extraction method and updating the parameters of the pest detection model;
[0034] Step S338: determine the termination condition, and set an evaluation threshold in advance. If the total loss function output is lower than the evaluation threshold, the pest detection model training is completed; otherwise, continue to train the model;
[0035] Step S34: Practically apply the pest and disease detection model, deploy the trained pest and disease detection model into the actual application environment, detect vegetable pests and diseases, and perform automated pest and disease detection and early warning.
[0036] Furthermore, in step S4, the multi-label classification annotation includes the following steps:
[0037] Step S41: general domain pre-training, specifically using a large-scale general data set for pre-training to train a general image classification model with excellent performance, learn basic image feature extraction capabilities, and provide a good initial state for target domain fine-tuning;
[0038] Step S42: fine-tuning the target domain, specifically, taking the general image classification model parameters as the initial state of the target domain, using the upsampling method on the single-label vegetable dataset in the target domain to balance the dataset distribution, and retraining the general image classification model by adjusting the learning rate, the number of training rounds, and the batch size of the vegetable labels;
[0039] Step S43: Migrate to the multi-label vegetable dataset, specifically, migrate the retrained general image classification model to the multi-label vegetable dataset, adjust the last layer of the model as needed for the multi-label vegetable dataset, add a multi-label classification layer to adapt to the characteristics of the label classification task, use the multi-label vegetable dataset for further training, and fine-tune the model parameters on the multi-label vegetable dataset so that the general image classification model has both the underlying features of the general field and the single-label sample features, so as to obtain a multi-label vegetable classification model, which is better adapted to the multi-label classification and annotation task;
[0040] Step S44: labeling. The characteristic data of vegetables include the types of vegetables and the corresponding colors, shapes, tissue structures and pest and disease characteristics of various agricultural vegetables. The multi-label vegetable classification model is used to label the characteristic data of vegetables to provide useful information for subsequent agricultural decision-making and analysis.
[0041] Further, in step S5, the vegetable growth universal detection comprises the following steps:
[0042] Step S51: construct a universal detection model for vegetable growth, taking the environment in which agricultural vegetables grow as the interaction environment between the agent and the environment, and taking the growth characteristics and growth conditions of agricultural vegetables as the state and observation data of the agent;
[0043] Step S52: define the actions of the agent, including adjusting the light and the irrigation amount, and design a reward function to guide the learning and optimization of the agent according to the growth target of the vegetables;
[0044] Step S53: Calculate the advantage function, reduce the variance in the gradient estimation, perform more accurate value function estimation, enable the policy gradient algorithm to accurately estimate the gradient direction, improve the efficiency and stability of reinforcement learning, and calculate the advantage function. The formula used is as follows:
[0045] A(s,a)=Q(s,a)-V(s);
[0046] Where A(s, a) is the advantage function of taking action a in state s, Q(s, a) is the action value function after taking action a, and V(s) is the value function of state s;
[0047] Step S54: The policy gradient algorithm eliminates the bias term in the policy gradient estimation by subtracting the state value function V(s), reduces the variance to a minimum, enables the advantage function to estimate the gradient direction more accurately, optimizes the decision-making strategy in the process of agricultural vegetable growth, and calculates the policy gradient. The formula used is as follows:
[0048] ;
[0049] In the formula, s is the state, a is the action, θ is the policy parameter, is the gradient of the loss function J with respect to the policy parameters, E is the expectation, is the gradient of the policy function with respect to the policy parameters;
[0050] Step S55: Practical application of the universal detection model for vegetable growth. In an interactive environment, the intelligent agent obtains actual data on vegetable growth, learns to improve decision-making strategies, and makes adjustments and optimizations based on actual data.
[0051] The artificial intelligence-based agricultural vegetable growth detection system provided by the present invention includes an environmental parameter acquisition module, a vegetable feature extraction module, a pest and disease detection module, a multi-label classification and annotation module, and a vegetable growth general detection module;
[0052] The environmental parameter acquisition module specifically deploys wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time;
[0053] The vegetable feature extraction module specifically uses a hyperspectral imager to obtain hyperspectral data of agricultural vegetables and performs preprocessing to extract feature data of the vegetables;
[0054] The pest detection module specifically adopts the YOLOv5-VE model with a lightweight network structure as the pest detection model, and uses an adaptive knowledge extraction method to optimize the model to improve the generalization ability of the pest detection model;
[0055] The multi-label classification and annotation module specifically constructs a multi-label vegetable classification model, which is trained in a general field, then migrated to a single-label vegetable dataset in the target field after upsampling equalization for fine-tuning, and finally migrated to a multi-label vegetable dataset to achieve multi-label classification and annotation;
[0056] The vegetable growth universal detection module specifically constructs a universal growth detection model to continuously interact with the environment, uses a policy gradient algorithm, introduces an advantage function to reduce the variance of gradient estimation, optimizes and improves decision-making strategies, and maximizes the growth effect and yield of vegetables.
[0057] The beneficial results achieved by the present invention using the above scheme are as follows:
[0058] (1) In view of the complex outdoor planting environment, the collection of environmental parameters during the vegetable growth process is subject to many restrictions, which affects the technical problem of analyzing and predicting the vegetable growth process. Wireless sensors based on narrowband Internet of Things are used to obtain environmental parameters in real time;
[0059] (2) In order to solve the technical problems that the vegetable pest and disease detection model has weak generalization ability and high small target missed detection rate, which leads to the failure to meet the requirements of real-time detection and early warning of pests and diseases, the YOLOv5-VE model with a lightweight network structure is used as the pest and disease detection model, and the adaptive knowledge extraction method is used to optimize the model, improve the generalization ability of the pest and disease detection model, and reduce the missed detection of small targets;
[0060] (3) To address the technical problem that large-scale vegetable data cannot be accurately classified, resulting in the inability to accurately evaluate the multiple growth states of vegetables, which limits growers from optimizing the planting process, a multi-label vegetable classification model is used. After training in a general domain, it is migrated to the target domain single-label vegetable dataset after upsampling equalization for fine-tuning, and finally migrated to a multi-label vegetable dataset to achieve multi-label classification and annotation, recording the comprehensive growth states of agricultural vegetables.
[0061] (4) In view of the fact that the growth process of agricultural vegetables is affected by many factors and the environmental conditions vary, the generalization ability of the model in the new environment is limited, resulting in the inability to accurately detect the growth conditions of agricultural vegetables. A general growth detection model is adopted to continuously interact with the environment. The policy gradient algorithm is used to introduce the advantage function to reduce the variance of the gradient estimation, optimize and improve the decision-making strategy, and maximize the growth effect and yield of vegetables. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A schematic diagram of the process of the agricultural vegetable growth detection method based on artificial intelligence provided by the present invention;
[0063] Figure 2A schematic diagram of an agricultural vegetable growth detection system based on artificial intelligence provided by the present invention;
[0064] Figure 3 is a schematic flow chart of step S1;
[0065] Figure 4 is a schematic flow chart of step S3;
[0066] Figure 5 is a schematic flow chart of step S4;
[0067] Figure 6 It is a flowchart diagram of step S5.
[0068] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0070] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0071] Example 1, see Figure 1 The present invention provides an artificial intelligence-based agricultural vegetable growth detection method, which comprises the following steps:
[0072] Step S1: Environmental parameter collection, specifically deploying wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time;
[0073] Step S2: Extracting vegetable features, specifically using a hyperspectral imager to obtain hyperspectral data of agricultural vegetables and preprocessing them to extract feature data of the vegetables;
[0074] Step S3: Pest and disease detection, specifically using the YOLOv5-VE model with a lightweight network structure as the pest and disease detection model, and using an adaptive knowledge extraction method to optimize the model to improve the generalization ability of the pest and disease detection model;
[0075] Step S4: multi-label classification and annotation, specifically, building a multi-label vegetable classification model, after training in the general field, migrating to the target field single-label vegetable dataset after upsampling equalization for fine-tuning, and finally migrating to the multi-label vegetable dataset to achieve multi-label classification and annotation, and record the comprehensive growth status of agricultural vegetables;
[0076] Step S5: Universal detection of vegetable growth, specifically, building a universal detection model for vegetable growth to continuously interact with the environment, obtain actual data on vegetable growth, use the policy gradient algorithm, introduce the advantage function to reduce the variance of the gradient estimate, and adjust and optimize according to the actual data to maximize the growth effect and yield of vegetables.
[0077] Example 2, see Figure 1 and Figure 3 This embodiment is based on the above embodiment. In step S1, the environmental parameter collection includes the following steps:
[0078] Step S11: sensor selection and configuration, selecting appropriate sensors according to environmental monitoring requirements, including soil moisture sensors, soil temperature sensors, air humidity sensors, air temperature sensors and light intensity sensors, configuring the sensor's communication module and the frequency of collecting environmental parameters;
[0079] Step S12: deploying sensor nodes, deploying the sensor nodes according to the distribution of agricultural vegetables, ensuring that the sensors can cover key agricultural vegetable growing areas, and that the communication ranges between the nodes intersect with each other to form a stable sensor network;
[0080] Step S13: Data transmission and storage, connecting the sensor node to the narrowband Internet of Things communication network, the sensor node regularly collects environmental parameters, and transmits the environmental parameters to the cloud platform and terminal devices through the narrowband Internet of Things. The cloud platform provides storage, processing and analysis of environmental parameters, and the environmental parameters are received and viewed in real time through the terminal devices.
[0081] By performing the above operations, wireless sensors based on narrowband Internet of Things are used to obtain accurate environmental parameters in real time, which solves the technical problem that due to the complex outdoor planting environment, the collection of environmental parameters during the growth of vegetables is subject to many restrictions, thus affecting the analysis and prediction of the vegetable growth process.
[0082] Example 3, see Figure 1This embodiment is based on the above embodiment. In step S2, the vegetable feature extraction includes the following steps:
[0083] Step S21: data acquisition and processing, using a hyperspectral imager to obtain hyperspectral data of agricultural vegetables, and preprocessing the collected hyperspectral data, including spectral correction, noise removal and atmospheric correction;
[0084] Step S22: extracting hyperspectral features, extracting a large number of hyperspectral features, including absorption line intensity, spectral bandwidth and wavelength peak, reflecting the characteristic data of different types of vegetables, including color, morphology and tissue structure.
[0085] Example 4, see Figure 1 and Figure 4 This embodiment is based on the above embodiment. In step S3, the pest detection includes the following steps:
[0086] Step S31: Collect representative vegetable pest and disease samples as a pest and disease detection data set, and ensure that the pest and disease detection data set contains different types of pests and diseases and different types of vegetable species;
[0087] Step S32: training a pest detection model, using a YOLOv5-VE model with a lightweight network structure as the pest detection model, performing diversity expansion, and training on a pest detection dataset. During the training process, a variety of data enhancement techniques are used, including random scaling, random rotation, and random cropping, to increase the diversity of the pest detection dataset.
[0088] Step S33: Optimizing model parameters and loss functions, using an adaptive knowledge extraction method to introduce knowledge of a deep neural network model that has been trained on a large-scale training data set into the pest detection model, the adaptive knowledge extraction method comprising the following steps:
[0089] Step S331: Select a deep neural network model that has been trained on a large-scale training data set as a knowledge source, so that the pest detection model learns the knowledge of the deep neural network model that has been trained on the large-scale training data set;
[0090] Step S332: using the pest detection training data set to train the deep neural network model that has been trained on the large-scale training data set, obtaining the detection results of the pest detection training and performing softening processing, and then smoothing the detection results using the softmax function to obtain softened detection results;
[0091] Step S333: training a pest detection model using the pest detection training data set and the softened detection results;
[0092] Step S334: Define the output of the deep neural network model that has been trained on a large-scale training dataset as Z t , the output of the pest detection model is Z s , the temperature parameter is T, the total loss function of the adaptive knowledge extraction method includes the loss function of the detection result and the loss function of the knowledge extraction. The total loss function of the adaptive knowledge extraction method is calculated using the following formula:
[0093] ;
[0094] Where, L total is the total loss function of the adaptive knowledge extraction method, α is the weight coefficient of the loss function of the detection result, and L cls is the loss function of the detection result, β is the weight coefficient of the loss function of knowledge extraction, L distill is the loss function for knowledge extraction;
[0095] Step S335: The loss function of the detection result is calculated based on the cross entropy, so that the pest detection model can correctly classify the samples and learn the prediction distribution of the deep neural network model that has been trained on a large-scale training data set. The loss function of the detection result is calculated using the following formula:
[0096] ;
[0097] Where N is the number of samples in the pest detection training data set, is the predicted distribution of the pest and disease detection model for the i-th sample, is the predicted distribution of the i-th sample by the deep neural network model that has been trained on a large-scale training dataset, C is the number of categories for pest and disease detection classification, c represents the c-th category, and i represents the i-th sample;
[0098] Step S336: The loss function of knowledge extraction constrains the output distribution of the pest detection model to be close to the output distribution of the deep neural network model that has been trained on a large-scale training data set, and calculates the loss function of knowledge extraction. The formula used is as follows:
[0099] ;
[0100] Where T is the temperature parameter;
[0101] Step S337: Optimizing the total loss function of the adaptive knowledge extraction method and updating the parameters of the pest detection model;
[0102] Step S338: determine the termination condition, and set an evaluation threshold in advance. If the total loss function output is lower than the evaluation threshold, the pest detection model training is completed; otherwise, continue to train the model;
[0103] Step S34: Practically apply the pest and disease detection model, deploy the trained pest and disease detection model into the actual application environment, detect vegetable pests and diseases, and perform automated pest and disease detection and early warning.
[0104] By performing the above operations, the YOLOv5-VE model with a lightweight network structure is used as the pest and disease detection model, and the adaptive knowledge extraction method is used to optimize the model, thereby improving the generalization ability of the pest and disease detection model and reducing the missed detection of small targets. This solves the technical problems of weak generalization ability of the vegetable pest and disease detection model and high missed detection rate of small targets, which lead to the real-time detection and early warning of pests and diseases failing to meet the requirements.
[0105] Example 5, see Figure 1 and Figure 5 This embodiment is based on the above embodiment. In step S4, the multi-label classification annotation includes the following steps:
[0106] Step S41: general domain pre-training, specifically using a large-scale general data set for pre-training to train a general image classification model with excellent performance, learn basic image feature extraction capabilities, and provide a good initial state for target domain fine-tuning;
[0107] Step S42: fine-tuning the target domain, specifically, taking the general image classification model parameters as the initial state of the target domain, using the upsampling method on the single-label vegetable dataset in the target domain to balance the dataset distribution, and retraining the general image classification model by adjusting the learning rate, the number of training rounds, and the batch size of the vegetable labels;
[0108] Step S43: Migrate to the multi-label vegetable dataset, specifically, migrate the retrained general image classification model to the multi-label vegetable dataset, adjust the last layer of the model as needed for the multi-label vegetable dataset, add a multi-label classification layer to adapt to the characteristics of the label classification task, use the multi-label vegetable dataset for further training, and fine-tune the model parameters on the multi-label vegetable dataset so that the general image classification model has both the underlying features of the general field and the single-label sample features, so as to obtain a multi-label vegetable classification model, which is better adapted to the multi-label classification and annotation task;
[0109] Step S44: labeling. The characteristic data of vegetables include the types of vegetables and the corresponding colors, shapes, tissue structures and pest and disease characteristics of various agricultural vegetables. The multi-label vegetable classification model is used to label the characteristic data of vegetables to provide useful information for subsequent agricultural decision-making and analysis.
[0110] By performing the above operations, a multi-label vegetable classification model is adopted. After training in the general field, it is migrated to the single-label vegetable dataset in the target field after upsampling equalization for fine-tuning, and finally migrated to the multi-label vegetable dataset to achieve multi-label classification and annotation, and record the comprehensive growth status of agricultural vegetables. This solves the technical problem that large-scale vegetable data cannot be accurately classified, resulting in the inability to accurately evaluate multiple growth states of vegetables, which restricts growers from optimizing the planting process.
[0111] Example 6, see Figure 1 and Figure 6 This embodiment is based on the above embodiment. In step S5, the vegetable growth universal detection comprises the following steps:
[0112] Step S51: construct a universal detection model for vegetable growth, taking the environment in which agricultural vegetables grow as the interaction environment between the agent and the environment, and taking the growth characteristics and growth conditions of agricultural vegetables as the state and observation data of the agent;
[0113] Step S52: define the actions of the agent, including adjusting the light and the irrigation amount, and design a reward function to guide the learning and optimization of the agent according to the growth target of the vegetables;
[0114] Step S53: Calculate the advantage function, reduce the variance in the gradient estimation, perform more accurate value function estimation, enable the policy gradient algorithm to accurately estimate the gradient direction, and improve the efficiency and stability of reinforcement learning. The formula used is as follows:
[0115] A(s,a)=Q(s,a)-V(s);
[0116] Where A(s, a) is the advantage function of taking action a in state s, Q(s, a) is the action value function after taking action a, and V(s) is the value function of state s;
[0117] Step S54: The policy gradient algorithm eliminates the bias term in the policy gradient estimation by subtracting the state value function V(s), reduces the variance to a minimum, enables the advantage function to estimate the gradient direction more accurately, optimizes the decision-making strategy in the process of agricultural vegetable growth, and calculates the policy gradient. The formula used is as follows:
[0118] ;
[0119] In the formula, s is the state, a is the action, θ is the policy parameter, is the gradient of the loss function J with respect to the policy parameters, E is the expectation, is the gradient of the policy function with respect to the policy parameters;
[0120] Step S55: Practical application of the universal detection model for vegetable growth. In an interactive environment, the intelligent agent obtains actual data on vegetable growth, learns to improve decision-making strategies, and makes adjustments and optimizations based on actual data.
[0121] By performing the above operations, a general growth detection model is adopted to continuously interact with the environment, and the policy gradient algorithm is used to introduce the advantage function to reduce the variance of gradient estimation, optimize and improve the decision-making strategy, maximize the growth effect and yield of vegetables, and solve the technical problem that there are differences in the growth environment of agricultural vegetables. Under the new growth environment, the generalization ability of the model is limited, resulting in the inability to accurately detect the growth conditions of agricultural vegetables.
[0122] Embodiment 7, see Figure 2 , this embodiment is based on the above embodiment, and the artificial intelligence-based agricultural vegetable growth detection system provided by the present invention includes an environmental parameter acquisition module, a vegetable feature extraction module, a pest and disease detection module, a multi-label classification and annotation module, and a vegetable growth general detection module;
[0123] The environmental parameter acquisition module specifically deploys wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time;
[0124] The vegetable feature extraction module specifically uses a hyperspectral imager to obtain hyperspectral data of agricultural vegetables and performs preprocessing to extract feature data of the vegetables;
[0125] The pest detection module specifically adopts the YOLOv5-VE model with a lightweight network structure as the pest detection model, and uses an adaptive knowledge extraction method to optimize the model to improve the generalization ability of the pest detection model;
[0126] The multi-label classification and annotation module specifically constructs a multi-label vegetable classification model, which is trained in a general field, then migrated to a single-label vegetable dataset in the target field after upsampling equalization for fine-tuning, and finally migrated to a multi-label vegetable dataset to achieve multi-label classification and annotation;
[0127] The vegetable growth universal detection module specifically constructs a universal growth detection model to continuously interact with the environment, uses a policy gradient algorithm, introduces an advantage function to reduce the variance of gradient estimation, optimizes and improves decision-making strategies, and maximizes the growth effect and yield of vegetables.
[0128] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0129] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
[0130] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. An artificial intelligence-based agricultural vegetable growth detection method, characterized in that: The method comprises the following steps: Step S1: Environmental parameter collection, specifically using wireless sensors based on narrowband Internet of Things to obtain environmental parameters in real time; Step S2: extracting vegetable features, specifically using a hyperspectral imager to extract feature data of vegetables; Step S3: Pest and disease detection, specifically using the YOLOv5-VE model with a lightweight network structure as the pest and disease detection model, and using an adaptive knowledge extraction method to optimize the model; Step S4: multi-label classification and annotation, specifically, building a multi-label vegetable classification model, after training in the general domain, migrating to the single-label vegetable dataset of the target domain after upsampling equalization for fine-tuning, and finally migrating to the multi-label vegetable dataset for classification and annotation; Step S5: Universal detection of vegetable growth, specifically, building a universal detection model for vegetable growth to continuously interact with the environment, obtain actual data on vegetable growth, use the policy gradient algorithm, introduce the advantage function to reduce the variance of the gradient estimation, and adjust and optimize according to the actual data.
2. The agricultural vegetable growth detection method based on artificial intelligence according to claim 1 is characterized in that: In step S3, the pest detection includes the following steps: Step S31: Collect representative vegetable pest and disease samples as a pest and disease detection data set; Step S32: training a pest detection model, using a YOLOv5-VE model with a lightweight network structure as the pest detection model, and training on a pest detection dataset; Step S33: Optimizing model parameters and loss functions, using an adaptive knowledge extraction method to introduce knowledge of a deep neural network model that has been trained on a large-scale training data set into the pest detection model, the adaptive knowledge extraction method comprising the following steps: Step S331: Select a deep neural network model that has been trained on a large-scale training data set as a knowledge source, so that the pest detection model learns the knowledge of the deep neural network model that has been trained on the large-scale training data set; Step S332: using the pest detection training data set to train the deep neural network model that has been trained on the large-scale training data set, obtaining the detection results of the pest detection training and performing softening processing, and then smoothing the detection results using the softmax function to obtain softened detection results; Step S333: training a pest detection model using the pest detection training data set and the softened detection results; Step S334: Define the output of the deep neural network model that has been trained on a large-scale training dataset as Z t , the output of the pest detection model is Z s , the temperature parameter is T, the total loss function of the adaptive knowledge extraction method includes the loss function of the detection result and the loss function of the knowledge extraction. The total loss function of the adaptive knowledge extraction method is calculated using the following formula: ; Where, L total is the total loss function of the adaptive knowledge extraction method, α is the weight coefficient of the loss function of the detection result, L cls is the loss function of the detection result, β is the weight coefficient of the loss function of knowledge extraction, L distill is the loss function for knowledge extraction; Step S335: Calculate the loss function of the detection result. The formula used is as follows: ; Where N is the number of samples in the pest detection training data set, is the predicted distribution of the pest and disease detection model for the i-th sample, is the predicted distribution of the i-th sample by the deep neural network model that has been trained on a large-scale training dataset, C is the number of categories for pest and disease detection classification, c represents the c-th category, and i represents the i-th sample; Step S336: Calculate the loss function of knowledge extraction, the formula used is as follows: ; Where T is the temperature parameter; Step S337: Optimizing the total loss function and updating the parameters of the pest detection model; Step S338: determine the termination condition, and set an evaluation threshold in advance. If the total loss function output is lower than the evaluation threshold, the pest detection model training is completed; otherwise, continue to train the model; Step S34: Practically apply the pest and disease detection model, deploy the trained pest and disease detection model into the actual application environment, detect vegetable pests and diseases, and perform automated pest and disease detection and early warning.
3. The agricultural vegetable growth detection method based on artificial intelligence according to claim 1 is characterized in that: In step S4, the multi-label classification annotation includes the following steps: Step S41: general domain pre-training, specifically using a large-scale general data set for pre-training to train a general image classification model with excellent performance; Step S42: fine-tuning the target domain, specifically, taking the general image classification model parameters as the initial state of the target domain, using the upsampling method on the single-label vegetable dataset in the target domain to balance the dataset distribution, and retraining the general image classification model by adjusting the learning rate, the number of training rounds, and the batch size of the vegetable labels; Step S43: Migrating to a multi-label vegetable dataset, specifically migrating the retrained general image classification model to the multi-label vegetable dataset, so that the general image classification model has both the underlying features of the general field and the single-label sample features, and obtaining a multi-label vegetable classification model; Step S44: labeling, applying a multi-label vegetable classification model to label the characteristic data of the vegetables.
4. The agricultural vegetable growth detection method based on artificial intelligence according to claim 1 is characterized in that: In step S5, the vegetable growth universal detection comprises the following steps: Step S51: constructing a universal detection model for vegetable growth; Step S52: define the actions of the agent, and design a reward function to guide the learning and optimization of the agent according to the growth target of the vegetables; Step S53: Calculate the advantage function using the following formula: A(s,a)=Q(s,a)-V(s); Where A(s, a) is the advantage function of taking action a in state s, Q(s, a) is the action value function after taking action a, and V(s) is the value function of state s; Step S54: The policy gradient algorithm eliminates the bias term in the policy gradient estimation by subtracting the state value function V(s), reduces the variance to a minimum, enables the advantage function to estimate the gradient direction more accurately, and calculates the policy gradient. The formula used is as follows: ; In the formula, s is the state, a is the action, θ is the policy parameter, is the gradient of the loss function J with respect to the policy parameters, E is the expectation, is the gradient of the policy function with respect to the policy parameters; Step S55: Practical application of the universal detection model for vegetable growth. In an interactive environment, the intelligent agent obtains actual data on vegetable growth, learns to improve decision-making strategies, and makes adjustments and optimizations based on actual data.
5. The agricultural vegetable growth detection method based on artificial intelligence according to claim 1 is characterized in that: In step S1, the environmental parameters are collected by deploying wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time.
6. The agricultural vegetable growth detection method based on artificial intelligence according to claim 1 is characterized in that: In step S2, the vegetable feature extraction specifically involves obtaining hyperspectral data of agricultural vegetables using a hyperspectral imager and performing preprocessing to extract the feature data of the vegetables.
7. An artificial intelligence-based agricultural vegetable growth detection system, used to implement the artificial intelligence-based agricultural vegetable growth detection method as described in any one of claims 1 to 6, characterized in that: It includes an environmental parameter collection module, a vegetable feature extraction module, a pest and disease detection module, a multi-label classification and annotation module, and a general vegetable growth detection module.
8. The artificial intelligence-based agricultural vegetable growth detection system according to claim 7, characterized in that: The environmental parameter acquisition module specifically deploys wireless sensors based on narrowband Internet of Things in agricultural vegetable planting areas to obtain environmental parameters in real time; The vegetable feature extraction module specifically uses a hyperspectral imager to obtain hyperspectral data of agricultural vegetables and performs preprocessing to extract feature data of the vegetables; The pest detection module specifically adopts a YOLOv5-VE model with a lightweight network structure as a pest detection model, and uses an adaptive knowledge extraction method to optimize the model; The multi-label classification and annotation module specifically constructs a multi-label vegetable classification model, which is trained in a general field, then migrated to a single-label vegetable dataset in the target field after upsampling equalization for fine-tuning, and finally migrated to a multi-label vegetable dataset for multi-label classification and annotation; The vegetable growth universal detection module specifically constructs a universal growth detection model to continuously interact with the environment, uses a policy gradient algorithm, introduces an advantage function to reduce the variance of gradient estimation, and optimizes and improves the decision-making strategy.
