Internet of Things equipment traffic prediction method and device, computer equipment and storage medium
By generating and training a training data set based on daily traffic freeze data, using neural networks to predict IoT devices, the problem of low traffic prediction accuracy is solved, and more efficient resource allocation and traffic control is achieved.
Patent Information
- Application Number
- CN202411645682.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-25
AI Technical Summary
The accuracy of IoT device traffic prediction is low, making it difficult to perform reasonable resource allocation and user traffic control.
By obtaining the daily traffic freeze data of multiple IoT devices, multiple training data sets are generated, and these data sets are trained using preset neural networks to obtain a traffic prediction model for traffic prediction.
It improves the accuracy of traffic prediction, solves the problem of low accuracy of traffic prediction of IoT devices, and achieves more reasonable resource allocation and more effective user traffic control.
Smart Images

Figure CN119520412A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to a method and device for predicting flow rate of an Internet of Things device, a computer device and a storage medium. Background Art
[0002] Since the Internet of Things technology was proposed in 1999, it has experienced a rapid development process from conceptual discussion to widespread application. In the early days, the Internet of Things mainly focused on the connectivity between objects. With the advancement of sensor technology, wireless communication technology, and the improvement of big data analysis and cloud computing capabilities, the application scenarios of the Internet of Things have rapidly expanded to smart cities, smart agriculture, smart homes and other fields. In this process, data management and analysis have become key links, especially the effective processing and utilization of massive data generated by IoT devices to achieve goals such as resource optimization, fault prediction and proactive maintenance. As a key component for devices to connect to the network, the prediction of traffic consumption of IoT cards is not only related to cost control, but also an important means to ensure service quality and optimize network resource allocation.
[0003] At present, due to the continuous growth of IoT card traffic and the differences between different services, traffic prediction is needed as a support, but the accuracy of traffic prediction in related technologies is low, which makes it difficult to make reasonable resource allocation and is not conducive to user traffic control. Therefore, how to improve the accuracy of traffic prediction is an urgent problem to be solved. Summary of the invention
[0004] In view of this, the present invention provides a method, apparatus, computer equipment and storage medium for predicting traffic flow of an Internet of Things device to solve the problem of low accuracy in predicting traffic flow of an Internet of Things device.
[0005] In a first aspect, the present invention provides a method for predicting traffic flow of an Internet of Things device, the method comprising:
[0006] Obtain daily traffic frozen data of multiple IoT devices, and store the daily traffic frozen data in the form of message fields in date order and corresponding to the characteristics of each IoT device;
[0007] Generate multiple training data sets based on daily traffic freezing data; the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic multiplier of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data;
[0008] Training a preset neural network based on multiple training data sets to obtain a model parameter file and an open neural network exchange format file corresponding to the neural network;
[0009] Setting a preset neural network based on a model parameter file and an open neural network exchange format file to obtain a traffic prediction model;
[0010] The traffic consumption of each IoT device is predicted based on the actual input data set and traffic prediction model acquired in advance.
[0011] The method for predicting the flow of Internet of Things devices provided by the present invention generates multiple training data sets based on daily flow freezing data, and trains a preset neural network through the multiple training data sets, thereby finally obtaining a flow prediction model; based on the pre-acquired input data set and the flow prediction model, the consumption flow of each Internet of Things device is predicted, and when generating multiple training data sets based on the daily flow freezing data, the short-term correlation and long-term trend of the network flow data are comprehensively considered, and the characteristic correlation of the network flow data in the time series is captured, and the flow prediction scheme is greatly optimized through the neural network, the accuracy of the flow prediction is improved, and the problem of low accuracy of flow prediction of Internet of Things devices is solved.
[0012] In an optional implementation, generating multiple training data sets based on daily flow frozen data includes:
[0013] Extract the date, IoT device features, and holiday information of the day from the daily traffic freeze data;
[0014] Calculate the sum of all message lengths of each IoT device on that day based on the message fields corresponding to the daily traffic freeze data;
[0015] Calculate the approximate traffic rate of IoT device characteristics based on IoT device characteristics, and use the approximate traffic rate of IoT device characteristics to represent the impact on the traffic consumption of IoT devices on the day;
[0016] Calculate the holiday traffic multiplier based on the holiday information of the day;
[0017] The set consisting of date, IoT device features, holiday information of the day, approximate traffic ratio of IoT device features, the sum of all message lengths of each IoT device on the day, and the holiday traffic ratio of the day is used as a training data set.
[0018] In the method for predicting the flow rate of an Internet of Things device provided by the present invention, the features used in the neural network training can only be digital. Therefore, a set consisting of the date, the characteristics of the Internet of Things device, the holiday information of the day, the approximate flow rate of the characteristics of the Internet of Things device, the sum of the lengths of all messages of each Internet of Things device on the day, and the holiday flow rate of the day is used as a training data set, thereby achieving the purpose of converting the non-digital features of the daily flow frozen data into digital features, which is conducive to the training of the neural network.
[0019] In an optional implementation, calculating the sum of all message lengths of each IoT device on that day based on the message field corresponding to the daily traffic freezing data includes:
[0020] Extract all message fields in the daily traffic frozen data; the message fields include fixed-length fields and variable-length fields;
[0021] When the message field is a fixed-length field, a mapping table between the fixed-length field and the number of bytes is established based on different communication protocols. The number of bytes of the field is obtained by querying the mapping table, and the number of bytes of all fixed-length fields is added together to obtain the sum of all message lengths of each IoT device on that day.
[0022] When the message field is a variable-length field, a weight is set for the number of bytes in the variable-length field according to the time sequence, the weighted median of the number of bytes in the variable-length field is calculated based on the weight, and the weighted medians of all fields are added together to obtain the sum of all message lengths of each IoT device on that day.
[0023] The method for predicting the flow of Internet of Things devices provided by the present invention adopts a preset mapping table method and a weighted median calculation method to obtain the sum of the message lengths according to the message field type, thereby realizing the calculation of the message lengths and providing conditions for the formation of a training data set.
[0024] In an optional implementation, calculating the approximate flow rate of the IoT device characteristics based on the IoT device characteristics includes:
[0025] The IoT device features are classified according to the device type, device installation location, and device user information, and the daily traffic consumption of the corresponding feature classification is obtained; the daily traffic consumption of the corresponding feature classification is expressed as:
[0026] X={x1,x2,…,x n};
[0027] Among them, X is the daily consumption flow set corresponding to features 1 to n, x1, x2, ..., x n They are the daily consumption flows corresponding to features 1 to n;
[0028] Assign weights to each IoT device feature in date order. The weighting principle is that the weight of distant dates is low and the weight of recent dates is high. The weight of each IoT device feature is used to calculate the daily traffic consumption based on the corresponding IoT device feature classification.
[0029] The median value of the daily traffic consumption of the corresponding IoT device characteristics is obtained, and the median value is used as the daily median of the corresponding characteristic classification. The daily traffic consumption of all IoT device characteristics is weighted and summed, and the median value of the weighted sum is taken as the total daily median. The formula for weighted sum of the daily traffic consumption of all IoT device characteristics is expressed as follows:
[0030]
[0031] Among them, c i is the weighted sum value, w j The traffic weight consumed on the day for each feature, wb j is the cardinality of the daily traffic consumption of each feature, and WA is the sum of the cardinality of all features. wb i =wb j ;
[0032] The approximate feature traffic multiplier corresponding to each feature category in the IoT device features is calculated based on the total daily median and the corresponding feature category daily median.
[0033] In an optional implementation, the characteristic approximate flow rate corresponding to the characteristic classification also includes the characteristic approximate flow rate of the holiday of the day; and calculating the holiday flow rate of the day based on the holiday information of the day includes:
[0034] Classify the holiday information of the day according to the preset holiday attributes;
[0035] Get the multiplier coefficient for the corresponding holiday category on the day;
[0036] The holiday traffic multiplier for the day is calculated based on the approximate traffic multiplier with holiday characteristics and the multiplier coefficient for the day.
[0037] The method for predicting the flow rate of an Internet of Things device provided by the present invention realizes quantitative analysis of the daily flow rate by expressing the influence of the flow rate consumed by the Internet of Things device on the same day through the characteristic approximate flow rate multiplier and expressing the holiday flow rate through the holiday flow rate multiplier of the same day.
[0038] In an optional implementation, a preset neural network is trained based on multiple training data sets to obtain an open neural network exchange format file corresponding to the model parameter file and the neural network, including:
[0039] Set a sliding window, start from the first data item of the training data set and slide one sliding window at a time to obtain a sliding window data set;
[0040] The last three items of data in the sliding window data set are discarded, the remaining data are used as the input data set, and the daily traffic consumption of the device corresponding to the last three items of data in the sliding window data set is obtained as the output data set;
[0041] The input data set is used as input, the output data set is used as the result and the mean square error is used as the loss function to train the preset neural network, obtain the model parameter file, and save the structure of the preset neural network as an open neural network exchange format file.
[0042] In an optional implementation, the input data set is represented as:
[0043] Iw=((a11,a12,…,a1n),(a21,a22,…,a2n),…,(aw-31,aw-32,…,aw-3n));
[0044] Wherein, axn is the traffic consumption of the x-th IoT device on that day, n = 1, 2, ...; aw-31, aw-32, ..., aw-3n are the traffic consumption of the IoT device on that day with the last three items of data in the sliding window data set discarded;
[0045] The output dataset is represented as:
[0046] Ow=(aw-2n,aw-1n,awn);
[0047] Among them, Ow is the daily traffic consumption of the IoT device of the last three data of the sliding window data set, and the daily traffic consumption of the IoT device is the daily traffic consumption of all IoT device features.
[0048] The method for predicting the flow of Internet of Things devices provided by the present invention sets a sliding window and extracts an input data set and an output data set from a training data set, trains a neural network through the input data set and the output data set, considers both the short-term correlation and the long-term trend of the network flow data during retraining, captures the feature correlation of the network flow data in time series, and improves the training accuracy of the neural network.
[0049] In an optional implementation, the method for predicting traffic flow of IoT devices further includes:
[0050] Obtain the predicted traffic consumption amount and current remaining traffic amount of each IoT device;
[0051] Calculate the predicted remaining amount based on the predicted amount of traffic consumed by each IoT device and the current remaining amount of traffic;
[0052] When the predicted remaining amount is less than the preset alarm threshold, an alarm notification is generated.
[0053] The IoT device traffic prediction method provided by the present invention monitors the various storage data of the target IoT card in real time, and automatically generates and sends warning information based on the monitoring results, thereby effectively reducing the manual time spent on actively querying the usage status of the target IoT card, thereby improving the use efficiency and intelligence level of the IoT card.
[0054] In an optional implementation, the method for predicting traffic flow of IoT devices further includes:
[0055] Regularly obtain new daily traffic frozen data of multiple IoT devices, and generate multiple new training data sets based on the new daily traffic frozen data, retrain the preset neural network through the new training data sets, and obtain a new model parameter file and a new open neural network exchange format file;
[0056] The hot reload mechanism is used to load the new model parameter file and the new open neural network exchange format file to set the neural network and obtain a new traffic prediction model.
[0057] The method for predicting the flow of IoT devices provided by the present invention periodically obtains new daily flow frozen data of multiple IoT devices, generates multiple new training data sets based on the new daily flow frozen data, retrains the preset neural network through the new training data sets, and obtains a new model parameter file and a new open neural network exchange format file; adopts a hot overload mechanism to load the new model parameter file and the new open neural network exchange format file to set the neural network, and obtains a new flow prediction model, thereby achieving the purpose of automatically updating the model parameter file and the open neural network exchange format file, and improving the prediction precision and prediction accuracy of the flow prediction model.
[0058] In a second aspect, the present invention provides an IoT device traffic prediction device, the device comprising:
[0059] A data acquisition module is used to acquire daily traffic frozen data of multiple IoT devices; the daily traffic frozen data is stored in the form of message fields in date order and corresponding to the characteristics of each IoT device;
[0060] A training data set generation module is used to generate multiple training data sets based on daily traffic freezing data; the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic multiplier of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data;
[0061] A training module, used to train a preset neural network based on multiple training data sets to obtain an open neural network exchange format corresponding to a model parameter file and a neural network;
[0062] A traffic prediction model building module is used to set a neural network based on a model parameter file and an open neural network exchange format to obtain a traffic prediction model;
[0063] The traffic prediction module is used to predict the consumption traffic of each IoT device based on the pre-acquired input data set and the traffic prediction model.
[0064] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the Internet of Things device traffic prediction method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0065] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for predicting traffic flow of an Internet of Things device according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0067] Figure 1 is a flow chart of a method for predicting traffic flow of an Internet of Things device according to an embodiment of the present invention;
[0068] Figure 2 is a flow chart of another method for predicting traffic flow of IoT devices according to an embodiment of the present invention;
[0069] Figure 3 is a flow chart of another method for predicting traffic flow of IoT devices according to an embodiment of the present invention;
[0070] Figure 4 is a structural block diagram of a device for predicting traffic flow of an Internet of Things device according to an embodiment of the present invention;
[0071] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0073] According to an embodiment of the present invention, an embodiment of a method for predicting traffic of an Internet of Things device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0074] In this embodiment, a method for predicting traffic flow of an Internet of Things device is provided, which can be used for an Internet of Things device, such as an Internet of Things card. Figure 1 is a flow chart of a method for predicting traffic of an IoT device according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0075] Step S101, obtaining daily traffic frozen data of multiple IoT devices, and storing the daily traffic frozen data in the form of message fields in date order and corresponding to the characteristics of each IoT device.
[0076] Specifically, multiple IoT devices in this embodiment are connected to the monitoring center. When the IoT devices communicate with the monitoring center, each IoT device reports its own daily traffic freezing data.
[0077] The data storage method for the characteristic daily traffic freezing of each IoT device is shown in Table 1 below:
[0078] Table 1 Daily flow freezing data
[0079] date Freeze traffic for the day Daily top-up Traffic consumption on the day 2024-11-05 1000 100 / 2024-11-06 1024 0 |1024-1000-0|=24
[0080] Traffic consumed on the day = |traffic frozen on the day – traffic frozen yesterday – traffic recharged on the day|.
[0081] Step S102, generating multiple training data sets based on the daily traffic freezing data, the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic multiplier of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data.
[0082] Specifically, in order to represent the daily traffic situation, the approximate traffic multiplier of the characteristics of the IoT device is also calculated to represent the impact on the traffic consumption of the IoT device on that day. The date, IoT device type, IoT device installation location, the sum of all message lengths of the IoT device on that day, holiday information on that day (holiday information is calculated based on the national statutory date), device user information and the approximate traffic multiplier of the characteristics of the IoT device constitute a training data set, that is, the training data set is a set consisting of the date, IoT device characteristics, holiday information on that day, approximate traffic multiplier of the characteristics of the IoT device, the sum of all message lengths of each IoT device on that day and the holiday traffic multiplier on that day obtained based on the daily traffic freezing data.
[0083] Step S103, training the preset neural network based on multiple training data sets to obtain a model parameter file and an open neural network exchange format file corresponding to the neural network.
[0084] Specifically, the model parameter file includes the training data set and the output data set after the neural network is trained. The Open Neural Network Exchange (ONNX) format is a model file format that provides an intermediate bridge between model training and model reasoning, so that different upstream training frameworks can export models in the ONNX format.
[0085] The input data set and the output data set are extracted from the training data set to train the neural network, and the model parameter file and the open neural network exchange format file corresponding to the neural network are obtained.
[0086] Step S104, setting a preset neural network based on the model parameter file and the open neural network exchange format file to obtain a traffic prediction model.
[0087] Specifically, the preset neural network can be formed by an LSTM layer (Long Short-Term Memory) plus a fully connected layer. The neural network is set according to the model parameter file and the open neural network exchange format file to finally obtain the traffic prediction model.
[0088] Step S105: predicting the traffic consumption of each IoT device based on the actual input data set and the traffic prediction model acquired in advance.
[0089] Specifically, the actual input data set obtained in advance can be a data set consisting of data such as the date, device type, device installation location, the sum of all message lengths of the device on that day, holiday information on that day, device user information, and device traffic consumption on that day extracted from the daily traffic freezing data of each IoT device within a certain period of time. The actual input data set obtained in advance is input into the traffic prediction model to predict the traffic consumption of each IoT device. When predicting, the prediction period can be set, for example, predicting the traffic consumption of each IoT device for three days today, tomorrow, and the day after tomorrow.
[0090] The method for predicting the traffic of an IoT device provided in this embodiment generates multiple training data sets based on daily traffic frozen data, and trains a preset neural network through the multiple training data sets, thereby finally obtaining a traffic prediction model; the traffic consumption of each IoT device is predicted based on a pre-acquired input data set and a traffic prediction model, and when generating multiple training data sets based on daily traffic frozen data, the short-term correlation and long-term trend of the network traffic data are comprehensively considered, and the feature correlation of the network traffic data in the time series is captured, and the traffic prediction scheme is greatly optimized through the neural network, thereby improving the accuracy of traffic prediction and solving the problem of low accuracy of traffic prediction of IoT devices.
[0091] In this embodiment, a method for predicting traffic flow of an Internet of Things device is provided, which can be used for Internet of Things devices, such as Internet of Things cards, etc. Figure 2 is a flow chart of a method for predicting traffic of an IoT device according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0092] Step S201, obtain the daily traffic frozen data of multiple IoT devices, and store the daily traffic frozen data in the form of message fields in date order and corresponding to the characteristics of each IoT device. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0093] Step S202, generating multiple training data sets based on the daily traffic freezing data, the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic multiplier of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data.
[0094] Specifically, the above step S202 includes:
[0095] Step S2021, extracting the date, IoT device features and holiday information of the day from the daily traffic freeze data.
[0096] Specifically, the characteristics of IoT devices include the type of IoT device, the installation location of IoT devices, and the user information of IoT devices. Based on the daily traffic freezing data, data such as date, type of IoT device, installation location of IoT device, user information of IoT device, holiday information of the day, and traffic consumption of IoT devices on the day are obtained. The date needs to be converted into the number of days since the Unix epoch, that is, the date is represented by a timestamp with an accuracy of one day. The characteristic approximate traffic multiplier of the characteristics of IoT devices can be used to represent the impact on the traffic consumption of IoT devices on the day.
[0097] Step S2022, based on the message field corresponding to the daily traffic freezing data, calculate the sum of all message lengths of each IoT device on that day.
[0098] Specifically, the message field is extracted from the daily traffic freezing data, and the number of bytes occupied by the message field in the message, that is, the message length, is inferred according to the message field.
[0099] In some optional implementations, the above step S2022 includes:
[0100] Step a1, extracting all message fields in the daily traffic freezing data; the message fields include fixed-length fields and variable-length fields.
[0101] Specifically, fixed-length fields include integer, floating-point, and fixed-length character strings. When a message is sent using a fixed-length field, the number of bytes occupied remains substantially unchanged.
[0102] Variable-length fields include variable-length strings and arrays, and the number of data bytes in a variable-length field may change.
[0103] Step a2, when the message field is a fixed-length field, a mapping table between the fixed-length field and the number of bytes is established based on different communication protocols, the number of bytes of the field is obtained by querying the mapping table, and the number of bytes of all fixed-length fields is added together to obtain the sum of all message lengths of each IoT device on that day.
[0104] Specifically, a mapping table between the fixed-length field type and the number of bytes can be directly established for the fixed-length field according to the communication protocol. The number of bytes used by the field can be directly obtained through the table lookup method. The number of bytes of all fixed-length fields can be added together to obtain the sum of all message lengths of each IoT device on that day.
[0105] Step a3, when the message field is a variable-length field, a weight is set for the number of bytes in the variable-length field according to the time sequence, the weighted median of the number of bytes in the variable-length field is calculated based on the weight, and the weighted medians of all fields are added together to obtain the sum of all message lengths of each IoT device on that day.
[0106] Specifically, the number of bytes of a variable-length field is difficult to calculate accurately, and in this embodiment, it is estimated by historical data. First, all variable-length fields of the same IoT device type and the same message type (such as daily frozen reporting data of all the same model meters) are taken to calculate the number of bytes occupied by the variable-length fields in each message. Then, according to the distance of the time from the current time, weights are set for all data (number of bytes occupied by the field). The longer the data, the lower the weight, and the data within 1 week has the highest weight; the weighted median of all byte numbers is calculated based on the weights as the estimated number of bytes occupied by the variable-length field. The weighted medians of all fields are added to obtain the sum of all message lengths of each IoT device on that day. It should be noted that when the message field has both fixed-length fields and variable-length fields, the sum of the message lengths of the fixed-length fields and the sum of the message lengths of the variable-length fields are calculated respectively according to step a2 and step a3, and finally the sum of the message lengths of the fixed-length fields and the sum of the message lengths of the variable-length fields are added to obtain the sum of the message lengths of the final message field.
[0107] The number of bytes outside the data part of the communication protocol of the IoT device needs to be determined by establishing a table based on different communication protocols, and the byte value can be directly obtained using the table lookup method.
[0108] The IoT device traffic prediction method provided in this embodiment obtains the sum of message lengths by using a preset mapping table method and a weighted median calculation method according to the message field type, thereby realizing the calculation of message lengths and providing conditions for the formation of a training data set.
[0109] Step S2023, calculate the approximate traffic multiplier of the IoT device characteristics based on the IoT device characteristics, and express the impact of the approximate traffic multiplier of the IoT device characteristics on the traffic consumption of the IoT device on that day.
[0110] Specifically, some features used in neural network training are not numbers (such as device type), and the only features that can be used in neural networks are numbers, so a method is needed to convert non-numeric features into numbers. Therefore, the IoT device features are converted into feature approximate traffic multipliers to indicate the impact on the traffic consumption of IoT devices on the day.
[0111] In some optional implementations, the above step S2023 includes:
[0112] Step b1, classify the IoT device features according to the device type, device installation location and device user information, and obtain the daily consumption flow of the corresponding feature classification. The daily consumption flow of the corresponding feature classification is expressed as:
[0113] X={x1,x2,…,x n};
[0114] Among them, X is the daily consumption flow set corresponding to features 1 to n, x1, x2, ..., x n They are the daily consumption flows corresponding to features 1 to n respectively.
[0115] Specifically, IoT device features are classified into device type, device installation location, and device user information. For example, based on the device installation location classification, the smallest unit (village or equivalent unit) in the same administrative district is considered as one category. Device user information is classified according to the primary key ID of the different user databases of the device.
[0116] According to each characteristic classification of the IoT characteristics, the daily traffic consumption of the device type, the daily traffic consumption of the device installation location, and the daily traffic consumption of the device user information are obtained respectively.
[0117] Step b2, assign weights to each IoT device feature in date order, with the weight assignment principle being low weights for distant dates and high weights for recent dates, and calculate the daily traffic consumption of the corresponding feature category based on the weight of each IoT device feature.
[0118] For example, (1) obtain the daily traffic consumption data required by all IoT device features, sort them in ascending order of traffic, and record them as X = {x1, x2, ..., x n}, where each item is a daily traffic consumption data (the corresponding date needs to be recorded to facilitate the subsequent weight allocation);
[0119] (2) Assign the weight of the traffic corresponding to each IoT device feature according to the date. The calculation method is as follows:
[0120] a) Calculate the weight cardinality of each data item. The calculation method is to allocate it according to the date. The cardinality of recent dates is high, and the cardinality of distant dates is low (for example, within 3 days is 10, 10-3 days is 5, and more than 10 days is 1. The specific rules are adjusted according to the actual situation). Each x i The corresponding cardinality is wb i ;
[0121] b) Calculate the sum of the cardinality
[0122] c) Calculate weights
[0123] Step b3, obtain the median value of the daily traffic consumption of the corresponding IoT device characteristics, and use the median value as the daily median of the corresponding characteristic classification, perform weighted summation of the daily traffic consumption of all IoT device characteristics, and take the median value of the weighted summation as the total daily median. The formula for weighted summation of the daily traffic consumption of all IoT device characteristics is as follows:
[0124]
[0125] Among them, c i is the weighted sum value, w j The traffic weight consumed on the day for each feature, wb j is the cardinality of the daily traffic consumption of each feature, and WA is the sum of the cardinality of all features. wb i =wb j .
[0126] Specifically, the sum of the daily traffic consumption of the device type, the daily traffic consumption of the device installation location, and the daily traffic consumption of the device user information is calculated, and the weighted median of the traffic sum of the daily traffic consumption is calculated and recorded as the total median.
[0127] Calculate the weighted median of the traffic consumed by the device type on the day, and record it as the device type daily median.
[0128] Calculate the weighted median of the traffic consumption on the day at the device installation location, and record it as the daily median of the device installation location.
[0129] Calculate the weighted median of the traffic consumption of the device user information on the day, and record it as the device user information daily median.
[0130] For example, let 0.5 be the median value of the daily traffic consumption of the corresponding IoT device feature, and obtain the first c that exceeds the median value 0.5 in the weighted sum. i , which corresponds to the daily consumption flow x i This is the weighted median.
[0131] Step b4, calculating the feature approximate flow rate corresponding to each feature category in the IoT device features based on the total daily median and the corresponding feature category daily median.
[0132] Specifically, for each feature category, calculate the feature category approximate flow rate multiplier = feature category daily median / total daily median. Specifically:
[0133] Approximate traffic ratio of device type = daily median of device type / total daily median.
[0134] Approximate flow rate ratio of equipment installation location = daily median of equipment installation location / total daily median.
[0135] Approximate traffic ratio of device user information = daily median of device user information / total daily median.
[0136] The impact on the daily traffic consumption of IoT devices is expressed by the sum of the approximate traffic multiplier of the device type, the approximate traffic multiplier of the device installation location, and the approximate traffic multiplier of the device user information.
[0137] Step S2024, calculating the holiday traffic multiplier for the current day based on the holiday information for the current day.
[0138] In some optional implementations, the characteristic approximate flow rate corresponding to the characteristic classification also includes the characteristic approximate flow rate of the holiday on the day. The above step S2024 includes:
[0139] Step c1, classifying the holiday information of the day according to the preset holiday attributes.
[0140] Specifically, holidays are divided into working days (all working days stipulated by law, and Saturdays are considered working days during non-Spring Festival holidays), single-day off (the day is a non-working day, and the previous and following days are working days), short holidays (non-working days for ≥2 days and ≤3 days in a row), short holidays (non-working days for ≥4 days and ≤5 days in a row), and long holidays (the rest, such as holidays that are longer than usual rest days, ≥5 days in a row).
[0141] Step c2, obtaining the multiplier coefficient for the corresponding holiday category on the day.
[0142] Specifically, the corresponding daily multiplier coefficient is obtained according to the holiday classification, which is as follows:
[0143] a) Working day: the multiplier factor for that day is 1;
[0144] b) For non-working days, the multiplier factor for that day is calculated by the following steps:
[0145] i) Calculate the number of consecutive non-working days N: a single weekend day is 1, and short holidays, short long holidays, and long holidays are calculated based on actual conditions. For example, N for the Qingming Festival in 2024 is 2 (note that April 6, 2024 is a Saturday. Although it is a legal day off, it should be counted as a working day);
[0146] ii) Get the number of days that the current date is a non-working day, set to n, the first day is recorded as n = 0, the second day is recorded as n = 1, and so on: taking the Qingming Festival in 2024 as an example, April 4, 2024, n = 0, April 5, 2024, n = 1;
[0147] iii) The multiplier factor for the day = (2(Nn)-1) / N.
[0148] Step c3, calculating the holiday traffic rate of the day based on the approximate traffic rate of the holiday characteristics of the day and the traffic rate coefficient of the day.
[0149] Specifically, the holiday traffic rate of the day = the holiday characteristic approximate traffic rate of the day * the rate coefficient of the day.
[0150] The IoT device traffic prediction method provided in this embodiment realizes quantitative analysis of daily traffic by expressing the impact of feature approximate traffic ratio on daily traffic and expressing holiday traffic by the holiday traffic ratio of the same day.
[0151] Step S2025, the set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic ratio of IoT device characteristics, the sum of all message lengths of each IoT device on the day and the holiday traffic ratio of the day is used as a training data set.
[0152] Specifically, the training data set is represented as: A = ((a11, a12, ..., a1n), (a21, a22, ..., a2n), ...), where axn is the traffic consumption of the x-th IoT device on that day, and the rest are the IoT device type, device installation location, device user information, holiday information on that day, traffic consumption of the IoT device on that day, the sum of all message lengths of each IoT device on that day, and the approximate traffic multiplier of the IoT device characteristics. The data in the training data set are sorted in ascending order by date.
[0153] It should be noted that data such as date, IoT device characteristics, holiday information of the day, the sum of all message lengths of each IoT device on the day, approximate traffic multiples of IoT device characteristics, and holiday traffic multiples of the day are cleaned to remove incomplete data in the data fields.
[0154] Step S203: Train the preset neural network based on multiple training data sets to obtain a model parameter file and an open neural network exchange format file corresponding to the neural network. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0155] Step S204: Set a preset neural network based on the model parameter file and the open neural network exchange format file to obtain a traffic prediction model. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0156] Step S205: predict the traffic consumption of each IoT device based on the actual input data set and traffic prediction model acquired in advance. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0157] In the method for predicting the traffic of an IoT device provided in this embodiment, only digital features can be used in the training of the neural network. Therefore, a set consisting of the date, the features of the IoT device, the holiday information of the day, the traffic consumed by the IoT device on the day, the sum of the lengths of all messages of each IoT device on the day, the approximate traffic multiplier of the features of the IoT device, and the traffic multiplier of the holiday on the day is used as a training data set, thereby achieving the purpose of converting the non-digital features of the daily traffic freezing data into digital features, which is beneficial to the training of the neural network.
[0158] In this embodiment, a method for predicting traffic flow of an Internet of Things device is provided, which can be used for Internet of Things devices, such as Internet of Things cards, etc. Figure 3 is a flow chart of a method for predicting traffic of an IoT device according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0159] Step S301, obtain the daily traffic frozen data of multiple IoT devices, and store the daily traffic frozen data in the form of message fields in date order and corresponding to the characteristics of each IoT device. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0160] Step S302: Generate multiple training data sets based on the daily traffic frozen data. The training data sets are a set consisting of the date, IoT device features, holiday information of the day, IoT device feature approximate traffic multiples, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiples of the day obtained based on the daily traffic frozen data. For details, please refer to Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0161] Step S303, training the preset neural network based on multiple training data sets to obtain a model parameter file and an open neural network exchange format file corresponding to the neural network.
[0162] Specifically, the above step S303 includes:
[0163] Step S3031, setting a sliding window, sliding a sliding window each time starting from the first data item of the training data set, to obtain a sliding window data set.
[0164] Specifically, a sliding window is set with a window size of s (s>3), and the training data set A is processed by sliding one window each time starting from the first data item to obtain the sliding window data set Ww=((a11,a12,…,a1n),(a21,a22,…,a2n),…,(aw1,aw2,…,awn)).
[0165] Step S3032, discard the last three items of data in the sliding window data set, use the remaining data as the input data set, and obtain the daily consumption flow of the device corresponding to the last three items of data in the sliding window data set as the output data set.
[0166] Specifically, the last three items of the sliding window data set are discarded to form a training input data Iw = ((a11, a12, ..., a1n), (a21, a22, ..., a2n), ..., (aw-31, aw-32, ..., aw-3n)).
[0167] The daily traffic consumption of the device of the last three items of the sliding window data set is taken to form an output data Ow = (aw-2n, aw-1n, awn).
[0168] Step S3033, taking the input data set as input, taking the output data set as result and using mean square error as loss function to train the preset neural network, obtaining a model parameter file, and saving the structure of the preset neural network as an open neural network exchange format file.
[0169] Specifically, all input data generated in step S3032 are taken to form an input data set I = (I1, I2, ..., Iw); all output data are taken to form an output data set O = (O1, O2, ..., Ow).
[0170] Use an LSTM layer plus a fully connected layer to form a neural network, use mean square error as the loss function, and use the Adam optimizer (Adam optimizer is an adaptive optimization algorithm) to optimize the parameters and train the neural network. Save the final generated model parameter file and save the neural network structure in the Open Neural Network Exchange format (ONNX).
[0171] Step S304: Set a preset neural network based on the model parameter file and the open neural network exchange format file to obtain a traffic prediction model. Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0172] Step S305: predicting the traffic consumption of each IoT device based on the actual input data set and the traffic prediction model acquired in advance.
[0173] Specifically, for each IoT device, take the daily frozen traffic data within a certain period of time up to yesterday (for example, take data within one month), and for daily data, take the date, device type, device installation location, the sum of all message lengths of the device on that day, the holiday information of the day, the holiday traffic multiplier of the day, the device user information and the traffic consumed by the device on that day (the specific calculation method is as shown in step S2023) to form an actual input data set.
[0174] The actual input data set is grouped according to the IoT devices. For each IoT device, the actual input data set is input into the traffic prediction model, so that the traffic prediction model generates consumption traffic prediction data for the next three days (i.e., today, tomorrow, and the day after tomorrow).
[0175] Step S306, obtaining the predicted traffic consumption amount and the current remaining traffic amount of each IoT device; calculating the predicted remaining amount based on the predicted traffic consumption amount and the current remaining traffic amount of each IoT device; when the predicted remaining amount is less than the preset alarm threshold, generating an alarm notification.
[0176] Specifically, the alarm notification includes but is not limited to email, SMS, Feishu push, etc. It is sent to the traffic card administrator through email, SMS, Feishu reminder, etc. to remind him to take timely action. After receiving the report, the traffic card administrator confirms and handles the traffic card that may be in arrears according to the handling methods of different situations.
[0177] Step S307, regularly obtain new daily traffic freezing data of multiple IoT devices, and generate multiple new training data sets based on the new daily traffic freezing data, retrain the preset neural network through the new training data sets to obtain a new model parameter file and a new open neural network exchange format file; use the hot overload mechanism to load the new model parameter file and the new open neural network exchange format file to set the neural network, and obtain a new traffic prediction model.
[0178] Specifically, in order to ensure that the parameters of the traffic prediction model can adapt to changes in the situation, the neural network will be retrained regularly. Multiple new training data sets are generated by regularly obtaining new daily traffic freezing data of multiple IoT devices, and the preset neural network is retrained with the new training data sets to obtain a new model parameter file and a new open neural network exchange format file; when predicting, a hot overload mechanism is used to load the new model parameter file and the new open neural network exchange format file to set the neural network, and a new traffic prediction model is obtained. The new traffic prediction model is used to test the consumption traffic of each IoT device, thereby improving the prediction precision and accuracy. The calculation process of the new training data set is shown in step S202. It will not be repeated here.
[0179] The method for predicting the flow of IoT devices provided in this embodiment sets a sliding window and extracts an input data set and an output data set from a training data set, trains a neural network through the input data set and the output data set, and considers both the short-term correlation and long-term trend of network flow data during retraining, captures the characteristic correlation of network flow data in time series, and improves the training accuracy of the neural network. Through real-time monitoring of various storage data of the target IoT card, the monitoring results are automatically generated and early warning information is sent, thereby effectively reducing the time spent by humans to actively query the usage of the target IoT card, improving the efficiency and intelligence level of the IoT card, and automatically updating the flow prediction model, thereby improving the prediction accuracy and prediction accuracy of the flow prediction model.
[0180] As one or more specific application embodiments of the embodiments of the present invention, the IoT device traffic prediction method provided by the present invention is further described in detail in combination with the traffic prediction of a specific date, as follows:
[0181] 1. Suppose that the traffic consumption of a certain device is predicted, the sliding window size during network training is 10, the current date is 2024.11.1, and the traffic consumption of 2024.11.1, 2024.11.2, and 2024.11.3 needs to be predicted.
[0182] 2. Obtain the daily frozen traffic data of IoT devices in the past 10 days and extract the traffic consumed on that day (the calculation method is as follows Figure 1 , Figure 2 or Figure 3 The corresponding specific embodiments are not described here in detail), as shown in Table 2 below:
[0183] Table 2 Traffic consumption of IoT devices in the past 10 days
[0184] date Consume data 2024-10-31 x10 2024-10-30 x9 2024-10-29 x8 2024-10-28 x7 2024-10-27 x6 2024-10-26 x5 2024-10-25 x4 2024-10-24 x3 2024-10-23 x2 2024-10-22 x1
[0185] 3. Determination of working days or holiday dates, as shown in Table 3 below (date type is determined based on date judgment, and the current day multiplier is calculated based on the date type, see step S2024 in the specific embodiment, which will not be repeated here):
[0186] Table 3 Working days or holiday dates
[0187] date Timestamp Date Type Traffic rate for the day 2024-10-31 20027 Working Days 1 2024-10-30 20026 Working Days 1 2024-10-29 20025 Working Days 1 2024-10-28 20024 Working Days 1 2024-10-27 20023 Single day off 1 2024-10-26 20022 Working Days 1 2024-10-25 20021 Working Days 1 2024-10-24 20020 Working Days 1 2024-10-23 20019 Working Days 1 2024-10-22 20018 Working Days 1
[0188] 4. IoT device type: query the IoT device file and get the initial IoT device type as an electric energy meter. Look up the table (the corresponding table of characteristic approximate flow rate calculated when training the network, the same below) and get the characteristic approximate flow rate as 1.01.
[0189] 5. IoT device installation location: Query the IoT device file and obtain that the IoT device installation location is village xx. Look up Table 3 and get the characteristic approximate flow rate multiplier as 1.1.
[0190] 6. The sum of all message lengths of IoT devices on that day: Query the IoT device archive. The product freezes reported messages for only one day every day. The sum of the calculated message lengths is 100.
[0191] 7. Holiday information for the day: The traffic multiplier for the day as shown in Table 2.
[0192] 8. IoT device user information: By querying the IoT device file, the registered user of the IoT device is xyz, and the characteristic approximate flow rate is 0.8.
[0193] 9. Form a training data set: X = ((20018, 1.01, 1.1, 100, 1, 0.8, x1), (20019, 1.01, 1.1, 100, 1, 0.8, x2), …, (20027, 1.01, 1.1, 100, 1, 0.8, x10));
[0194] 10. Load the neural network parameter file and initialize the neural network.
[0195] 11. Input the training data set X into the neural network and get the output (x11, x12, x13), which correspond to the predicted traffic consumption on 2024.11.1, 2024.11.2, and 2024.11.3 respectively.
[0196] The method for predicting the flow of IoT devices provided in this embodiment comprehensively considers the short-term correlation and long-term trend of network flow data when generating multiple training data sets based on daily flow freezing data, captures the characteristic correlation of network flow data in time series, and greatly optimizes the flow prediction scheme through neural networks, improves the accuracy of flow prediction, and solves the problem of low accuracy of flow prediction of IoT devices. After the prediction of all IoT devices is completed, all devices, flow cards and predicted remaining balances with predicted remaining balances less than the threshold set by the system are taken out to form a flow prediction analysis report, which is sent to the flow card administrator through email, SMS, Feishu reminder and other means to remind him to operate in time, improve service quality and better control costs.
[0197] In this embodiment, a device for predicting traffic flow of an Internet of Things device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0198] This embodiment provides a device for predicting traffic flow of an Internet of Things device. Figure 4 As shown, including:
[0199] The data acquisition module 401 is used to acquire the daily traffic frozen data of multiple IoT devices; the daily traffic frozen data is stored in the form of message fields in date order and corresponding to the characteristics of each IoT device.
[0200] The training data set generation module 402 is used to generate multiple training data sets based on the daily traffic freezing data; the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic multiplier of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data.
[0201] The training module 403 is used to train the preset neural network based on multiple training data sets to obtain an open neural network exchange format corresponding to the model parameter file and the neural network.
[0202] The traffic prediction model building module 404 is used to set the neural network based on the model parameter file and the open neural network exchange format to obtain the traffic prediction model.
[0203] The traffic prediction module 405 is used to predict the traffic consumption of each IoT device based on the pre-acquired input data set and the traffic prediction model.
[0204] In some optional implementations, the training data set generation module 402 includes:
[0205] The extraction unit is used to extract the date, IoT device characteristics, holiday information of the day and the traffic consumed by the IoT device on the day from the daily traffic freezing data.
[0206] The message length calculation unit is used to calculate the sum of all message lengths of each IoT device on that day based on the message field corresponding to the daily traffic freezing data.
[0207] The daily traffic consumption calculation unit is used to calculate the approximate traffic multiplier of the IoT device characteristics based on the IoT device characteristics, and to express the daily traffic consumption of the IoT device with the approximate traffic multiplier of the IoT device characteristics.
[0208] The current day holiday traffic rate calculation unit is used to calculate the current day holiday traffic rate based on the current day holiday information.
[0209] The constituent unit is used to use a set consisting of a date, IoT device characteristics, holiday information of the day, approximate flow rate of IoT device characteristics, the sum of all message lengths of each IoT device on the day, and the holiday flow rate of the day as a training data set.
[0210] In some optional implementations, the message length calculation unit includes:
[0211] The message field extraction subunit is used to extract all message fields in the daily traffic freezing data; the message fields include fixed-length fields and variable-length fields.
[0212] The fixed-length field message length calculation subunit is used to establish a mapping table between fixed-length fields and byte numbers based on different communication protocols when the message field is a fixed-length field, obtain the number of bytes of the field by querying the mapping table, and add the number of bytes of all fixed-length fields to obtain the sum of all message lengths of each IoT device on that day.
[0213] The variable length field message length calculation subunit is used to set weights for the number of bytes in the variable length field according to the time sequence when the message field is a variable length field, calculate the weighted median of the number of bytes in the variable length field based on the weights, and add the weighted medians of all fields to obtain the sum of all message lengths of each IoT device on that day. In some optional implementations, the daily traffic consumption calculation unit includes:
[0214] The feature classification subunit is used to classify the features of IoT devices according to the device type, device installation location and device user information, and obtain the daily consumption flow of the corresponding feature classification; the daily consumption flow of the corresponding feature classification is expressed as:
[0215] X={x1,x2,…,x n};
[0216] Among them, X is the daily consumption flow set corresponding to features 1 to n, x1, x2, ..., x n They are the daily consumption flows corresponding to features 1 to n respectively.
[0217] The traffic consumption calculation subunit is used to assign weights to each IoT device feature in date order. The weight allocation principle is that the weight of distant dates is low and the weight of recent dates is high. The weight of each IoT device feature is used to calculate the daily traffic consumption based on the corresponding IoT device feature classification.
[0218] The median calculation subunit is used to obtain the median value of the daily traffic consumption of the corresponding IoT device characteristics, and use the median value as the daily median of the corresponding characteristic classification, perform weighted summation on the daily traffic consumption of all IoT device characteristics, and take the median value of the weighted summation as the total daily median; the formula for weighted summation of the daily traffic consumption of all IoT device characteristics is as follows:
[0219]
[0220] Among them, c i is the weighted sum value, w j The traffic weight consumed on the day for each feature, wb j is the cardinality of the daily traffic consumption of each feature, and WA is the sum of the cardinality of all features. wb i =wb j .
[0221] The feature approximate flow rate calculation subunit is used to calculate the feature approximate flow rate corresponding to each feature classification in the IoT device feature based on the total daily median and the corresponding feature classification daily median.
[0222] In some optional implementations, the characteristic approximate flow rate corresponding to the characteristic classification also includes the characteristic approximate flow rate of the day's holiday; and the day's holiday flow rate calculation unit includes:
[0223] The holiday classification subunit is used to classify the holiday information of the day according to the preset holiday attributes.
[0224] The multiplier coefficient acquisition subunit is used to obtain the multiplier coefficient of the corresponding holiday classification day.
[0225] The daily holiday traffic rate calculation subunit is used to calculate the daily holiday traffic rate based on the daily holiday characteristic approximate traffic rate and the daily rate coefficient.
[0226] In some optional implementations, the training module 403 includes:
[0227] The sliding window unit is used to set the sliding window, starting from the first data item of the training data set and sliding one sliding window each time to obtain a sliding window data set.
[0228] The input and output data set determination unit is used to discard the last three items of the sliding window data set, use the remaining data as the input data set, and obtain the device daily consumption flow corresponding to the last three items of the sliding window data set as the output data set.
[0229] The training unit is used to take the input data set as input, take the output data set as result and use the mean square error as the loss function to train the preset neural network, obtain the model parameter file, and save the structure of the preset neural network as an open neural network exchange format file; the input data set is represented as:
[0230] Iw=((a11,a12,…,a1n),(a21,a22,…,a2n),…,(aw-31,aw-32,…,aw-3n));
[0231] Wherein, axn is the traffic consumption of the x-th IoT device on that day, n = 1, 2, ...; aw-31, aw-32, ..., aw-3n are the traffic consumption of the IoT device on that day with the last three items of data in the sliding window data set discarded;
[0232] The output dataset is represented as:
[0233] Ow=(aw-2n,aw-1n,awn);
[0234] Among them, Ow is the daily traffic consumption of the IoT device of the last three data of the sliding window data set, and the daily traffic consumption of the IoT device is the daily traffic consumption of all IoT device features.
[0235] In some optional implementations, the IoT device traffic prediction device further includes:
[0236] The early warning module is used to obtain the predicted traffic consumption amount and the current remaining traffic amount of each IoT device; calculate the predicted remaining amount based on the predicted traffic consumption amount and the current remaining traffic amount of each IoT device; when the predicted remaining amount is less than the preset alarm threshold, generate an alarm notification.
[0237] The retraining module is used to regularly obtain new daily traffic frozen data of multiple IoT devices, and generate multiple new training data sets based on the new daily traffic frozen data. The preset neural network is retrained through the new training data sets to obtain a new model parameter file and a new open neural network exchange format file; the new model parameter file and the new open neural network exchange format file are loaded using a hot overload mechanism to set the neural network to obtain a new traffic prediction model.
[0238] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0239] The IoT device traffic prediction device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0240] The embodiment of the present invention also provides a computer device having the above Figure 4 The IoT device traffic prediction device shown.
[0241] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0242] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0243] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0244] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0245] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0246] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0247] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0248] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0249] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for predicting traffic flow of Internet of Things devices, characterized in that: The method comprises: Obtaining daily traffic frozen data of multiple IoT devices; storing the daily traffic frozen data in the form of message fields in date order and corresponding to the characteristics of each IoT device; Generate multiple training data sets based on the daily traffic freezing data; the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, IoT device characteristic approximate traffic multiplier, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data; Training a preset neural network based on the multiple training data sets to obtain a model parameter file and an open neural network exchange format file corresponding to the neural network; The preset neural network is set based on the model parameter file and the open neural network exchange format file to obtain a traffic prediction model; The traffic consumption of each IoT device is predicted based on the actual input data set and traffic prediction model acquired in advance.
2. The method according to claim 1, characterized in that: Generating multiple training data sets based on the daily flow freezing data includes: Extracting the date, IoT device features and holiday information of the day from the daily traffic freezing data; Calculate the sum of all message lengths of each IoT device on that day based on the message field corresponding to the daily traffic freezing data; Calculate the approximate traffic rate of the IoT device characteristics based on the IoT device characteristics, and use the approximate traffic rate of the IoT device characteristics to represent the impact on the traffic consumption of the IoT device on that day; Calculate the holiday traffic multiplier for the day based on the holiday information for the day; The set consisting of the date, IoT device characteristics, holiday information of the day, approximate traffic ratio of IoT device characteristics, the sum of all message lengths of each IoT device on the day and the holiday traffic ratio of the day is used as a training data set.
3. The method according to claim 2, characterized in that Calculating the sum of all message lengths of each IoT device on that day based on the message field corresponding to the daily traffic freezing data includes: Extracting all message fields in the daily traffic freezing data; the message fields include fixed-length fields and variable-length fields; When the message field is a fixed-length field, a mapping table between the fixed-length field and the number of bytes is established based on different communication protocols, the number of bytes of the field is obtained by querying the mapping table, and the number of bytes of all fixed-length fields is added to obtain the sum of all message lengths of each IoT device on that day; When the message field is a variable-length field, a weight is set for the number of bytes in the variable-length field according to the time sequence, the weighted median of the number of bytes in the variable-length field is calculated based on the weight, and the weighted medians of all fields are added to obtain the sum of all message lengths of each IoT device on that day.
4. The method according to claim 2, characterized in that: Calculating the approximate flow rate of the IoT device characteristics based on the IoT device characteristics includes: The IoT device features are classified according to the device type, device installation location, and device user information, and the daily consumption flow of the corresponding feature classification is obtained; the daily consumption flow of the corresponding feature classification is expressed as: X={x1,x2,…,x n }; Among them, X is the daily consumption flow set corresponding to features 1 to n, x1, x2, ..., x n They are the daily consumption flows corresponding to features 1 to n; Assign weights to each IoT device feature in date order. The weighting principle is that the weight of distant dates is low and the weight of recent dates is high. Based on the weight of each IoT device feature, the daily traffic consumption of the corresponding IoT device feature classification is calculated; The median value of the daily traffic consumption of the corresponding IoT device characteristics is obtained, and the median value is used as the daily median of the corresponding characteristic classification. The daily traffic consumption of all IoT device characteristics is weighted and summed, and the median value of the weighted sum is taken as the total daily median. The formula for weighted sum of the daily traffic consumption of all IoT device characteristics is expressed as follows: Among them, c i is the weighted sum value, w j The weight of traffic consumption on the day for each feature classification, wb j is the cardinality of the daily traffic consumption for each feature classification, and WA is the sum of the cardinality of all feature classifications. wb i =wb j ; The feature approximate flow rate corresponding to each feature classification in the IoT device feature is calculated based on the total daily median and the corresponding feature classification daily median.
5. The method according to claim 4, characterized in that The characteristic approximate flow rate corresponding to the characteristic classification includes the characteristic approximate flow rate of the holiday of the day; and the calculation of the holiday flow rate of the day based on the holiday information of the day includes: Classify the holiday information of the day according to preset holiday attributes; Get the multiplier coefficient for the corresponding holiday category on the day; The holiday traffic multiplier for the day is calculated based on the approximate traffic multiplier with holiday characteristics for the day and the multiplier coefficient for the day.
6. The method according to claim 1, characterized in that The preset neural network is trained based on the multiple training data sets to obtain an open neural network exchange format file corresponding to the model parameter file and the neural network, including: Set a sliding window, start from the first data item of the training data set and slide one sliding window at a time to obtain a sliding window data set; The last three items of data in the sliding window data set are discarded, the remaining data are used as the input data set, and the daily traffic consumption of the device corresponding to the last three items of data in the sliding window data set are obtained as the output data set; The input data set is used as input, the output data set is used as the result and the mean square error is used as the loss function to train the preset neural network, obtain the model parameter file, and save the structure of the preset neural network as an open neural network exchange format file.
7. The method according to claim 6, characterized in that The input data set is represented as: Iw=((a11,a12,…,a1n),(a21,a22,…,a2n),…,(aw-31,aw-32,…,aw-3n)); Wherein, axn is the traffic consumption of the x-th IoT device on that day, n = 1, 2, ...; aw-31, aw-32, ..., aw-3n are the traffic consumption of the IoT device on that day with the last three items of data in the sliding window data set discarded; The output dataset is represented as: Ow=(aw-2n,aw-1n,awn); Among them, Ow is the daily traffic consumption of the IoT device of the last three data of the sliding window data set, and the daily traffic consumption of the IoT device is the daily traffic consumption of all IoT device features.
8. The method according to claim 1, characterized in that The method further comprises: Obtain the predicted traffic consumption amount and current remaining traffic amount of each IoT device; Calculate the predicted remaining amount based on the predicted amount of traffic consumed by each IoT device and the current remaining amount of traffic; When the predicted remaining amount is less than a preset alarm threshold, an alarm notification is generated.
9. The method according to claim 1, characterized in that: The method further comprises: Regularly obtain new daily traffic frozen data of multiple IoT devices, and generate multiple new training data sets based on the new daily traffic frozen data, retrain the preset neural network through the new training data sets, and obtain a new model parameter file and a new open neural network exchange format file; A hot reload mechanism is used to load a new model parameter file and a new open neural network exchange format file to set the neural network and obtain a new traffic prediction model.
10. A device for predicting traffic flow of Internet of Things equipment, characterized in that: The device comprises: A data acquisition module, used to acquire daily traffic frozen data of multiple IoT devices; the daily traffic frozen data is stored in the form of message fields in date order and corresponding to the characteristics of each IoT device; A training data set generation module, used to generate multiple training data sets based on the daily traffic freezing data; the training data set is a set consisting of the date, IoT device characteristics, holiday information of the day, IoT device characteristic approximate traffic multiplier, the sum of all message lengths of each IoT device on the day, and the holiday traffic multiplier of the day obtained based on the daily traffic freezing data; A training module, used to train a preset neural network based on the multiple training data sets to obtain an open neural network exchange format corresponding to the model parameter file and the neural network; A traffic prediction model building module, used to set the neural network based on the model parameter file and the open neural network exchange format to obtain a traffic prediction model; The traffic prediction module is used to predict the consumption traffic of each IoT device based on the pre-acquired input data set and the traffic prediction model.
11. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for predicting traffic flow of an Internet of Things device according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the Internet of Things device traffic prediction method according to any one of claims 1 to 9.
Citation Information
Cited By
Bandwidth allocation method and device of PON home gateway, medium and equipment
CN120434541A