Indoor environment data prediction method and device based on outdoor environment data and medium
By combining outdoor environmental data in smart home systems to predict indoor environments, the prediction lag problem caused by the existing system ignoring outdoor environmental factors is solved, and higher prediction accuracy and flexibility are achieved.
Patent Information
- Application Number
- CN202510038597.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-06-13
AI Technical Summary
When predicting and controlling the indoor environment, existing smart home systems ignore the influence of outdoor environmental factors, resulting in lag in prediction and affecting the accuracy of indoor environment prediction.
A method for prediction of indoor environmental data based on outdoor environmental data is proposed. By collecting environmental data at both outdoor environment and indoor environment, combining prediction mode, the characteristic data used for prediction is screened and determined from the environmental data, preprocessed it, and the preprocessed data is input into the prediction model to obtain indoor prediction data.
By combining outdoor environmental data, the accuracy of indoor environmental prediction is improved, and time-related directional prediction is realized through designing prediction mode, which improves prediction flexibility.
Smart Images

Figure CN120145131A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of smart homes, and particularly to a method, device, and medium for predicting indoor environmental data based on outdoor environmental data. Background Art
[0002] With the development of the smart home field, the monitoring and control of the temperature, humidity, and other air quality parameters in the indoor living environment of residents have become increasingly advanced. However, in areas with relatively serious outdoor air pollution or frequent extreme weather, the impact of outdoor environmental factors on the indoor environment is also huge. Currently, mainly the environmental data collected by indoor sensors are used for prediction and control, ignoring the impact of outdoor environmental factors on the indoor environment, resulting in relatively lagged prediction results and affecting the accuracy of indoor environment prediction.
[0003] In summary, the technical problems existing in the related art need to be improved. Summary of the Invention
[0004] The main objective of the embodiments of this application is to propose a method, device, and medium for predicting indoor environmental data based on outdoor environmental data, aiming to improve the efficiency and accuracy in the design and production of beam components.
[0005] To achieve the above objective, on the one hand, an embodiment of this application proposes a method for predicting indoor environmental data based on outdoor environmental data, and the method includes: Obtain environmental data, where the environmental data is classified into multiple environmental data types according to the collection location and data type, the collection locations include the outdoor environment and the indoor environment, and each item of data is marked with the corresponding collection time as a timestamp; Determine a prediction mode, and determine first feature data according to the prediction mode and the environmental data, where the prediction mode is used to screen and determine the first feature data from the environmental data according to the timestamp; Preprocess the first feature data to obtain preprocessed second feature data; Input the second feature data into a prediction model to obtain an output result of the prediction model, and determine and output indoor prediction data according to the output result, where the output result matches the prediction mode.
[0006] In some embodiments, the prediction mode includes a first mode, and the step of determining first feature data according to the prediction mode and the environmental data includes: When the prediction mode is the first mode, screen first target data from the environmental data, and the timestamp of the first target data falls within a first time period before the current moment; Calculate the maximum value, minimum value, and average value of the first target data, where the first feature data includes the maximum value, the minimum value, and the average value.
[0007] In some embodiments, the prediction mode includes a second mode, and the step of determining the first feature data according to the prediction mode and the environmental data includes: When the prediction mode is the second mode, filter second target data from the environmental data, where the timestamps of the second target data fall within a first time period before the current moment, and each timestamp has a second time period interval, and the second time period is less than the first time period; Determine the second target data as the first feature data.
[0008] In some embodiments, the step of inputting the second feature data into the prediction model includes: Input the second feature data into an LSTM prediction model, where the LSTM prediction model includes at least an input layer, two LSTM layers, two Dropout layers, a fully connected layer, and an output layer.
[0009] In some embodiments, the method further includes: Obtain a training model and training data, where the timestamps of the training data have a second time period interval; Divide the training data into a training set, a validation set, and a test set according to a preset ratio, and perform sliding window processing and preprocessing on the training set; Train the training model according to the processed training set, the validation set, and the test set to obtain the prediction model.
[0010] In some embodiments, before the step of determining and outputting indoor prediction data according to the output result, the method further includes: For each data item in the output result, determine a first preset interval according to the environmental data type of the data item, and correct the data item according to the first preset interval, where the first preset interval is the normal value range corresponding to the environmental data type.
[0011] In some embodiments, after the step of determining the first preset interval according to the environmental data type of the data item, the method further includes: Determine a third target data in the first feature data that matches the environmental data type of the data item; When the third target data falls within a second preset interval, correct the data item according to the second preset interval and the third target data, where the second preset interval is a sub-interval of the first preset interval; When the third target data does not fall within the second preset interval, perform the step of correcting the data item according to the first preset interval.
[0012] In some embodiments, the step of preprocessing the first feature data to obtain the preprocessed second feature data includes: For each data item in the first feature data, determine a first preset interval according to the environmental data type of the data item, and correct the data item according to the first preset interval, where the first preset interval is the normal value range corresponding to the environmental data type; Perform normalization processing on the corrected first feature data to obtain the second feature data.
[0013] To achieve the above object, another aspect of the embodiments of the present application proposes an indoor environmental data prediction device based on outdoor environmental data, and the device includes: An acquisition module, configured to acquire environmental data, where the environmental data is classified into multiple environmental data types according to the acquisition location and data type, the acquisition location includes an outdoor environment and an indoor environment, and each item of data is marked with the corresponding acquisition time as a timestamp; A prediction setting module, configured to determine a prediction mode, and determine first feature data according to the prediction mode and the environmental data, where the prediction mode is used to screen and determine the first feature data from the environmental data according to the timestamp; A data processing module, configured to preprocess the first feature data to obtain the preprocessed second feature data; A prediction module, configured to input the second feature data into a prediction model, obtain an output result of the prediction model, and determine and output indoor prediction data according to the output result, where the output result matches the prediction mode.
[0014] To achieve the above object, another aspect of the embodiments of the present application proposes a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the foregoing method is implemented.
[0015] The embodiments of the present application at least include the following beneficial effects: The present application provides a method, device and medium for predicting indoor environmental data based on outdoor environmental data. This solution collects environmental data at both an outdoor environment and an indoor environment collection location, and combines a prediction mode to screen and determine first feature data for prediction from the environmental data according to the time stamps of the collection times, preprocess the first feature data to obtain second feature data, input the second feature data into a prediction model, obtain the output result of the prediction model, and thus determine and output indoor prediction data according to the output result. Compared with predicting only based on the environmental data collected indoors, the present application combines the environmental data collected in the outdoor environment, enabling the prediction model to perform predictions considering the influence of outdoor environmental factors, improving the accuracy of indoor environmental prediction. In addition, by designing the prediction mode, both the input data and output data of the prediction can be screened and changed according to the prediction mode, thereby achieving time-related directional prediction and improving the flexibility of the prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart of a method for predicting indoor environmental data based on outdoor environmental data provided by an embodiment of the present application; Figure 2 is Figure 1 a partial flowchart of step S104 in Figure 3 is another flowchart of a method for predicting indoor environmental data based on outdoor environmental data provided by an embodiment of the present application; Figure 4 is a schematic structural diagram of a device for predicting indoor environmental data based on outdoor environmental data provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application detailed in the appended claims.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0019] A method for predicting indoor environmental data based on outdoor environmental data provided by an embodiment of the present application relates to the technical field of smart home. This method can be applied to a terminal, a server, or software running on a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, etc., but is not limited thereto; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the method for predicting indoor environmental data based on outdoor environmental data, etc., but is not limited to the above forms.
[0020] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0021] In the related art, today's smart home systems have been gradually popularized in environmental control, including monitoring and regulation of temperature, humidity, and other air quality aspects. Currently, it mainly relies on the data collected by indoor monitoring devices for feedback control, and does not combine outdoor environmental changes to predict and adjust the indoor environment in advance. In areas with relatively serious outdoor air pollution or areas where extreme weather occurs frequently, the impact of outdoor environmental factors on the indoor environment is more critical. The neglect of the impact of outdoor environmental factors leads to a relatively lagging prediction result, affecting the accuracy of indoor environmental prediction.
[0022] In view of this, an embodiment of the present application provides a method, device, and storage medium for predicting indoor environmental data based on outdoor environmental data. Figure 1It is an alternative flowchart of a method for predicting indoor environmental data based on outdoor environmental data provided by an embodiment of the present application. Figure 1 The method in
[0023] Step S101: Obtain environmental data. The environmental data is classified into multiple environmental data types according to the collection location and data type. The collection locations include the outdoor environment and the indoor environment, and each piece of data is marked with the corresponding collection time as the timestamp.
[0024] The environmental data described in the embodiments of the present application may affect the health of residents and can be collected through a sensor network, such as temperature, humidity, wind direction, wind speed, light intensity, rainfall, and ultraviolet index related to meteorology, formaldehyde, PM2.5, carbon dioxide, TVOC, PM10, PM1.0, SO 2 , oxygen, ozone concentration, etc. related to air quality, as well as noise decibels, benzene, chlorine, water quality, water pressure, etc. The above data is collected through a sensor network set in the indoor and outdoor environments and is respectively defined as different environmental data types. It should be noted that the data collected in the outdoor environment and the data collected in the indoor environment are also used as the criteria for defining different environmental data types. For example, the temperature collected in the outdoor environment and the temperature collected indoors also belong to different environmental data types.
[0025] Each piece of collected environmental data is marked with its collection time as the timestamp. In other embodiments, by adjusting the collection periods of various types of sensors, the collection periods of different types of sensors can be aligned. In this way, each timestamp can directly correspond to environmental data of multiple environmental data types, and the environmental data of multiple environmental data types can also directly form the corresponding data vector as the environmental data corresponding to the timestamp.
[0026] Step S102: Determine the prediction mode. Determine the first feature data according to the prediction mode and the environmental data. The prediction mode is used to screen and determine the first feature data from the environmental data according to the timestamp.
[0027] The prediction mode described in the embodiments of the present application is used to control different directions of prediction. Under different prediction modes, different first feature data will be screened and determined from the environmental data according to the timestamp, such as different granularities or data for certain specific moments. The prediction mode is set by the user independently, or can be default set to perform the prediction with the finest granularity, and different directions of prediction will only be performed when the user sets it to other prediction modes.
[0028] According to the set prediction mode, screen and determine the first feature data that needs to be used as input from the environmental data according to the timestamp.
[0029] Step S103: Preprocess the first feature data to obtain the preprocessed second feature data.
[0030] Before inputting the first feature data into the prediction model, it is also necessary to preprocess the first feature data first to exclude outliers in the first feature data and standardize data with large numerical differences caused by different types. Define the data after preprocessing as the second feature data, and each second feature data is also a data vector corresponding to a certain timestamp.
[0031] Step S104: Input the second feature data into the prediction model to obtain the output result of the prediction model, and determine and output the indoor prediction data according to the output result. The output result matches the prediction mode.
[0032] Furthermore, input the second feature data into the prediction model, and after the analysis of the prediction model, obtain the output result of the model. It should be noted that due to the setting of the prediction mode, there may be differences in the data composition of the second feature data under different prediction modes, and the data composition of the output result should also correspond to the setting of the prediction mode. If the first feature data is screened from the environmental data based on a larger granularity, such as every 2 hours, the output result should also be predicted every 2 hours. If the first feature data is screened from the environmental data based on a smaller granularity, such as every 10 minutes, the output result should also be predicted every 10 minutes. For each item of data in the output result, corresponding annotations are made according to the type of environmental data involved in the input second feature data, so as to obtain the required indoor prediction data.
[0033] Steps S101 to S104 illustrated in the embodiments of the present application collect environmental data at both an outdoor environment and an indoor environment collection site, and in combination with the prediction mode, screen and determine the first feature data for prediction from the environmental data according to the timestamp of the collection time, preprocess the first feature data to obtain the second feature data, input the second feature data into the prediction model to obtain the output result of the prediction model, and thus determine and output the indoor prediction data according to the output result. Compared with predicting only based on the environmental data collected indoors, the present application combines the environmental data collected in the outdoor environment, enabling the prediction model to combine the influence of outdoor environmental factors for prediction, improving the accuracy of indoor environment prediction. In addition, by designing the prediction mode, both the input data and the output data of the prediction can be screened and changed according to the prediction mode, thereby realizing time-related directional prediction and improving the flexibility of the prediction.
[0034] In step S102 of some embodiments, the step of determining the first feature data according to the prediction mode and environmental data includes: When the prediction mode is the first mode, filter the first target data from the environmental data, and the timestamps of the first target data fall within the first time period before the current moment.
[0035] Calculate the maximum value, minimum value, and average value of the first target data. The first feature data includes the maximum value, minimum value, and average value.
[0036] Specifically, the first time period is used to filter and limit the range of environmental data involved in each prediction, and at the same time, it also limits the prediction range corresponding to the indoor prediction data obtained by the prediction. For example, if the first time period is set to 24 hours, it is equivalent to predicting the indoor prediction data within 24 hours after the current moment based on the environmental data within 24 hours before the current moment.
[0037] On the other hand, in this embodiment, the prediction mode includes at least the first mode, and the first mode is the prediction mode with the largest granularity. The purpose is to predict the maximum value, minimum value, and average value data within the first time period. Therefore, when it is determined that the prediction mode is the first mode, filter out the data whose timestamps fall within the first time period before the current moment from the environmental data, and define it as the first target data. Then calculate the maximum value, minimum value, and average value of the first target data. For each type of environmental data, the above processing is performed respectively, so as to calculate the maximum value, minimum value, and average value of each type of environmental data within the first time period before the current moment. The calculated numbers are the first feature data corresponding to the prediction mode being the first mode. Correspondingly, the output result of the prediction model in the first mode is also the maximum value, minimum value, and average value within the first time period after the current moment.
[0038] By designing the first mode, the user can select the prediction mode, improving the flexibility of indoor environment prediction. On the other hand, the first mode is set as the prediction mode with the largest granularity. By calculating the three indicators of the maximum value, minimum value, and average value, the user can quickly understand the indoor environment within the first time period in the future, improving the time efficiency of indoor environment prediction.
[0039] In step S102 of some embodiments, the step of determining the first feature data according to the prediction mode and environmental data includes: When the prediction mode is the second mode, filter the second target data from the environmental data. The timestamps of the second target data fall within the first time period before the current moment, and each timestamp has an interval of the second time period, and the second time period is less than the first time period.
[0040] Determine that the second target data is the first feature data.
[0041] Specifically, the second time period is used to further divide the prediction granularity within the first time period. The interval between adjacent timestamps in the second target data is the second time period. Therefore, the second time period is less than the first time period. For example, if the first time period is set to 24 hours and the second time period is set to 1 hour, it is equivalent to predicting the indoor prediction data every 1 hour within the 24 hours after the current moment based on the environmental data every 1 hour within the 24 hours before the current moment.
[0042] On the other hand, in this embodiment, the prediction mode includes at least a second mode. The purpose of the second mode is to perform a detailed prediction based on the first time period, and its detailed level is set by the user adjusting the second time period. In this embodiment, the second mode is the prediction mode with the finest granularity. Therefore, when it is determined that the prediction mode is the second mode, the data with timestamps falling within the first time period before the current moment is screened out from the environmental data, and further, the data with an interval of the second time period is screened out from it, and it is defined as the second target data. When the prediction mode is the second mode, the second target data is the corresponding first feature data. Correspondingly, the output result of the prediction model in the second mode is also the indoor prediction data at each moment with an interval of the second time period within the first time period after the current moment.
[0043] By designing the second mode, the user can select the prediction mode, improving the flexibility of indoor environment prediction. On the other hand, the second mode is set as a prediction mode with a small granularity and can be flexibly adjusted. By predicting the indoor prediction data at multiple moments, the user can understand in detail the indoor environment at each moment within the future first time period, as well as the possible changes in the indoor environment over time, improving the accuracy of indoor environment prediction.
[0044] In step S103 of some embodiments, it includes: For each data item in the first feature data, a first preset interval is determined according to the environmental data type of the data item, and the data item is corrected according to the first preset interval. The first preset interval is the normal value range corresponding to the environmental data type.
[0045] The corrected first feature data is normalized to obtain the second feature data.
[0046] It can be understood that in a normal residential environment, each environmental data type has its corresponding normal value range. For example, the temperature is generally Within the interval, therefore, each environmental data type is set with a corresponding first preset interval to limit its data within the normal numerical range. For each data item in the first feature data that serves as input data, determine the first preset interval according to the environmental data type of the data item, and correct the value of the data item according to the first preset interval so that its value does not exceed the first preset interval. If it exceeds, correct it to the boundary value closest to its original value. Taking the interval of the above temperature as an example, when the temperature in the output result is it is corrected to , and when the temperature is no processing is performed.
[0047] Furthermore, since there are significant differences in the dimensions and value ranges of the environmental data of different environmental data types, in order to improve the prediction accuracy of the prediction model, further normalization processing is required. For the environmental data of the same environmental data type, the normalized value can be calculated with reference to the following formula (1): (1) where X is the original data, is the maximum value in this environmental data type, is the minimum value in this environmental data type, is its normalized value. It should be noted that the maximum and minimum values in the above environmental data type are determined based on all the data in the environmental data type, not limited to the first feature data.
[0048] Define the data after normalization processing as the second feature data, which serves as the data actually input into the prediction model.
[0049] In other embodiments, it may further include other preprocessing steps in addition to the above-mentioned correcting the value range of the data item according to the first preset interval and normalization processing, such as performing sliding window filtering processing or missing value filling.
[0050] By correcting the data items in the first feature data that exceed the normal numerical range according to the first preset interval and calculating the normalized value of each data item in the first feature data, the data items belonging to different environmental data types are standardized, enabling the prediction model to accurately analyze based on the preprocessed second feature data, avoiding interference caused by abnormal data or differences in data dimensions, and improving the accuracy of indoor environment prediction.
[0051] In step S104 of some embodiments, before the step of determining and outputting indoor prediction data according to the output result, it further includes: Step S201, for each data item in the output result, determine the first preset interval according to the environmental data type of the data item.
[0052] Step S202, correct the data item according to the first preset range, where the first preset range is the normal value range corresponding to the environmental data type.
[0053] Outside the step of inputting data, for each data item in the output result, it can also be determined whether it falls within the normal value range defined by the first preset range. Determine the first preset range according to the environmental data type of the data item, and determine whether the value of the data item falls within the corresponding first preset range. When it is determined to fall within, no processing is required. When it is determined not to fall within, the value of the data item needs to be corrected. The steps for correcting the data item in the first feature data according to the first preset range can be referred to above and will not be elaborated.
[0054] By setting the first preset range to correct the output result, the output result of the prediction model conforms to the normal value range, avoiding the situation where the prediction model outputs abnormal values due to abnormal failures, and improving the accuracy of indoor environment prediction.
[0055] After step S201 in some embodiments, it further includes: Step S301, determine the third target data in the first feature data that matches the environmental data type of the data item.
[0056] Step S302, when the third target data falls within the second preset range, correct the data item according to the second preset range and the third target data, where the second preset range is a sub-range of the first preset range.
[0057] Step S303, when the third target data does not fall within the second preset range, execute the step of correcting the data item according to the first preset range.
[0058] In addition to setting the first preset range to limit the environmental data within the normal value range, it can be understood that even within the first preset range, there are values that are less common in a normal living environment, that is, relatively extreme values. These values generally only appear under extreme weather conditions, such as when the temperature is greater than or less than etc. In view of such situations, the influence of the outdoor environment on the indoor environment is inevitable, and the obtained indoor prediction data will necessarily be relatively close to the extreme values within the first preset range.
[0059] Based on this, a second preset range is set to determine whether the value of the data item belongs to a relatively extreme situation. The second preset range is a sub-range of the first preset range. Taking the above temperature range as an example, the second preset range may include and .
[0060] After determining the first preset interval, search for data of the same environmental data type as this data item from the first feature data, and define it as the third target data. This step is to check whether the data of this environmental data type is an extreme value when input, and determine whether the third target data falls within the second preset interval. When the third target data does not fall within the second preset interval, it means that the third target data is a value under normal circumstances, and continue to execute the step of correcting this data item in the output result according to the first preset interval. When the third target data falls within the second preset interval, it means that the third target data is an extreme value under extreme circumstances. Correspondingly, correct this data item according to the second preset interval and the value of the third target data. For example, the value of this data item should also fall within the second preset interval, or should be within the interval formed by increasing or decreasing the preset amplitude based on the third target data. For example, when the outdoor temperature is At this time, with As the preset amplitude, the predicted indoor temperature should be within Range, developers can consider factors such as region and set the corresponding preset amplitude or other correction methods.
[0061] By setting the second preset interval and determining whether the first feature data falls within the second preset interval, the embodiments of the present application can consider extreme values under extreme weather conditions, thereby making targeted adjustments to the output results of the prediction model and improving the accuracy of indoor environment prediction.
[0062] In step S104 of some embodiments, the step of inputting the second feature data into the prediction model includes: Input the second feature data into the LSTM prediction model, and the LSTM prediction model includes at least an input layer, two LSTM layers, two Dropout layers, a fully connected layer, and an output layer.
[0063] In this embodiment, the prediction model is a long short-term memory network model, that is, the LSTM prediction model. In this model, in order, it includes an input layer, a first LSTM layer, a first Dropout layer, a second LSTM layer, a second Dropout layer, a fully connected layer, and an output layer.
[0064] Among them, the input layer is used to receive the input of the second feature data including multi-dimensional features after normalization processing; the first LSTM layer includes 128 LSTM units and is provided with an activation function tanh. The first LSTM layer is used to extract the long-term dependencies in the time series data and capture the short-term impact of the outdoor environment on the indoor environment; the first Dropout layer is set with a dropout rate of 0.2, which is used to prevent the model from overfitting and ensure that the prediction model has stronger robustness to noise; the second LSTM layer includes 64 LSTM units and is used to further explore the long-term and short-term feature relationships, so as to extract deeper time series features; the second Dropout layer is set with a dropout rate of 0.2, which is used to further weaken the dependence of the model on certain features and improve the generalization ability of the prediction model; the fully connected layer, also known as the Dense layer, is used to connect the output of the LSTM layer and the final output layer, processes the features extracted in the LSTM layer through a fully connected network, and generates a prediction result; the output layer is used to output a matching output result according to the prediction mode. When the prediction mode is the first mode, the output result includes the maximum value, minimum value and average value of various environmental data types within the first time period after the current moment. When the prediction mode is the second mode, the output result includes multiple predicted values of various environmental data types at intervals of the second time period within the first time period after the current moment.
[0065] By using the long short-term memory network model as the prediction model, the prediction model can mine the temporal correlation of the data and the impact of the environmental data collected from the outdoor environment on the indoor environmental data, improving the accuracy of indoor environment prediction.
[0066] In some embodiments, the method further includes: Step S401, obtaining a training model and training data, and the time stamps of the training data are at intervals of the second time period.
[0067] Step S402, dividing the training data into a training set, a validation set and a test set according to a preset ratio, and performing sliding window processing and preprocessing on the training set; Step S403, training the training model according to the processed training set, validation set and test set to obtain a prediction model.
[0068] Specifically, the training model is an untrained long short-term memory network model, and the training data includes multiple data of the same environmental data type in the environmental data. In order to improve the prediction generalization ability of the prediction model, the model is trained by selecting the granularity corresponding to the second mode. Therefore, the time stamps of the training data are set at intervals of the second time period. Further, the training data is divided into a training set, a validation set and a test set according to a preset ratio. The preset ratios of the training set, the validation set and the test set are respectively set to 0.7, 0.15 and 0.15, and the preset ratio can be adjusted according to actual needs.
[0069] Further, the data of the training set is processed by the sliding window technique. The window width is not limited here. The purpose is to make each input sequence contain the characteristics of the outdoor environment in the previous several second time periods, so as to predict the indoor environment in the next second time period. In addition, the training set also undergoes the above-mentioned preprocessing steps of correcting the data items outside the normal value range according to the first preset interval and normalization processing, which will not be elaborated here.
[0070] The processed training set is input into the training model for training, and the model is tuned with the combined validation set. The size of the data processed in each batch is 32, and the number of training iterations is set to 100 times. By combining the early stopping method, the training is stopped in advance when the loss on the validation set does not decrease. During the training process, the mean squared error is used as the loss function to optimize the accuracy of the model. This loss function is also applicable to the scenario of prediction based on time series. At the same time, the Adam optimizer is used, and its initial learning rate is set to 0.001. The learning rate is appropriately reduced when the performance on the validation set does not improve through the dynamic adjustment strategy, so as to improve the convergence effect of the model.
[0071] After training, the prediction accuracy of the model is verified using the test set. When the prediction accuracy is greater than or equal to the target accuracy rate, it is determined that the training effect of the training model meets the requirements of this embodiment. The target accuracy rate can be set to, for example, 95%, so as to obtain the prediction model, and the step of inputting the second feature data into the prediction model in the embodiment of the present application can be executed.
[0072] It should be noted that although the input and output are designed in the second mode during the training of the prediction model, the prediction model still supports the prediction functions of the first mode or other prediction modes. Outputting the output result with the same specification as the input data is one of the characteristics of this prediction model. Based on this, the prediction model can also support prediction modes with other granularities in addition to the first mode and the second mode.
[0073] By obtaining the training data and the training model for training, a prediction model capable of predicting the indoor environment data in combination with the outdoor environment data is obtained, thereby supporting the implementation of the embodiment of the present application and improving the accuracy of indoor environment prediction.
[0074] Next, in combination with specific application examples, the solution of the embodiment of the present invention will be introduced and described in detail: In the embodiment of the present application, a method for predicting indoor environment data based on outdoor environment data is provided. This method is applied in the field of smart home, and the purpose is to predict the indoor environment data in combination with the outdoor environment data.
[0075] First, obtain the outdoor temperature collected in the outdoor environment and the indoor temperature collected in the indoor environment, define them as two different types of environmental data for storage and processing, and mark them according to the collection time as a timestamp. The data with the same timestamp forms a data vector. For example, at time 13:00, the outdoor temperature , the indoor temperature .
[0076] When the prediction mode is the first mode, set the first time period to 24 hours, calculate the maximum, minimum, and average values of the outdoor temperature within 24 hours before the current moment, and the maximum, minimum, and average values of the indoor temperature, to form the first feature data.
[0077] When the prediction mode is the second mode, set the first time period to 24 hours and the second time period to 1 hour, extract the outdoor temperature and indoor temperature collected at 1-hour intervals within 24 hours before the current moment, to form the first feature data.
[0078] The first preset intervals for both the indoor temperature and the outdoor temperature are , determine whether each outdoor temperature or indoor temperature in the first feature data falls within the first preset interval. When there is a data item that exceeds the first preset interval, correct it to or , select the one closest to its original value for correction. In addition, determine whether there are data items in the first feature data that fall within the second preset interval and . If there are, first mark the data item. Then perform normalization processing on the first feature data so that each data item is converted into a value that falls within the interval, to obtain the second feature data.
[0079] Input the second feature data into the prediction model to obtain the output result of the prediction model. Similarly, determine whether each data item in the output result falls within the first preset interval. When there is a data item that exceeds the first preset interval, correct it. Then determine whether there is a data item that was marked because it fell within the second preset interval in the previous step. When there is, further correct the data item according to the second preset interval and its value before inputting into the prediction model. After processing, perform corresponding annotation and sorting on the output result to obtain the indoor prediction data. When the prediction mode is the first mode, the indoor prediction data includes the maximum, minimum, and average values of the indoor temperature within the next 24 hours. When the prediction mode is the second mode, the indoor prediction data includes the indoor temperature for each hour within the next 24 hours.
[0080] In the embodiments of the present application, environmental data is collected at two collection locations, namely the outdoor environment and the indoor environment. By combining the prediction mode, the first feature data for prediction is screened and determined from the environmental data according to the time stamps of the collection times. The first feature data is preprocessed to obtain the second feature data, and the second feature data is input into the prediction model to obtain the output result of the prediction model. Then, the indoor prediction data is determined and output according to the output result. Compared with the prediction based only on the environmental data collected indoors, the present application combines the environmental data collected in the outdoor environment, enabling the prediction model to make predictions considering the influence of outdoor environmental factors, thereby improving the accuracy of indoor environment prediction. In addition, by designing the prediction mode, both the input data and the output data of the prediction can be screened and changed according to the prediction mode, so as to achieve time-related directional prediction and improve the flexibility of the prediction.
[0081] Please refer to Figure 4 , embodiments of the present application further provide an indoor environment data prediction device based on outdoor environmental data, which can implement the above-mentioned indoor environment data prediction method based on outdoor environmental data. The device includes: A collection module, configured to obtain environmental data. The environmental data is classified into multiple environmental data types according to the collection location and data type. The collection locations include the outdoor environment and the indoor environment, and each piece of data is marked with the corresponding collection time as the time stamp.
[0082] A prediction setting module, configured to determine the prediction mode, and determine the first feature data according to the prediction mode and the environmental data. The prediction mode is used to screen and determine the first feature data from the environmental data according to the time stamp.
[0083] A data processing module, configured to preprocess the first feature data to obtain the preprocessed second feature data.
[0084] A prediction module, configured to input the second feature data into the prediction model to obtain the output result of the prediction model, and determine and output the indoor prediction data according to the output result. The output result matches the prediction mode.
[0085] It can be understood that the content in the above method embodiments is applicable to the device embodiments of the present application. The functions specifically implemented by the device embodiments of the present application are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those in the above method embodiments.
[0086] Embodiments of the present application further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned indoor environment data prediction method based on outdoor environmental data.
[0087] It can be understood that the content in the above method embodiments is applicable to the present storage medium embodiment. The functions specifically implemented by the present storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those in the above method embodiments.
[0088] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0089] The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art will know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0090] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine certain steps, or different steps.
[0091] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and appropriate combinations thereof.
[0093] In the description of this application and the above-mentioned drawings, terms such as "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0094] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or its similar expression refers to any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0095] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above-mentioned unit division is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical or other forms.
[0096] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0097] In addition, in each embodiment of the present application, each functional unit may be integrated into a processing unit, may exist separately physically for each unit, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store programs.
[0099] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings. However, this does not limit the scope of the rights of the embodiments of the present application. Any modification, equivalent replacement, and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall fall within the scope of the rights of the embodiments of the present application.
Claims
1. A method for predicting indoor environmental data based on outdoor environmental data, characterized in that: The method comprises: Acquire environmental data, wherein the environmental data is classified into a plurality of environmental data types according to a collection location and a data type, wherein the collection location includes an outdoor environment and an indoor environment, wherein each data item is marked with a corresponding collection time as a timestamp; Determine a prediction mode, and determine first characteristic data according to the prediction mode and the environmental data, wherein the prediction mode is used to filter and determine the first characteristic data from the environmental data according to the timestamp; Preprocessing the first feature data to obtain preprocessed second feature data; The second characteristic data is input into a prediction model to obtain an output result of the prediction model, and indoor prediction data is determined and output according to the output result, wherein the output result matches the prediction model.
2. The method according to claim 1, characterized in that The prediction mode includes a first mode, and the step of determining first feature data according to the prediction mode and the environmental data includes: When the prediction mode is the first mode, first target data is filtered from the environmental data, and the timestamp of the first target data falls within a first time period before the current moment; The maximum value, the minimum value and the average value of the first target data are calculated, and the first characteristic data includes the maximum value, the minimum value and the average value.
3. The method according to claim 1, characterized in that The prediction mode includes a second mode, and the step of determining the first feature data according to the prediction mode and the environmental data includes: When the prediction mode is the second mode, second target data is screened from the environmental data, the timestamp of the second target data falls within a first time period before the current moment, and each of the timestamps is spaced by a second time period, and the second time period is smaller than the first time period; The second target data is determined to be the first feature data.
4. The method according to claim 1, characterized in that The step of inputting the second feature data into the prediction model comprises: The second feature data is input into an LSTM prediction model, wherein the LSTM prediction model comprises at least an input layer, two LSTM layers, two Dropout layers, a fully connected layer and an output layer.
5. The method according to claim 1, characterized in that The method further comprises: Acquire a training model and training data, wherein the timestamps of the training data are spaced at a second time period; Dividing the training data into a training set, a validation set and a test set according to a preset ratio, and performing sliding window processing and preprocessing on the training set; The training model is trained according to the processed training set, the validation set and the test set to obtain the prediction model.
6. The method according to claim 1, characterized in that Before the step of determining and outputting indoor prediction data according to the output result, the method further includes: For each data item in the output result, a first preset interval is determined according to the environmental data type of the data item, and the data item is corrected according to the first preset interval, where the first preset interval is a normal numerical range corresponding to the environmental data type.
7. The method according to claim 6, characterized in that After the step of determining the first preset interval according to the environmental data type of the data item, the method further includes: Determine third target data in the first feature data that matches the environmental data type of the data item; When the third target data falls within a second preset interval, modifying the data item according to the second preset interval and the third target data, the second preset interval being a sub-interval of the first preset interval; When the third target data does not fall within the second preset interval, the step of correcting the data item according to the first preset interval is performed.
8. The method according to claim 1, characterized in that The step of preprocessing the first feature data to obtain the preprocessed second feature data comprises: For each data item in the first characteristic data, determine a first preset interval according to the environmental data type of the data item, and modify the data item according to the first preset interval, wherein the first preset interval is a normal value range corresponding to the environmental data type; The corrected first feature data is normalized to obtain the second feature data.
9. A device for predicting indoor environmental data based on outdoor environmental data, characterized in that: The device comprises: A collection module, used to obtain environmental data, wherein the environmental data is classified into multiple environmental data types according to the collection location and data type, wherein the collection location includes outdoor environment and indoor environment, wherein each data is marked with a corresponding collection time as a timestamp; A prediction setting module, used to determine a prediction mode, and determine first characteristic data according to the prediction mode and the environmental data, wherein the prediction mode is used to filter and determine the first characteristic data from the environmental data according to the timestamp; A data processing module, used for preprocessing the first characteristic data to obtain preprocessed second characteristic data; The prediction module is used to input the second feature data into a prediction model to obtain an output result of the prediction model, determine and output indoor prediction data based on the output result, and the output result matches the prediction model.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.