Crop growth monitoring method and system in cloud planting cabin based on big data technology
By integrating high-resolution cameras and environmental sensors in the cloud planting cabin, combining convolutional neural networks and Markov decision-making processes, real-time monitoring and adaptive management of crop growth status are achieved, and incomplete data in the existing technology are solved. The problem of in-depth analysis has improved crop yield and quality and optimized agricultural production.
Patent Information
- Application Number
- CN202411170950.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The existing technology has problems in the monitoring of crop growth monitoring and in-depth data analysis, making it difficult to achieve comprehensive perception and intelligent analysis of crop growth processes, affecting the stability of crop yield and quality.
Using a cloud planting cabin system based on big data technology, crop image data is collected through high-resolution cameras, combined with environmental parameter sensors, and using convolutional neural networks and Markov decision-making processes to identify crop growth status and adjust environmental parameters to achieve real-time monitoring and adaptive management.
Comprehensive real-time monitoring and intelligent management of crop growth status have been achieved, crop yield and quality have been improved, growth abnormal risks have been reduced, energy consumption has been optimized, and agricultural production efficiency and sustainability have been improved.
Smart Images

Figure CN118689119B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to crop growth monitoring technology, and in particular to a crop growth monitoring method and system for a cloud planting cabin based on big data technology. Background Art
[0002] In recent years, with the continuous development of modern agricultural technology, intelligent and precise crop planting methods have received more and more attention. Traditional crop planting methods are easily affected by external environmental factors, resulting in unstable crop yield and quality, and also lack of real-time monitoring and scientific management of the crop growth process.
[0003] In order to solve the above problems, some researchers and companies have begun to explore the application of technologies such as the Internet of Things and big data in the field of crop planting. Among them, agricultural environmental monitoring systems based on the Internet of Things technology have made certain progress. By deploying various sensors in the planting environment, it can collect environmental parameter data such as temperature, humidity, and light in real time, and transmit the data to the cloud for storage and analysis through wireless communication technology. However, these systems mainly focus on the monitoring of environmental parameters, and direct monitoring of crop growth status is still lacking.
[0004] On the other hand, crop growth monitoring methods based on computer vision technology have also attracted the attention of researchers. By installing cameras in the planting environment, crop growth images can be captured in real time, and image processing algorithms can be used to analyze the crop growth status. However, such methods usually require a large amount of manually labeled data and are limited to a single perspective, making it difficult to fully reflect the overall situation of crop growth.
[0005] In addition, with the rise of big data technology, some researchers have begun to explore ways to combine big data analysis with crop planting. By collecting and analyzing a large amount of crop growth data, crop growth patterns can be discovered, providing a basis for optimizing planting plans. However, research in this area is still in its infancy and lacks a mature data collection and analysis platform.
[0006] In general, although existing technologies have made some progress in agricultural environmental monitoring and crop growth monitoring, there are still problems such as incomplete monitoring data and insufficient data analysis. How to make full use of technologies such as the Internet of Things, computer vision, and big data to build a cloud planting cabin crop growth monitoring system that integrates data collection, transmission, storage, and analysis, and achieve comprehensive perception and intelligent analysis of the crop growth process, thereby guiding scientific planting and improving crop yield and quality is an urgent problem to be solved.
[0007] The invention patent aims to solve the above technical problems and proposes a crop growth monitoring method and system for cloud planting cabins based on big data technology. The system makes full use of the closedness and controllability of the cloud planting cabin, collects data in all directions during the crop growth process, and uses big data analysis technology to explore the growth laws of crops, realize comprehensive real-time monitoring and intelligent management of crop growth status, and provide new technical support for the development of modern agriculture. Summary of the invention
[0008] The embodiments of the present invention provide a crop growth monitoring method and system for a cloud planting cabin based on big data technology, which can solve the problems in the prior art.
[0009] According to a first aspect of the embodiments of the present invention,
[0010] A crop growth monitoring method for a cloud planting cabin based on big data technology is provided, comprising:
[0011] The original image data of crops during their growth process in the cloud planting cabin is collected by a high-resolution camera, including the overall image of the crop and images of its parts. The collected original image data is preprocessed to obtain a standard image data set, which is then input into a pre-trained crop growth status recognition model to obtain crop growth status recognition results.
[0012] The environmental parameter sensors are used to collect the crop growth environment parameters, and the obtained crop growth status recognition results and crop growth environment parameters are monitored in real time. When abnormal crop growth is detected, the adaptive crop growth environment parameter adjustment mechanism is triggered;
[0013] According to the adaptive environmental parameter adjustment mechanism, the crop growth environmental parameter control problem is modeled as a Markov decision process, in which the state space includes the crop growth state and environmental parameters, the action space includes the control actions that describe the environmental parameters, and the reward function includes the crop growth performance and energy consumption. The strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy.
[0014] In an optional embodiment,
[0015] The standard image dataset is input into the pre-trained crop growth status recognition model, and the crop growth status recognition results obtained include:
[0016] Constructing a convolutional neural network model, the convolutional neural network model includes a feature extraction layer, a feature fusion layer and a classification output layer, wherein the feature extraction layer includes a plurality of depth-separable convolution modules, compresses the features extracted by the plurality of depth-separable convolution modules, and outputs a multi-scale feature map; the feature fusion layer performs feature fusion on the output multi-scale feature map, and the classification output layer inputs the fused multi-scale feature map into a fully connected neural network, and generates a probability distribution of crop growth status using an activation function;
[0017] The convolutional neural network model is trained using a standard image dataset, a feature difference loss is introduced to construct a loss function, and a stochastic gradient descent algorithm is used to optimize the model parameters, and the iteration is repeated until a preset termination condition is met to obtain a finally trained crop growth state recognition model;
[0018] The standard image data set is input into the trained crop growth state recognition model, and the probability value of the crop growth state is generated as the output, and the result with the largest probability value of the crop growth state is taken as the crop growth state recognition result.
[0019] In an optional embodiment,
[0020] The calculation formula for constructing the loss function by introducing feature difference loss is as follows:
[0021] ;
[0022] Among them, L represents the loss function, N represents the number of image samples, C represents the number of categories, and y ij Indicates the true label of image sample i belonging to category j, N j Represents the number of image samples of category j, y kj Indicates that image sample k belongs to the true label of category j, f i represents the feature vector of image sample i, f k represents the feature vector of image sample k, c j Represents the central feature vector of category j.
[0023] In an optional embodiment,
[0024] The environmental parameter sensors are used to collect the crop growth environment parameters, and the obtained crop growth state recognition results and crop growth environment parameters are monitored in real time. When abnormal crop growth is detected, the adaptive crop growth environment parameter adjustment mechanism is triggered, including:
[0025] Preprocessing the crop growth state recognition results and the crop growth environment parameters to obtain growth state characteristics and growth environment parameter characteristics, and performing feature fusion on the growth state characteristics and growth environment parameter characteristics to obtain comprehensive growth characteristics;
[0026] The obtained comprehensive growth features are divided into a training set and a test set. A tree-based anomaly detection algorithm is used on the training set to construct multiple isolated trees. For each data point, the average path length in all isolated trees is calculated as the first anomaly score. According to the first anomaly score, a first threshold is set, and the data points whose first anomaly score is lower than the first threshold are marked as first potential anomalies.
[0027] At the same time, the pre-trained autoencoder model is used on the training set to calculate the reconstruction error of each data point as the second anomaly score, and a second threshold is set according to the second anomaly score, and the data points with a second anomaly score higher than the second threshold are marked as second potential anomalies;
[0028] Calculate the reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees respectively, and take the weighted average of the obtained results as the joint anomaly score;
[0029] The obtained joint anomaly score is compared with the first threshold and the second threshold respectively, and whether the current data point is abnormal is determined according to the comparison result. If it is determined to be abnormal, the adaptive environmental parameter adjustment mechanism is triggered.
[0030] In an optional embodiment,
[0031] The reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees are calculated respectively, and the obtained results are weighted averaged to obtain the calculation formula of the joint anomaly score as follows:
[0032] ;
[0033] Where c(x) represents the joint anomaly score, x represents the data point, α represents the weight coefficient of the anomaly score, r(x) represents the second anomaly score of the data point x, and A2 represents the set of the second potential anomaly points. represents the minimum anomaly score in the second set of potential anomaly points, represents the maximum anomaly score in the second potential anomaly point set, s(x) represents the first anomaly score of data point x, A1 represents the set of first potential anomaly points, represents the minimum anomaly score in the first potential anomaly point set, Represents the maximum anomaly score in the first set of potential anomalies.
[0034] In an optional embodiment,
[0035] The Markov decision process is solved by using a strategy optimization algorithm to obtain an optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy, including:
[0036] Construct the action network and state network in the strategy optimization algorithm, where the action network takes the current crop growth environment parameters as input and outputs the corresponding environment parameter control action, and the state network takes the growth environment parameters and the corresponding environment parameter control action as input and outputs the corresponding long-term cumulative reward estimate;
[0037] Calculating the temporal difference error between the state network and the target state network, using the temporal difference error as the state network loss function, and updating the state network by minimizing the state network loss function;
[0038] Calculate the gradient value of the long-term cumulative reward estimate with respect to the environmental parameter control action, construct the action network loss function based on the obtained gradient value, and update the action network by maximizing the action network loss function;
[0039] The updated state network parameters and the updated action network parameters are copied to the target network, and the iteration is repeated until the preset termination conditions are met. Finally, the optimal environmental parameter control strategy is output, and the crop growth environment parameters are adjusted according to the optimal environmental parameter control strategy.
[0040] In an optional embodiment,
[0041] The calculation formula of the state network loss function is as follows:
[0042] ;
[0043] in, L 1 represents the state network loss function, M represents the number of samples, m represents the sample index, R represents the immediate reward, γ represents the discount factor, (·) represents the long-term cumulative reward value of the target state network parameter estimation, represents the state network parameters, v ' Indicates the updated crop growth environment status, μ θ' represents the target action network, θ' represents the target action network parameters, (·) represents the long-term cumulative reward value of the current state network parameter estimation, v represents the current crop growth environment parameters, and a represents the environmental parameter control action taken according to the current crop growth environment parameters;
[0044] The calculation formula of the action network loss function is as follows:
[0045] ;
[0046] in, L 2 represents the action network loss function, v mrepresents the crop growth environment parameters of the mth sample, μ θ Represents an action network.
[0047] According to a second aspect of the embodiments of the present invention,
[0048] A crop growth monitoring system for a cloud planting cabin based on big data technology is provided, including:
[0049] The first unit is used to collect original image data of crops during their growth in the cloud planting cabin through a high-resolution camera, including images of the entire crop and parts of the crop, and preprocess the collected original image data to obtain a standard image data set, and input the standard image data set into a pre-trained crop growth state recognition model to obtain a crop growth state recognition result;
[0050] The second unit is used to collect crop growth environment parameters using environmental parameter sensors, and to monitor the obtained crop growth state recognition results and crop growth environment parameters in real time. When abnormal crop growth is detected, an adaptive crop growth environment parameter adjustment mechanism is triggered;
[0051] The third unit is used to model the crop growth environmental parameter control problem as a Markov decision process according to the adaptive environmental parameter adjustment mechanism, wherein the state space includes the crop growth state and environmental parameters, the action space includes the control actions describing the environmental parameters, and the reward function includes the crop growth performance and energy consumption. The strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy.
[0052] According to a third aspect of the embodiments of the present invention,
[0053] An electronic device is provided, comprising:
[0054] processor;
[0055] a memory for storing processor-executable instructions;
[0056] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0057] A fourth aspect of the embodiments of the present invention is:
[0058] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0059] In this embodiment, crop images are collected by a high-resolution camera, and a pre-trained crop growth state recognition model is used to obtain the growth state of the crop in real time and detect abnormal crop growth in time. When abnormal crop growth is detected, the system automatically triggers the crop growth environment parameter adjustment mechanism. By using Markov decision process modeling and reinforcement learning algorithm, the optimal environmental parameter control strategy can be found, and environmental factors such as temperature, humidity, and light can be adjusted in time to provide a suitable growth environment for crops. Through real-time monitoring and adaptive adjustment, the best growth conditions can be provided for crops, and the risk of abnormal growth can be reduced, thereby improving the yield and quality of crops. In the Markov decision process, energy consumption is included in the reward function. By weighing the crop growth performance and energy consumption, unnecessary energy consumption can be reduced while ensuring crop growth, realizing the intelligent management of the crop growth environment, improving crop yield and quality, reducing production costs, and improving production efficiency. Intelligent optimization of production links is achieved through big data and artificial intelligence technology, which is of great significance to improving agricultural production efficiency, quality and sustainability, and is an important supporting technology for agricultural modernization and intelligence. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a flow chart of a crop growth monitoring method of a cloud planting cabin based on big data technology according to an embodiment of the present invention;
[0061] Figure 2 It is a structural schematic diagram of a crop growth monitoring system of a cloud planting cabin based on big data technology according to an embodiment of the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0064] Figure 1 FIG. 1 is a flow chart of a crop growth monitoring method in a cloud planting cabin based on big data technology according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0065] S101. Collect original image data of crops during their growth process in the cloud planting cabin through a high-resolution camera, including images of the entire crop and images of its parts, and pre-process the collected original image data to obtain a standard image data set. The standard image data set is input into a pre-trained crop growth status recognition model to obtain a crop growth status recognition result.
[0066] Exemplarily, a high-resolution camera is used to collect image data during the growth of crops. The collected images include overall crop images and part images (leaves, stems, fruits, etc.). In order to obtain high-quality image data, it is necessary to control the camera parameter settings, such as resolution, exposure, focal length, etc. At the same time, in order to cover all stages of crop growth and different growth conditions, multiple collections are required at different times and in different environments. Preprocessing the collected raw image data includes uniformly adjusting images of different sizes to a fixed size (such as 224x224), performing data enhancement through operations such as image rotation, flipping, and cropping, and scaling pixel values to the range of [0, 1] or [-1, 1] to accelerate model convergence.
[0067] In an optional embodiment,
[0068] The standard image dataset is input into the pre-trained crop growth status recognition model, and the crop growth status recognition results obtained include:
[0069] Constructing a convolutional neural network model, the convolutional neural network model includes a feature extraction layer, a feature fusion layer and a classification output layer, wherein the feature extraction layer includes a plurality of depth-separable convolution modules, compresses the features extracted by the plurality of depth-separable convolution modules, and outputs a multi-scale feature map; the feature fusion layer performs feature fusion on the output multi-scale feature map, and the classification output layer inputs the fused multi-scale feature map into a fully connected neural network, and generates a probability distribution of crop growth status using an activation function;
[0070] The convolutional neural network model is trained using a standard image dataset, a feature difference loss is introduced to construct a loss function, and a stochastic gradient descent algorithm is used to optimize the model parameters, and the iteration is repeated until a preset termination condition is met to obtain a finally trained crop growth state recognition model;
[0071] The standard image data set is input into the trained crop growth state recognition model, and the probability value of the crop growth state is generated as the output, and the result with the largest probability value of the crop growth state is taken as the crop growth state recognition result.
[0072] Exemplarily, a lightweight convolutional neural network model is constructed, which includes a feature extraction layer, a feature fusion layer, and a classification output layer. The feature extraction layer contains multiple depth-wise separable convolution modules, each of which consists of a 3×3 depth-wise convolution and a 1×1 point-wise convolution, which can achieve feature extraction with low computational complexity. After the 4th, 7th, and 11th depth-wise separable convolution modules, a maximum pooling layer is connected for downsampling and feature compression. The output of the feature extraction layer is a multi-scale feature map, which contains shallow local features and deep global features.
[0073] The feature fusion layer is used to fuse multi-scale features and generate a unified feature representation. By adopting the spatial attention mechanism, the importance weights of different regions in the feature map are learned to adaptively enhance the features of the salient regions. The spatial attention module consists of a global average pooling layer and two fully connected layers, which can generate the corresponding spatial attention weight matrix according to the feature map. The spatial attention weight matrix is multiplied by the original feature map to obtain the spatially enhanced feature map.
[0074] The classification output layer inputs the fused features into the fully connected neural network and generates the probability distribution of crop growth status through the Softmax function. Optionally, the crop growth status can be divided into 5 categories: seedling stage, vegetative growth stage, flowering stage, fruit development stage and maturity stage. Therefore, the number of neurons in the classification output layer is set to 5.
[0075] The convolutional neural network model is trained using a standard image dataset. Appropriate hyperparameters need to be set during the training process, such as batch size, learning rate, regularization coefficient, etc. In order to encourage the model to learn more discriminative feature representations, feature difference loss is introduced in the loss function. Feature difference loss encourages the model to learn feature representations that are compact within a class and separated between classes. The Adam algorithm is used for gradient descent optimization. At the same time, in order to prevent overfitting, the Early Stopping strategy is used to stop training when the performance on the validation set no longer improves. During the training process, the loss function, accuracy and other indicators of the model are monitored in real time through tools such as TensorBoard to adjust hyperparameters and optimize the model. Repeat the iteration until the preset termination condition is met to obtain the final trained crop growth status recognition model;
[0076] The trained crop growth status recognition model is deployed in the actual crop production environment to analyze the collected crop images in real time. For growth status recognition, the current growth stage of the crop is determined based on the category probability output by the model, and management measures such as irrigation, fertilization, and pruning are adjusted in a timely manner based on the characteristics of the growth stage.
[0077] In an optional embodiment,
[0078] The calculation formula for constructing the loss function by introducing feature difference loss is as follows:
[0079] ;
[0080] Among them, L represents the loss function, N represents the number of image samples, C represents the number of categories, and y ij Indicates the true label of image sample i belonging to category j, N j Represents the number of image samples of category j, y kj Indicates that image sample k belongs to the true label of category j, f i represents the feature vector of image sample i, f k represents the feature vector of image sample k, c j Represents the central feature vector of category j.
[0081] In this embodiment, the feature representation of the image can be automatically learned through the convolutional neural network, and the key features that affect the growth status of the crop can be well captured through multi-level feature extraction and fusion, thereby improving the recognition accuracy. In particular, the introduction of the deep separable convolution module and multi-scale feature fusion can effectively capture the feature information of different scales. By introducing the feature difference loss function during the training process, the difference between the features of different categories can be maximized, thereby enhancing the model's ability to distinguish small differences. This helps to improve the generalization performance of the model on new and unseen data. The use of optimization algorithms such as stochastic gradient descent can speed up the convergence of model parameters and reduce training time. At the same time, the setting of the termination condition also helps to stop training when a certain accuracy is reached to avoid overfitting. From the original image input to the crop state output is an end-to-end process, without the need for manual feature extraction, reducing human intervention and improving the automation of the system. By comprehensively using a variety of machine learning techniques, while ensuring the accuracy of crop state recognition, it also has good generalization ability, training efficiency and interpretability, and is an advanced smart agriculture solution.
[0082] S102. Collect crop growth environment parameters using environmental parameter sensors, monitor the obtained crop growth status recognition results and crop growth environment parameters in real time, and trigger an adaptive crop growth environment parameter adjustment mechanism when abnormal crop growth is detected.
[0083] Use various environmental parameter sensors, such as temperature and humidity sensors, light sensors, soil moisture sensors, carbon dioxide sensors, etc., to collect key parameter data in the crop growth environment in real time, such as temperature, humidity, light intensity, carbon dioxide concentration, etc. Input the collected crop images into the pre-trained crop growth state recognition model, output the probability distribution of the crop growth state, and select the state with the highest probability as the recognition result, such as normal growth, malnutrition, pests and diseases, etc. Monitor and analyze the crop growth state recognition results and environmental parameter data in real time, and judge whether the crop has growth abnormalities based on the preset normal growth range. Abnormalities may come from unfavorable environmental conditions or from the crop's own state.
[0084] In an optional embodiment,
[0085] The environmental parameter sensors are used to collect the crop growth environment parameters, and the obtained crop growth state recognition results and crop growth environment parameters are monitored in real time. When abnormal crop growth is detected, the adaptive crop growth environment parameter adjustment mechanism is triggered, including:
[0086] Preprocessing the crop growth state recognition results and the crop growth environment parameters to obtain growth state characteristics and growth environment parameter characteristics, and performing feature fusion on the growth state characteristics and growth environment parameter characteristics to obtain comprehensive growth characteristics;
[0087] The obtained comprehensive growth features are divided into a training set and a test set. A tree-based anomaly detection algorithm is used on the training set to construct multiple isolated trees. For each data point, the average path length in all isolated trees is calculated as the first anomaly score. According to the first anomaly score, a first threshold is set, and the data points whose first anomaly score is lower than the first threshold are marked as first potential anomalies.
[0088] At the same time, the pre-trained autoencoder model is used on the training set to calculate the reconstruction error of each data point as the second anomaly score, and a second threshold is set according to the second anomaly score, and the data points with a second anomaly score higher than the second threshold are marked as second potential anomalies;
[0089] Calculate the reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees respectively, and take the weighted average of the obtained results as the joint anomaly score;
[0090] The obtained joint anomaly score is compared with the first threshold and the second threshold respectively, and whether the current data point is abnormal is determined according to the comparison result. If it is determined to be abnormal, the adaptive environmental parameter adjustment mechanism is triggered.
[0091] Exemplarily, the crop growth state recognition results and crop growth environment parameters are preprocessed including data cleaning, data alignment, data normalization, and data enhancement operations to obtain growth state features and growth environment parameter features, and feature fusion is performed on the growth state features and growth environment parameter features. Specifically, a multimodal deep neural network is designed, such as a convolutional neural network, to extract local features through convolution and pooling operations to gradually form a high-level semantic representation, or an attention mechanism is used to adaptively allocate weights by calculating the correlation between data points to highlight key information.
[0092] Optionally, when designing a multimodal network, independent sub-networks can be designed for different modal data, such as using a convolutional neural network to process images and a long short-term memory network to process the time series data of environmental parameters. Then, the features extracted by each sub-network are fused to obtain a comprehensive growth feature. The fusion method can be simple splicing, weighted summation, or self-attention mechanism.
[0093] After obtaining the comprehensive growth features, they need to be divided into training sets and test sets. The training set is used to train the isolation forest and autoencoder models, and the test set is used to evaluate the anomaly detection performance. The data division ratio can be adjusted according to the amount of data and the anomaly ratio. Generally, the training set accounts for 70%-80% and the test set accounts for 20%-30%. In order to ensure the distribution consistency of the training set and the test set, stratified sampling can be used to divide them according to the proportion of abnormal labels.
[0094] Select the Isolation Forest algorithm to construct multiple isolated trees by recursively and randomly selecting features and split points. For each data point, its average path length in the isolated tree reflects its degree of abnormality, and the average path length of the abnormal point is shorter. When training the Isolation Forest model, you need to set the following hyperparameters: the number of trees. The more trees there are, the more stable the performance of the model, but the higher the computational complexity. The general value range is 100-1000. Subsampling ratio, the proportion of the data subset used by each tree. A smaller subsampling ratio can improve the generalization ability of the model, but it may also reduce the recall rate of anomaly detection. The general value range is 0.2-0.8. Maximum tree depth, limit the maximum depth of each tree to prevent overfitting. The default value is the logarithm of the data set size. Use the training set data to train the Isolation Forest model according to the set hyperparameters. For each tree, the following steps are performed recursively. Specifically, a feature is randomly selected, and within the range of values of the feature, a split point is randomly selected. The data is divided into left and right child nodes according to the split point. The left and right child node splitting steps are repeated recursively for the left and right child nodes until the maximum tree depth is reached or the node contains only one data point. For each data point, the average path length in all isolated trees is calculated as the first anomaly score. The smaller the first anomaly score, the more likely the data point is an anomaly.
[0095] According to the first anomaly score, a first anomaly threshold is set, and data points with scores below the threshold are marked as potential anomalies. The first anomaly threshold can be estimated according to the anomaly ratio, for example, set to the 5th percentile of the anomaly score.
[0096] An autoencoder is an unsupervised learning algorithm that maps input data to a low-dimensional latent space through an encoder, and then reconstructs the latent space representation into the original data through a decoder. The goal of an autoencoder is to minimize the reconstruction error and make the reconstructed data as similar as possible to the original data. Due to their particularity, outliers are usually difficult to accurately reconstruct, so the reconstruction error is large.
[0097] First, the network structure of the autoencoder is designed, including the number of layers of the encoder and decoder, the number of nodes in each layer, and the activation function. The autoencoder model is trained using the training set data according to the designed network structure. The goal of the training is to minimize the reconstruction error. Commonly used loss functions include mean square error (MSE) and cross-entropy error. During the training process, the model parameters are updated through the back-propagation algorithm to make the reconstructed data as similar as possible to the original data.
[0098] On the training set, the trained autoencoder model is used to calculate the reconstruction error of each data point as the second anomaly score. The larger the reconstruction error, the more likely the data point is an anomaly. According to the second anomaly score, a second anomaly threshold is set, and data points with scores higher than the threshold are marked as potential anomalies. The second anomaly threshold can be estimated based on the anomaly ratio, for example, it can be set to the 95th percentile of the anomaly score.
[0099] For potential anomalies marked by the isolation forest, the autoencoder reconstruction error is calculated; for potential anomalies marked by the autoencoder, the average path length in the isolation forest is calculated. The two anomaly scores are normalized and then the weighted average is calculated as the joint anomaly score. The weights can be adjusted based on the performance of the two methods.
[0100] Considering the anomaly scores of the isolation forest and the autoencoder, a joint anomaly threshold is set. Methods such as grid search or cross-validation can be used to optimize the joint anomaly threshold on the validation set to optimize the overall performance of anomaly detection. Data points that meet both the isolation forest anomaly threshold and the autoencoder anomaly threshold are confirmed as the final anomaly points. This double confirmation mechanism can reduce false positives and improve the accuracy of anomaly detection.
[0101] Optionally, the isolation forest, autoencoder and joint anomaly threshold are optimized on the validation set by grid search or cross validation. Specifically, the search range and step size of the joint anomaly threshold are set, and for each set of threshold combinations, the anomaly detection performance index is calculated on the validation set, and the threshold combination with the best comprehensive performance is selected as the final anomaly threshold.
[0102] For the newly collected multimodal data, real-time data cleaning, alignment, normalization and other preprocessing operations are performed, and their comprehensive representation is extracted. The trained isolation forest model and autoencoder model are used to calculate the anomaly score of the new data point. For the isolation forest, the average path length of the data point is calculated; for the autoencoder, the reconstruction error of the data point is calculated. The anomaly score of the new data point is compared with the optimized anomaly threshold to determine whether it is abnormal. If the anomaly score of the data point meets the anomaly threshold of both the isolation forest and the autoencoder, it is judged to be abnormal. If an anomaly is detected, the adaptive environmental parameter adjustment mechanism is triggered. According to the type and degree of anomaly, appropriate control measures are taken, such as adjusting temperature and humidity, replenishing water, increasing light, etc., to restore the crop growth state to normal.
[0103] In an optional embodiment,
[0104] The reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees are calculated respectively, and the obtained results are weighted averaged to obtain the calculation formula of the joint anomaly score as follows:
[0105] ;
[0106] Where c(x) represents the joint anomaly score, x represents the data point, α represents the weight coefficient of the anomaly score, r(x) represents the second anomaly score of the data point x, and A2 represents the set of the second potential anomaly points. represents the minimum anomaly score in the second set of potential anomaly points, represents the maximum anomaly score in the second potential anomaly point set, s(x) represents the first anomaly score of data point x, A1 represents the set of first potential anomaly points, represents the minimum anomaly score in the first potential anomaly point set, Represents the maximum anomaly score in the first set of potential anomalies.
[0107] In this embodiment, by combining anomaly detection based on isolation trees and anomaly detection based on autoencoder reconstruction errors, the advantages of these two anomaly detection methods are fully utilized. Isolation trees are good at finding local outliers, while autoencoders are good at finding abnormal samples that do not match the overall distribution of the data. The two methods complement each other and can detect various types of anomalies more accurately. By integrating multiple anomaly scoring mechanisms, the defects of a single scoring method can be compensated by other scoring mechanisms, thereby improving the robustness of anomaly detection. Even if a certain score fails, other scores can still ensure the basic operation of the system. By real-time monitoring of crop status and environmental parameters, once an anomaly is detected, the adjustment mechanism can be immediately triggered, and control measures can be quickly taken to avoid the deterioration of abnormal conditions, thereby reducing crop losses. The advantages of automatic anomaly detection by machine learning algorithms are utilized to achieve intelligent monitoring and real-time adjustment of the crop growth environment.
[0108] S103. According to the adaptive environmental parameter adjustment mechanism, the crop growth environmental parameter control problem is modeled as a Markov decision process, wherein the state space includes the crop growth state and environmental parameters, the action space includes the control actions describing the environmental parameters, and the reward function includes the crop growth performance and energy consumption. A strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy.
[0109] It also includes transition probability, which is used to describe the probability distribution of the environment transitioning to the next state after taking a certain action in the current state. In practical applications, the transition probability is usually unknown and needs to be learned and estimated through the interaction between the agent and the environment.
[0110] In an optional embodiment,
[0111] The Markov decision process is solved by using a strategy optimization algorithm to obtain an optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy, including:
[0112] Construct the action network and state network in the strategy optimization algorithm, where the action network takes the current crop growth environment parameters as input and outputs the corresponding environment parameter control action, and the state network takes the growth environment parameters and the corresponding environment parameter control action as input and outputs the corresponding long-term cumulative reward estimate;
[0113] Calculating the temporal difference error between the state network and the target state network, using the temporal difference error as the state network loss function, and updating the state network by minimizing the state network loss function;
[0114] Calculate the gradient value of the long-term cumulative reward estimate with respect to the environmental parameter control action, construct the action network loss function based on the obtained gradient value, and update the action network by maximizing the action network loss function;
[0115] The updated state network parameters and the updated action network parameters are copied to the target network, and the iteration is repeated until the preset termination conditions are met. Finally, the optimal environmental parameter control strategy is output, and the crop growth environment parameters are adjusted according to the optimal environmental parameter control strategy.
[0116] Exemplarily, two neural networks need to be constructed first, the action network and the state network. The action network takes the current crop growth environment parameters as input, and outputs the corresponding environmental parameter control action through forward propagation calculation. The network generates the optimal control strategy by learning the mapping relationship between environmental parameters and control actions. The state network takes the current growth environment parameters and the corresponding environmental parameter control action as input, and outputs the estimated long-term cumulative reward that can be obtained by taking the action in the current state through forward propagation calculation. The network evaluates the quality of the control strategy by learning the association between state-action pairs and long-term rewards.
[0117] At each decision time step, the sum of the immediate reward obtained by taking the actual action in the current state and the estimated value of the long-term cumulative reward of the next state is calculated as the true long-term reward of the current state-action pair. The output of the state network on the current state-action pair is used as the estimated value, and the mean square error between it and the true long-term reward is calculated as the temporal difference error. The temporal difference error is used as the loss function of the state network, and the state network parameters are updated by minimizing the loss function to make its estimate of the long-term reward more accurate.
[0118] The gradient of the estimated long-term cumulative reward output by the state network with respect to the environmental parameter control action is calculated, and the sensitivity of the estimated value to the action change is calculated. The weighted average of the action gradient is used as the loss function of the action network, and the action network parameters are updated by maximizing the loss function so that the actions generated by it can obtain higher long-term rewards. The update direction of the action network parameters is consistent with the improvement direction of the long-term reward estimate, so optimizing the action network can obtain a better control strategy.
[0119] In order to improve the stability of the policy optimization algorithm, the target action network and the target state network are constructed. Their structures are the same as those of the action network and the state network, but the parameter update frequency is lower. After each update of the action network and the state network parameters, the updated parameters are copied to the corresponding target network, so that the target network parameters slowly and smoothly approach the latest network parameters. Repeat the above process of network construction, error calculation, parameter update, and target network synchronization, and continuously iterate and optimize until the preset convergence conditions are met or the upper limit of the number of iterations is reached.
[0120] When the strategy optimization algorithm converges, the optimized action network is used as the generator of the optimal environmental parameter control strategy. The crop growth environment parameters collected in real time are input into the action network to obtain the corresponding optimal control action. According to the optimal control action, the light, temperature, humidity, carbon dioxide concentration and other parameters of the crop growth environment are adjusted in real time to keep the environment under the guidance of the optimal strategy at all times, so as to achieve the purpose of synergistically optimizing crop growth performance and energy consumption.
[0121] In an optional embodiment,
[0122] The calculation formula of the state network loss function is as follows:
[0123] ;
[0124] in, L 1 represents the state network loss function, M represents the number of samples, m represents the sample index, R represents the immediate reward, γ represents the discount factor, (·) represents the long-term cumulative reward value of the target state network parameter estimation, represents the state network parameters, v ' Indicates the updated crop growth environment status, μ θ' represents the target action network, θ' represents the target action network parameters, (·) represents the long-term cumulative reward value of the current state network parameter estimation, v represents the current crop growth environment parameters, and a represents the environmental parameter control action taken according to the current crop growth environment parameters;
[0125] The calculation formula of the action network loss function is as follows:
[0126] ;
[0127] in, L 2 represents the action network loss function, v m represents the crop growth environment parameters of the mth sample, μ θ Represents an action network.
[0128] In this embodiment, by directly optimizing the action network for generating the control strategy, the two independent steps of strategy evaluation and strategy improvement are avoided, and the convergence speed of strategy optimization can be accelerated. By introducing a state network to estimate the long-term cumulative reward and guide the optimization of the policy network, the variance of the policy gradient is reduced, and the stability and convergence performance of the algorithm are improved. The action network can directly output continuous control actions instead of discrete action spaces, which is suitable for continuous control problems of environmental parameters such as temperature, humidity, and light. By alternately optimizing the action network and the state network, the joint optimization of the two submodules of strategy evaluation and control strategy generation is achieved, which is conducive to finding the overall optimal solution. The trained policy network can output the best control action in real time according to the current crop state and environmental parameters, and realize intelligent adjustment of the crop growth environment.
[0129] Figure 2 FIG. 1 is a structural diagram of a crop growth monitoring system in a cloud planting cabin based on big data technology according to an embodiment of the present invention. Figure 2 As shown, the system comprises:
[0130] The first unit is used to collect original image data of crops during their growth in the cloud planting cabin through a high-resolution camera, including images of the entire crop and parts of the crop, and preprocess the collected original image data to obtain a standard image data set, and input the standard image data set into a pre-trained crop growth state recognition model to obtain a crop growth state recognition result;
[0131] The second unit is used to collect crop growth environment parameters using environmental parameter sensors, and to monitor the obtained crop growth state recognition results and crop growth environment parameters in real time. When abnormal crop growth is detected, an adaptive crop growth environment parameter adjustment mechanism is triggered;
[0132] The third unit is used to model the crop growth environmental parameter control problem as a Markov decision process according to the adaptive environmental parameter adjustment mechanism, wherein the state space includes the crop growth state and environmental parameters, the action space includes the control actions describing the environmental parameters, and the reward function includes the crop growth performance and energy consumption. The strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy.
[0133] According to a third aspect of the embodiments of the present invention,
[0134] An electronic device is provided, comprising:
[0135] processor;
[0136] a memory for storing processor-executable instructions;
[0137] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0138] A fourth aspect of the embodiments of the present invention is:
[0139] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0140] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A crop growth monitoring method for cloud planting cabin based on big data technology, It is characterized in that include: The original image data of crops during their growth process in the cloud planting cabin is collected by a high-resolution camera, including the overall image of the crop and images of its parts. The collected original image data is preprocessed to obtain a standard image data set, which is then input into a pre-trained crop growth status recognition model to obtain crop growth status recognition results. The environmental parameter sensors are used to collect the crop growth environment parameters, and the obtained crop growth status recognition results and crop growth environment parameters are monitored in real time. When abnormal crop growth is detected, the adaptive crop growth environment parameter adjustment mechanism is triggered; According to the adaptive environmental parameter adjustment mechanism, the crop growth environmental parameter control problem is modeled as a Markov decision process, in which the state space includes the crop growth state and environmental parameters, the action space includes the control actions describing the environmental parameters, and the reward function includes the crop growth performance and energy consumption. The strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy; The standard image dataset is input into the pre-trained crop growth status recognition model, and the crop growth status recognition results obtained include: Constructing a convolutional neural network model, the convolutional neural network model includes a feature extraction layer, a feature fusion layer and a classification output layer, wherein the feature extraction layer includes a plurality of depth-separable convolution modules, compresses the features extracted by the plurality of depth-separable convolution modules, and outputs a multi-scale feature map; the feature fusion layer performs feature fusion on the output multi-scale feature map, and the classification output layer inputs the fused multi-scale feature map into a fully connected neural network, and generates a probability distribution of crop growth status using an activation function; The convolutional neural network model is trained using a standard image dataset, a feature difference loss is introduced to construct a loss function, and a stochastic gradient descent algorithm is used to optimize the model parameters, and the iteration is repeated until a preset termination condition is met to obtain a finally trained crop growth state recognition model; Input the standard image data set into the trained crop growth state recognition model, output the probability value of the crop growth state, and take the result with the largest probability value of the crop growth state as the crop growth state recognition result; The environmental parameter sensors are used to collect the crop growth environment parameters, and the obtained crop growth state recognition results and crop growth environment parameters are monitored in real time. When abnormal crop growth is detected, the adaptive crop growth environment parameter adjustment mechanism is triggered, including: Preprocessing the crop growth state recognition results and the crop growth environment parameters to obtain growth state characteristics and growth environment parameter characteristics, and performing feature fusion on the growth state characteristics and growth environment parameter characteristics to obtain comprehensive growth characteristics; The obtained comprehensive growth features are divided into a training set and a test set. A tree-based anomaly detection algorithm is used on the training set to construct multiple isolated trees. For each data point, the average path length in all isolated trees is calculated as the first anomaly score. According to the first anomaly score, a first threshold is set, and the data points whose first anomaly score is lower than the first threshold are marked as first potential anomalies. At the same time, the pre-trained autoencoder model is used on the training set to calculate the reconstruction error of each data point as the second anomaly score, and a second threshold is set according to the second anomaly score, and the data points with a second anomaly score higher than the second threshold are marked as second potential anomalies; Calculate the reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees respectively, and take the weighted average of the obtained results as the joint anomaly score; The obtained joint anomaly score is compared with the first threshold and the second threshold respectively, and whether the current data point is abnormal is determined according to the comparison result. If it is determined to be abnormal, the adaptive environment parameter adjustment mechanism is triggered; The reconstruction error of the first potential outlier and the average path length of the second potential outlier in all isolated trees are calculated respectively, and the obtained results are weighted averaged to obtain the calculation formula of the joint anomaly score as follows: ; Where c(x) represents the joint anomaly score, x represents the data point, α represents the weight coefficient of the anomaly score, r(x) represents the second anomaly score of the data point x, and A 2 represents the set of the second potential outliers, represents the minimum anomaly score in the second set of potential anomaly points, represents the maximum anomaly score in the second potential anomaly point set, s(x) represents the first anomaly score of data point x, and A 1 represents the set of first potential outliers, represents the minimum anomaly score in the first potential anomaly point set, Represents the maximum anomaly score in the first set of potential anomalies.
2. The method according to claim 1, It is characterized in that The calculation formula for constructing the loss function by introducing feature difference loss is as follows: ; Among them, L represents the loss function, N represents the number of image samples, C represents the number of categories, and y ij Indicates the true label of image sample i belonging to category j, N j Represents the number of image samples of category j, y kj Indicates that image sample k belongs to the true label of category j, f i represents the feature vector of image sample i, f k represents the feature vector of image sample k, c j Represents the central feature vector of category j.
3. The method according to claim 1, It is characterized in that The Markov decision process is solved by using a strategy optimization algorithm to obtain an optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy, including: Construct the action network and state network in the strategy optimization algorithm, where the action network takes the current crop growth environment parameters as input and outputs the corresponding environment parameter control action, and the state network takes the growth environment parameters and the corresponding environment parameter control action as input and outputs the corresponding long-term cumulative reward estimate; Calculating the temporal difference error between the state network and the target state network, using the temporal difference error as the state network loss function, and updating the state network by minimizing the state network loss function; Calculate the gradient value of the long-term cumulative reward estimate with respect to the environmental parameter control action, construct the action network loss function based on the obtained gradient value, and update the action network by maximizing the action network loss function; The updated state network parameters and the updated action network parameters are copied to the target network, and the iteration is repeated until the preset termination conditions are met. Finally, the optimal environmental parameter control strategy is output, and the crop growth environment parameters are adjusted according to the optimal environmental parameter control strategy.
4. The method according to claim 1, It is characterized in that The calculation formula of the state network loss function is as follows: ; in, L 1 represents the state network loss function, M represents the number of samples, m represents the sample index, R represents the immediate reward, γ represents the discount factor, (·) represents the long-term cumulative reward value of the target state network parameter estimation, represents the state network parameters, v ' Indicates the updated crop growth environment status, μ θ' represents the target action network, θ' represents the target action network parameters, (·) represents the long-term cumulative reward value of the current state network parameter estimation, v represents the current crop growth environment parameters, and a represents the environmental parameter control action taken according to the current crop growth environment parameters; The calculation formula of the action network loss function is as follows: ; in, L 2 represents the action network loss function, v m represents the crop growth environment parameters of the mth sample, μ θ Represents an action network.
5. A crop growth monitoring system for a cloud planting cabin based on big data technology, used to implement the method described in any one of claims 1 to 4. It is characterized in that include: The first unit is used to collect original image data of crops during their growth in the cloud planting cabin through a high-resolution camera, including images of the entire crop and parts of the crop, and preprocess the collected original image data to obtain a standard image data set, and input the standard image data set into a pre-trained crop growth state recognition model to obtain a crop growth state recognition result; The second unit is used to collect crop growth environment parameters using environmental parameter sensors, and to monitor the obtained crop growth state recognition results and crop growth environment parameters in real time. When abnormal crop growth is detected, an adaptive crop growth environment parameter adjustment mechanism is triggered; The third unit is used to model the crop growth environmental parameter control problem as a Markov decision process according to the adaptive environmental parameter adjustment mechanism, wherein the state space includes the crop growth state and environmental parameters, the action space includes the control actions describing the environmental parameters, and the reward function includes the crop growth performance and energy consumption. The strategy optimization algorithm is used to solve the Markov decision process to obtain the optimal environmental parameter control strategy, and the crop growth environmental parameters are adjusted according to the optimal environmental parameter control strategy.
6. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 4.
7. A computer-readable storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Model-data combined driven greenhouse intelligent fertilizer preparation method and system
CN116128672A
Agricultural vegetable growth detection method and system based on artificial intelligence
CN117609895A
Crop growth environment monitoring and analyzing system based on Internet of Things
CN117934936A
Method and device for setting environmental parameters of plant cultivation box
CN118295250A
Construction method of crop growth state monitoring model based on big data
CN118332311A
