Microclimate big data prediction shed factory model construction method based on machine learning
By constructing a machine learning model based on LSTM, the problem of low accuracy in traditional microclimate prediction methods has been solved, enabling high-precision prediction and intelligent management of microclimate environmental parameters, thereby improving crop yield and quality.
Patent Information
- Application Number
- CN202510911197.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-10-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional microclimate prediction methods fail to effectively utilize the complex nonlinear relationships and spatiotemporal dynamics between microclimate environmental parameters, resulting in low prediction accuracy and an inability to meet the refined management needs of greenhouse factories.
By employing a machine learning-based Long Short-Term Memory (LSTM) network model, and through data acquisition, preprocessing, feature engineering, and model training, a microclimate big data prediction model is constructed, which utilizes sensor data for accurate prediction.
It significantly improves the prediction accuracy of microclimate environmental parameters, supports intelligent management, increases crop yield and quality, reduces production costs, and promotes the intelligent development of greenhouse factories.
Smart Images

Figure CN120804658A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of agricultural engineering and machine learning, in particular to a method for constructing a small climate big data prediction greenhouse model based on machine learning. BACKGROUND
[0002] Greenhouse is an important production mode of modern agriculture, and the internal small climate environment such as temperature, humidity, light intensity and CO2 concentration plays a key role in the growth and development of crops. Precise control and prediction of these environmental parameters can help growers adjust production strategies in a timely manner and improve crop yield and quality.
[0003] Currently, traditional small climate prediction methods are mainly based on empirical models or simple statistical analysis, which often ignore the complex nonlinear relationships and spatiotemporal dynamic characteristics between small climate environmental parameters, resulting in low prediction accuracy and failing to meet the needs of fine management of greenhouses. With the development of sensor technology, a large amount of small climate environmental data can be collected in real time, but how to effectively utilize these big data for accurate prediction has become a problem to be solved. SUMMARY
[0004] Therefore, the present application aims to provide a method for constructing a small climate big data prediction greenhouse model based on machine learning, which can fully exploit the complex relationships between small climate environmental parameters, accurately predict future small climate environmental parameters in greenhouses using historical data, and improve prediction accuracy to provide strong support for intelligent management of greenhouses.
[0005] The technical solution of the embodiment of the present application is as follows:
[0006] The method for constructing a small climate big data prediction greenhouse model based on machine learning comprises the following steps:
[0007] S1. Data collection and preprocessing: Collect environmental parameters such as date, time, temperature, humidity, light intensity and CO2 concentration in the greenhouse through sensors to form an original data set, and perform cleaning, missing value filling and normalization processing on the data set;
[0008] S2. Feature engineering: Extract time series statistical features and numerically encode date and time;
[0009] S3. Model construction: Construct a prediction model using long short-term memory network (LSTM), which includes an input layer, multiple LSTM hidden layers and an output layer;
[0010] S4. Model training: Train the model using the training set, use mean squared error (MSE) as the loss function, and use the stochastic gradient descent algorithm to optimize the model parameters;
[0011] S5. Model evaluation and optimization: Evaluate the prediction accuracy of the model through the test set, and adjust the model structure or hyperparameters according to the results;
[0012] S6. Model application: Deploy the optimized model to the intelligent management system to predict microclimate parameters in real time.
[0013] Preferably, in the data cleaning step, abnormal values are removed by setting reasonable ranges of temperature, humidity and other parameters. Specifically, for temperature value T i , if T i <T min or T i >T max , the data point is removed.
[0014] Preferably, the missing value filling adopts the mean filling method, specifically: calculate the mean value of non-missing values of the parameter to fill in the missing values, where n is the number of non-missing values.
[0015] Preferably, the normalization processing adopts the minimum-maximum normalization, the formula is: where x min and x max are the minimum and maximum values of the parameter, is the normalized value.
[0016] Preferably, the time series statistical features include the average value of temperature in the past 24 hours and the variance The calculation formula is: where T1, T2,..., T 24 are the temperature values in the past 24 hours.
[0017] Preferably, the date and time encoding specifically converts the date into the number of days from a fixed date, and converts the time into the number of minutes in a day.
[0018] Preferably, the calculation process of the LSTM hidden layer includes: t i ix = σ(W t X ih +W t-1 h i +b t );
[0019] f fx = σ(W t X fh +W t-1 h t +bf);
[0020] ot = sigma(W ox X t + W oh h t-1 + b o );
[0021]
[0022] h t = o t tanh(C t ); wherein, i t , f t , o t are input gate, forget gate, and output gate activation values respectively, is a candidate memory cell, C t is a memory cell, W and b are weight matrix and bias vector, sigma is a sigmoid function, and is an element-wise multiplication.
[0023] Preferably, the Adam algorithm is used to optimize parameters in the model training, the learning rate is 0.001-0.1, and the number of LSTM hidden layer neurons is 32-128.
[0024] Preferably, the model evaluation indicators include mean square error (MSE) and mean absolute error (MAE), wherein the MAE calculation formula is: is the number of samples, y i is the true value, is the predicted value.
[0025] Preferably, in the model application, the ventilation equipment, irrigation system, or light supplementing equipment in the greenhouse is controlled through the prediction result to realize intelligent adjustment of the microclimate environment.
[0026] The embodiments of the present application have the following advantages due to the use of the above technical solutions:
[0027] I. Improve the prediction accuracy: the machine learning model based on LSTM can fully mine the complex nonlinear relationship and spatiotemporal dynamic change characteristics between the microclimate environment parameters, and significantly improve the prediction accuracy of the microclimate environment parameters compared with the traditional prediction method.
[0028] II. Support intelligent management: through accurate microclimate prediction, the grower can take measures to adjust the environmental conditions of the greenhouse in advance, realize precise environmental control, improve the yield and quality of crops, reduce production costs, and promote the intelligent development of the greenhouse.
[0029] III. Effective use of big data: the application makes full use of a large number of microclimate big data collected by sensors, and through data preprocessing, feature engineering and other means, the big data is converted into valuable information, providing strong support for model construction and prediction.
[0030] The above summary is intended to illustrate only and is not intended to limit the application in any way. Further aspects, embodiments and features of the application will be apparent from the drawings and the following detailed description. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0032] Fig. 1 The technical solution of the present application is a whole flowchart;
[0033] Fig. 2 The LSTM model architecture of the present application is a whole flowchart;
[0034] Fig. 3 The data preprocessing sub-flowchart of the present application is a whole flowchart;
[0035] Fig. 4 The facility vegetable shed embodiment flowchart of the present application is a whole flowchart. DETAILED DESCRIPTION
[0036] In the following, only some exemplary embodiments are simply described. As those skilled in the art can recognize, the described embodiments can be modified in various different ways without departing from the spirit or scope of the present application. Therefore, the drawings and the description are considered to be exemplary in nature rather than limiting.
[0037] It should be noted that the terms "first", "second", "symmetric", "array" and the like are only used for distinguishing description and position description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "symmetric" and the like can explicitly or implicitly include one or more of the features; similarly, for some features that are not limited in number by the words "two", "three" and the like, it should be noted that the features also belong to explicitly or implicitly including one or more of the features;
[0038] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "fixing" and the like should be understood in a broad sense; for example, it can be fixed connection, or detachable connection, or integral molding; it can be mechanical connection, it can be direct connection, it can be welding, it can be indirect connection through an intermediate medium, it can be the internal communication of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specification and drawings in combination with specific circumstances.
[0039] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0040] As Figs. 1-4 indicated, the present application provides a microclimate big data prediction greenhouse factory model construction method based on machine learning, which comprises the following steps:
[0041] S1. Data acquisition and preprocessing: collecting environmental parameters such as date, time, temperature, humidity, light intensity, CO2 concentration in the greenhouse factory through sensors to form an original data set, and performing cleaning, missing value filling and normalization processing on the data set;
[0042] S2. Feature engineering: extracting time series statistical features, and numerically encoding the date and time;
[0043] S3. Model construction: using long short-term memory network (LSTM) to construct a prediction model, which includes an input layer, multiple LSTM hidden layers and an output layer;
[0044] S4. Model training: training the model using the training set, taking mean square error (MSE) as the loss function, and using the stochastic gradient descent algorithm to optimize the model parameters;
[0045] S5. Model evaluation and optimization: evaluating the prediction accuracy of the model through the test set, and adjusting the model structure or hyperparameters according to the results;
[0046] S6. Model application: deploying the optimized model to an intelligent management system to predict microclimate parameters in real time.
[0047] As Figs. 1-4 indicated, in the data cleaning step, abnormal values are removed by setting reasonable ranges of temperature, humidity and other parameters. Specifically, for the temperature value T i , if T i <T min or T i >T max , the data point is removed. The missing value filling uses the mean filling method, specifically: calculating the average value of non-missing values of the parameter to fill the missing values, where n is a non-missing numeric value.
[0048] like Figs. 1-4 As shown, the normalization process uses minimum-maximum normalization, and the formula is: Among them, x min and x max are the minimum and maximum values of the parameter, is a normalized value. The time series statistical features include the average temperature over the past 24 hours. and variance The calculation formula is: Among them, T1, T2, ..., T 24 The temperature value for the past 24 hours.
[0049] like Figs. 1-4 As shown, the date and time encoding is as follows: converting the date into the number of days from a fixed date and the time into the number of minutes in a day. The calculation process of the LSTM hidden layer includes: i t =σ(W ix X t +W ih h t-1 +b i );
[0050] f t =σ(W fx X t +W fh h t-1 +bf);
[0051] o t =σ(W ox X t +W oh h t-1 +b o );
[0052]
[0053] h t =o t ⊙tanh(C t ); where i t , f t , o t are the activation values of the input gate, forget gate, and output gate respectively. is the candidate memory unit, C t is the memory unit, W and b are the weight matrix and bias vector, σ is the sigmoid function, and ⊙ is the element-by-element multiplication.
[0054] like Figs. 1-4As shown, Adam algorithm is used to optimize parameters in model training, learning rate is 0.001-0.1, LSTM hidden layer neuron number is 32-128, model evaluation index includes mean square error (MSE) and mean absolute error (MAE), and the MAE calculation formula is: is the sample number, y i is the true value, is the predicted value, in model application, the prediction result is used to control the ventilation equipment, irrigation system or light supplement equipment in the greenhouse to realize intelligent adjustment of the microclimate environment.
[0055] In this embodiment, the specific application in the working process is:
[0056] First, data collection and preprocessing are carried out:
[0057] Temperature, humidity, light intensity, CO2 concentration sensors and time collection modules are arranged in the greenhouse, and environmental parameters such as date, time, temperature (℃), humidity (%), light intensity (lux) and CO2 concentration (ppm) are collected at fixed time intervals (such as 15 minutes) to form an original data set. The following operations are performed on the data set:
[0058] (1) Data cleaning: set reasonable parameter range (such as temperature 5-40℃, humidity 30-90%), and eliminate abnormal values outside the range;
[0059] (2) Missing value processing: calculate the average value of non-missing values of the same parameter, and fill in the missing data;
[0060] (3) Normalization processing: through the minimum-maximum normalization algorithm, all parameters are mapped to the [0, 1] interval to eliminate the dimension difference.
[0061] Second, enter the feature engineering stage:
[0062] Based on the preprocessed data, two types of features are constructed:
[0063] (1) Time series statistical features: calculate the average value, variance and other indicators of temperature, humidity, light intensity and CO2 concentration in the past 24 hours to capture the dynamic change rule of the parameters;
[0064] (2) Time encoding features: convert the date into "distance from the fixed reference day", and convert the time into "minute in a day", which are converted into numerical features that can be analyzed by the model.
[0065] Third, model construction and training are carried out:
[0066] The long short-term memory network (LSTM) is used to build a prediction model, which includes an input layer (receiving a feature vector), a multi-layer LSTM hidden layer (learning time-dependent relationship), and an output layer (predicting microclimate parameters). The data set is divided into a training set and a test set in a ratio of 8:2, and the following is performed:
[0067] (1) Training configuration: using mean square error (MSE) as the loss function, and using the Adam optimization algorithm to update the model parameters;
[0068] (2) Hyperparameter tuning: adjusting the number of LSTM hidden layer neurons (such as 32-128), learning rate (such as 0.001-0.1), and balancing model fitting ability and training efficiency.
[0069] Four, after completing the training, enter the model evaluation and optimization:
[0070] The performance of the model is verified using the test set, and the mean square error (MSE), mean absolute error (MAE), and other indicators are calculated. If the prediction accuracy is insufficient, the following methods can be used for optimization:
[0071] (1) Expand the training data volume to cover more seasonal and weather microclimate scenarios;
[0072] (2) Adjust the model structure (such as increasing the depth of the LSTM layer) or hyperparameters (such as extending the training period);
[0073] (3) Back up the data preprocessing stage, reselect features, or optimize the abnormal value processing rules.
[0074] Five, enter the model application stage:
[0075] The optimized model is deployed to the greenhouse factory intelligent management system, which receives newly collected environmental parameters in real time and predicts microclimate parameters for the next 1-6 hours. Based on the prediction results, the grower can:
[0076] (1) Adjust the ventilation equipment to regulate temperature and CO2 concentration;
[0077] (2) Start the irrigation system to maintain stable humidity;
[0078] (3) Control the light supplementing equipment to match the light demand;
[0079] Achieve intelligent dynamic regulation and control of the greenhouse microclimate to create an optimal environment for crop growth.
[0080] The following are several specific embodiments of the application:
[0081] Example 1: Facility vegetable greenhouse microclimate prediction and regulation
[0082] Data collection phase: For tomato and cucumber as the main facility vegetable shed, temperature and humidity, light, CO2 sensors are arranged at intervals of 5 meters in the shed. Temperature, humidity, light intensity, CO2 concentration, and growth period markers (seedling stage / fruiting stage) are collected every 10 minutes. Outdoor temperature and humidity are recorded simultaneously. When cleaning, abnormal values with temperature jumps of ±5°C are removed, and missing values are filled with the average value of the same growth period and time period.
[0083] Model training phase: The data set is divided by growth period (seedling stage: fruiting stage: other = 7:2:1). The LSTM model is optimized by increasing the weight of CO2 concentration features (fruiting stage proportion +20%) and adding "growth period encoding" branch to strengthen stage learning. The learning rate is reduced to 0.0005 during training, and the MAE of the validation set is used as the index to adjust the parameters.
[0084] Prediction application phase: Input real-time data and growth period label, predict future 3 hours temperature fluctuation, CO2 deficit risk. If the predicted temperature in the fruiting stage exceeds 32°C (tomato critical high temperature), start top window ventilation + fogging cooling 1 hour in advance; CO2 is lower than 400ppm, trigger gas fertilizer supplement, achieve 15-20% yield increase.
[0085] Example two: Precise control of small climate in flower seedling shed factory
[0086] Data collection phase: For butterfly orchid and succulent seedling shed, light intensity (5 minutes / time, distinguish natural light / supplementary light), humidity (including substrate humidity), and temperature sensors are arranged at 20 cm above the seedbed. The seedling stage (sowing / seedling) is recorded. When cleaning, filter the supplementary light peak data, and fill in the missing values using the interpolation method of adjacent seedbeds (use the homogeneity of the same area environment).
[0087] Model training phase: Build a "light-humidity-temperature" correlation model, add a light change rate branch to capture short-term fluctuations; train by seedling stage + light quality type, and strengthen the adaptability of different light sources. The monitoring humidity error of the validation set is ≤±5%, and the "substrate humidity feedback correction term" is added for retraining when the threshold is exceeded.
[0088] Prediction application phase: Input real-time data and seedling stage, predict future 2 hours humidity trough, light insufficient period. When the light intensity is less than 8000 lux during the seedling stage, automatically switch to the supplementary light mode (red light proportion 60%); when the substrate humidity is less than 60%, start micro-spraying, and the butterfly orchid seedling rate increases from 82% to 95%.
[0089] Example three: Small climate protection for wintering in northern cold region shed factory
[0090] Data collection phase: For cucumber greenhouse in northeast cold region, the temperature (ground surface, 20 cm, 1.5 m), light, CO2 are arranged in layers in the greenhouse, and the outdoor temperature, wind speed and sunshine duration (collected every hour) are added 5 meters outside the greenhouse. When cleaning, the temperature drop caused by heavy snow / extreme cold (more than 10℃ is determined as sensor icing) is removed, and the missing value is filled by ARIMA and trained by LSTM.
[0091] Model training phase: Construct a "coupling model inside and outside the greenhouse", the input layer fuses the outdoor temperature (lag 1 hour) and wind speed to simulate the outdoor influence; strengthen the light period <1000 lux training (accounting for 30%), and extend the hidden layer memory cycle to 48 hours (capture the cumulative low temperature across the day). The error of ground surface temperature (≤1℃) is monitored in the validation set to avoid freezing damage.
[0092] Prediction application phase: Input the data inside and outside the greenhouse, predict the minimum temperature and light compensation requirement in the next 6 hours. When the ground surface temperature is less than 12℃, start the floor heating and double-layer insulation curtain 3 hours in advance; when the light is less than 500 lux for 3 consecutive hours, dynamically adjust the full-spectrum light power, reduce the energy consumption by 25% during the winter, and reduce the cucumber yield from 35% to 10%.
[0093] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any skilled person in the art can easily think of various changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for constructing a microclimate big data prediction greenhouse factory model based on machine learning, characterized in that: The following steps are involved: S1. Data Collection and Preprocessing: Sensors are used to collect the date, time, temperature, humidity, light intensity, CO2 concentration, and other environmental parameters in the shed factory to form a raw data set. This data set is then cleaned, missing values are filled, and normalized. S2. Feature Engineering: Extract statistical features of time series and encode dates and times numerically. S3. Model Construction: A prediction model is constructed using a long short-term memory (LSTM) network. The model comprises an input layer, multiple LSTM hidden layers, and an output layer. S4. Model training: The model is trained using the training set, with mean squared error (MSE) as the loss function and the stochastic gradient descent algorithm used to optimize the model parameters. S5. Model evaluation and optimization: Evaluate the model's prediction accuracy using a test set and adjust the model structure or hyperparameters based on the results. S6. Model application: Deploy the optimized model to the intelligent management system to predict microclimate parameters in real time.
2. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1 is characterized in that: In the data cleaning step, abnormal values are eliminated by setting the reasonable range of temperature, humidity and other parameters. Specifically, for the temperature value T i , if T i <T min or T i >T max , then remove the data point.
3. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The missing value filling adopts the mean filling method, specifically: calculating the average value of the non-missing values of the parameter by Fill missing values, where n is a non-missing numeric value.
4. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The normalization process adopts minimum-maximum normalization, and the formula is: Among them, x min and x max are the minimum and maximum values of the parameter, is the normalized value.
5. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The time series statistical features include the average temperature over the past 24 hours and variance The calculation formula is: Among them, T1, T2, ..., T 24 The temperature value for the past 24 hours.
6. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The date and time encoding is specifically: converting the date into the number of days from a fixed date, and converting the time into the number of minutes in a day.
7. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The calculation process of the LSTM hidden layer includes: t =σ(W ix X t +W ih h t-1 +b i ); f t =σ(W fx X t +W fh h t-1 +bf); o t =σ(W ox X t +W oh h t-1 +b o ); h t =o t ⊙tanh(C t ); where i t , f t , o t are the activation values of the input gate, forget gate, and output gate respectively. is the candidate memory unit, C t is the memory unit, W and b are the weight matrix and bias vector, σ is the sigmoid function, and ⊙ is the element-by-element multiplication.
8. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The Adam algorithm is used to optimize parameters in the model training, with a learning rate of 0.001-0.1 and the number of neurons in the LSTM hidden layer ranging from 32 to 128.
9. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: The model evaluation indicators include mean square error (MSE) and mean absolute error is the sample size, y i is the true value, is the predicted value.
10. The method for constructing a microclimate big data prediction shed factory model based on machine learning according to claim 1, characterized in that: In the application of the model, the ventilation equipment, irrigation system or supplementary lighting equipment in the greenhouse factory is controlled by the prediction results, thereby realizing intelligent adjustment of the microclimate environment.