A prediction system and method for time series data based on FPGA
By using binary neural network model to encode and multi-layer processing of time series data on the FPGA platform, the problem of information loss and low prediction accuracy caused by quantized bit width in binary network is solved, and more efficient data prediction is achieved .
Patent Information
- Application Number
- CN202411244693.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-06
AI Technical Summary
Due to its extremely low quantization bit width, binary neural networks have large loss of parameter information, and their model characterization capabilities and performance are degraded. They cannot accurately capture complex patterns and subtle changes in the data, reducing the accuracy of data prediction.
By designing a time series data prediction system on the FPGA platform, the trend encoding calculation unit in the binary neural network model is used to encode the timing data, and the intermediate feature data is processed in combination with static activation and dynamic gated calculation unit to process the intermediate feature data, and the data is retained key timing information to improve prediction accuracy.
Effectively retaining trend information of time series data improves the accuracy of data prediction and model performance, and overcomes the information loss problem caused by the binary network due to the quantized bit width.
Smart Images

Figure CN118761437B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a prediction system and method for time series data based on FPGA. Background Art
[0002] In the development of artificial intelligence, machine learning, especially deep learning technology, has played a vital role. As a branch of deep learning, traditional neural network models need to build a multi-layer network structure in order to effectively process and accurately model complex data. Each layer of the network structure contains a large number of neurons. Due to the large number of connections and related parameters between these neurons, the weight parameters need to be continuously adjusted and optimized during the training process, resulting in a sharp increase in the amount of calculation as the network size increases.
[0003] In the prior art, by quantizing the weight parameters and activation values of the neural network in fixed-point, the parameter bit width can be reduced, thereby reducing the amount of calculation. Among them, the binary neural network is the most extreme quantization method, which directly quantizes the model parameters into 1-bit fixed-point numbers, that is, it only contains two values of -1 and +1, and uses 0 to represent -1 and 1 to represent +1 in the underlying implementation. When the parameters are compressed to 1 bit, the original resource-intensive multiplication and addition operations can also be converted into bit operations. The resources required for bit operations are much smaller than those for floating-point multiplication and addition operations, and the computing efficiency will also be significantly improved. In addition, by combining the characteristics of binary neural networks with the hardware architecture of field programmable gate arrays (FPGAs), the computing speed and efficiency are further improved, and at the same time, better results can be achieved in resource utilization.
[0004] However, due to the extremely low quantization bit width of the binary network, the amount of information stored in the parameters is greatly lost, which reduces the representation ability and performance of the binary neural network model. As a result, it is unable to accurately capture the complex patterns and subtle changes in the data, reducing the accuracy of data prediction. Summary of the invention
[0005] The embodiments of the present application provide a system and method for predicting time series data based on FPGA, so as to achieve the technical effect of retaining the trend information of time series data to the maximum extent and improving the accuracy of data prediction.
[0006] In a first aspect, an embodiment of the present application provides a prediction system for time series data based on FPGA, the prediction system comprising a model parameter cache module, a binary neural network model and multiple result cache modules implemented using FPGA:
[0007] The model parameter cache module is used to store the time series data to be processed and the model parameters obtained after training of the binary neural network model, including weight parameters, learning thresholds and convolution kernel parameters;
[0008] A binary neural network model is used to generate multiple computing engines, and use the computing engines and model parameters to calculate and process the time series data to obtain prediction results. The binary neural network model includes an input layer, N intermediate layers, and an output layer. The input layer and the N intermediate layers each include multiple computing logic units. The computing engines are distributed in the input layer and the N intermediate layers, and corresponding connection relationships are established based on the computing logic units. The calculation of one thread corresponds to multiple computing engines.
[0009] A result cache module is used to cache the calculation results obtained by multiple calculation engines;
[0010] The calculation engine is used to retrieve the calculation results of the previous calculation engine in the result cache module and the model parameters in the model parameter cache module according to the calculation logic unit, calculate in sequence to obtain the calculation results of the current calculation engine, and cache the calculation results in the corresponding result cache module.
[0011] In a possible implementation, the input layer and the N intermediate layers each include a plurality of computing logic units:
[0012] The computing logic unit includes a trend coding computing unit, a static activation computing unit and a dynamic gating computing unit, wherein the trend coding computing unit is deployed in the input layer, and the static activation computing unit and the dynamic gating computing unit are deployed in N intermediate layers.
[0013] In a second aspect, an embodiment of the present application provides a prediction method for time series data based on FPGA, which is applied to any FPGA-based time series data prediction system implementation of the first aspect, including:
[0014] Obtain time series data and input the time series data into a binary neural network model. The binary neural network model includes an input layer, N intermediate layers, and an output layer. The input layer deploys a trend coding calculation unit.
[0015] The trend coding calculation unit in the input layer is used to perform trend coding processing on the time series data to obtain a coding result;
[0016] The encoding result is processed to obtain first intermediate feature data, and the first intermediate feature data is progressively input into N intermediate layers in sequence to obtain a prediction result output by the output layer, and the prediction result is used to predict the device status.
[0017] In a possible implementation, the trend coding calculation unit in the input layer is used to perform trend coding processing on the time series data to obtain a coding result, including:
[0018] Acquire first time series data of a preset time window length, and obtain a baseline according to the first time series data;
[0019] The trend coding calculation unit is used to perform trend coding processing on the time series data according to the baseline to obtain a coding result.
[0020] In a possible implementation, the first intermediate feature data is progressively input into N intermediate layers in sequence to obtain a prediction result output by the output layer, including:
[0021] The N middle layers deploy static activation computing units and dynamic gating computing units respectively;
[0022] Inputting the first intermediate feature data into the first intermediate layer, and processing the first intermediate feature data using the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer to obtain second intermediate feature data;
[0023] The second intermediate feature data is progressively input into the N-1 intermediate layers in sequence to obtain the prediction result output by the output layer.
[0024] In a possible implementation, the first intermediate feature data is input into the first intermediate layer, and the first intermediate feature data is processed by the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer to obtain the second intermediate feature data, including:
[0025] Inputting the first intermediate feature data into the first intermediate layer, and performing quantization processing on the first intermediate feature data using a static activation calculation unit to obtain first feature data and second feature data;
[0026] Performing binary convolution processing on the first feature data to obtain a first calculation result;
[0027] Processing the first intermediate feature data and the second feature data using a dynamic gating calculation unit to obtain a second calculation result;
[0028] According to the first calculation result and the second calculation result, second intermediate feature data is obtained.
[0029] In a possible implementation, the first intermediate feature data and the second feature data are processed by a dynamic gating calculation unit to obtain a second calculation result, including:
[0030] The dynamic gated computation unit includes an activation importance perception layer, a fully connected layer, and a precision gated convolutional layer;
[0031] The first intermediate feature data is analyzed by activating the importance perception layer to obtain an analysis result, and the analysis result is averaged and pooled to obtain a pooling result.
[0032] The pooling result is input into the fully connected layer to obtain an important bit indication vector, and the high-efficiency feature bit and the low-efficiency feature bit are determined according to the important bit indication vector and the first intermediate feature data;
[0033] According to the high-efficiency feature bits and the low-efficiency feature bits, the second feature data is calculated and processed using a precision gated convolution layer to obtain a second calculation result.
[0034] In a possible implementation, the pooling result is input into a fully connected layer to obtain an important bit indication vector, and the high-efficiency feature bit and the low-efficiency feature bit are determined according to the important bit indication vector and the first intermediate feature data, including:
[0035] Obtaining a weight parameter and a first learning threshold of a fully connected layer, inputting a pooling result into the fully connected layer, calculating the pooling result and the weight parameter, and obtaining a third calculation result;
[0036] Compare the third calculation result with the first learning threshold to obtain a significant bit indication vector;
[0037] The first intermediate feature data is distinguished according to the important bit indication vector to determine the high-efficiency feature bits and the low-efficiency feature bits.
[0038] In a possible implementation, the second feature data is calculated and processed using a precision gated convolution layer according to the high-efficiency feature bits and the low-efficiency feature bits to obtain a second calculation result, including:
[0039] According to the efficient feature bits and the inefficient feature bits, the second feature data is analyzed using a precision gated convolution layer to obtain a high-precision bit feature matrix corresponding to the efficient feature bits and a low-precision bit feature matrix corresponding to the inefficient feature bits;
[0040] The high-precision bit feature matrix and the low-precision bit feature matrix are calculated and processed to obtain a second calculation result.
[0041] In a possible implementation, the high-precision bit feature matrix and the low-precision bit feature matrix are calculated to obtain a second calculation result, including:
[0042] Obtaining convolution kernel parameters and a second learning threshold of the precision gated convolution layer, and calculating the high-precision bit feature matrix using the convolution kernel parameters to obtain a fourth calculation result;
[0043] Analyze the fourth calculation result and the second learning threshold to generate a mask result, and process the low-precision bit feature matrix according to the mask result to obtain an activation part corresponding to the low-precision bit feature matrix;
[0044] The activation part is calculated using the convolution kernel parameters to obtain the fifth calculation result;
[0045] The fourth calculation result and the fifth calculation result are added to obtain a second calculation result.
[0046] The embodiment of the present application provides a prediction system and method for time series data based on FPGA, which obtains time series data and inputs it into a binary neural network model, performs trend coding processing on the time series data with the help of the trend coding calculation unit in the input layer of the binary neural network model, obtains the coding result, realizes efficient binarization of the data, and retains the key time series information in the data; processes the coding result to obtain the first intermediate feature data; inputs the first intermediate feature data into the N intermediate layers of the binary neural network model in sequence, and finally obtains the prediction result output by the output layer of the binary neural network model. In this process, the progressive processing of the first intermediate feature data by multiple intermediate layers can fully explore and analyze the characteristics and laws of the data, thereby improving the accuracy of the prediction of the time series data. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0048] Figure 1 A schematic diagram of the structure of a prediction system for time series data based on FPGA provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 1 ;
[0050] Figure 3 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 2 ;
[0051] Figure 4 A schematic diagram of the encoding process provided in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 3 .
[0053] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0055] In the existing technology, the amount of calculation is reduced by quantizing fixed-point numbers such as weight parameters. Binary neural networks are an extreme quantization method that quantizes parameters to -1 and +1, converting multiplication and addition operations into bit operations to improve computing efficiency. At the same time, combining with FPGA can further improve speed and efficiency. However, due to the extremely low quantization bit width, the binary network causes large information loss, the model representation ability and performance are reduced, and it is difficult to accurately capture complex data patterns and subtle changes, which reduces the accuracy of data prediction.
[0056] The embodiment of the present application provides a prediction system and method for time series data based on FPGA, which inputs the acquired time series data into a binary neural network model, performs trend coding processing on the time series data using a trend coding calculation unit in the input layer of the binary neural network model, and obtains a coding result, which helps to better retain the trend information of the time series data; the coding result is processed to obtain the first intermediate feature data, and the first intermediate feature data is sequentially and progressively input into the N intermediate layers of the binary neural network model, the processing of the intermediate layer improves the performance of the model, and finally the output layer outputs the prediction result. Therefore, this method solves the technical problems of serious data information loss and low data prediction accuracy in the prior art.
[0057] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0058] Figure 1 A schematic diagram of a structure of a prediction system for time series data based on FPGA provided in an embodiment of the present application, such as Figure 1 As shown, this embodiment provides a prediction system 10 for time series data based on FPGA, and the prediction system includes: a model parameter cache module 101, a binary neural network model 102 and multiple result cache modules 103.
[0059] The model parameter cache module 101 is used to store the time series data to be processed and store the model parameters obtained through training of the binary neural network model, wherein the model parameters include weight parameters, learning thresholds and convolution kernel parameters.
[0060] In this embodiment, time series data generally refers to data that changes in performance or characteristics to a certain extent over time, and these data have the characteristics of a time series. For example, the monitoring data of the operating status of equipment in a factory, each time point corresponds to a specific operating parameter; secondly, it is usually generated continuously, forming a time series.
[0061] It should be noted that the binary neural network model has been trained, so its corresponding model parameters can be directly stored in the model parameter cache module, so that when processing time series data based on FPGA, the model parameters can be quickly obtained from the cache, thereby improving the data reading speed and thus speeding up the operation efficiency of the model.
[0062] The binary neural network model 102 is used to generate multiple computing engines, and use the computing engines and model parameters to calculate and process the time series data to obtain prediction results. The binary neural network model includes an input layer 104, N intermediate layers 105 and an output layer 106. The input layer and the N intermediate layers respectively include multiple computing logic units; the computing engines are distributed in the input layer and the N intermediate layers, and corresponding connection relationships are established based on the computing logic units. The calculation of one thread corresponds to multiple computing engines.
[0063] In this embodiment, by using the binary neural network model to generate multiple computing engines, time series data can be efficiently processed and analyzed. The computing engine can extract features from the data and then obtain prediction results through computing processing.
[0064] The result cache module 103 is used to cache the calculation results obtained by multiple calculation engines.
[0065] In this embodiment, the calculation results obtained by the calculation engine are cached in the result cache module for subsequent calls and further processing, thereby improving the calculation efficiency. In addition, these cached calculation results can be transferred between different stages or modules, making the entire calculation process more coherent and smooth.
[0066] The computing engine is used to retrieve the calculation results of the previous computing engine in the result cache module and the model parameters in the model parameter cache module according to the computing logic unit, perform convolution calculations in sequence to obtain the calculation results of the current computing engine, and cache the calculation results in the corresponding result cache module.
[0067] In this embodiment, the computing engine operates based on the computing logic unit, and can obtain the calculation results of the previous computing engine from the result cache module, and obtain the corresponding model parameters from the model parameter cache module. Then, the convolution calculation is performed in a specific order to obtain the calculation result of the current computing engine, and the result is stored in the corresponding result cache module. Such a design enables the entire computing process to proceed in an orderly manner, realizes the continuous processing of data and the gradual updating of results. Each computing engine performs calculations based on the previous one, continuously advancing and improving the entire computing process, and helps to analyze and process data more accurately.
[0068] In a possible implementation, the input layer of the binary neural network model in the FPGA-based time series data prediction system includes a trend coding calculation unit, and the N intermediate layers include a static activation calculation unit and a dynamic gating calculation unit. The trend coding calculation unit, the static activation calculation unit, and the dynamic gating calculation unit all belong to the computing logic unit.
[0069] Figure 2 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 1 ,like Figure 2 As shown, the method includes:
[0070] S201. Obtain time series data, and input the time series data into a binary neural network model.
[0071] In this embodiment, predictive processing is performed on time series data to understand the performance degradation of the system or equipment so that maintenance or intervention measures can be taken in time to improve the working efficiency and reliability of the equipment. Therefore, a binary neural network model can be used to predict time series data.
[0072] S202. Use the trend coding calculation unit in the input layer to perform trend coding processing on the time series data to obtain a coding result.
[0073] In this embodiment, the binary neural network model uses a trend coding calculation unit to convert complex time series data into a coding form that is easier to process and analyze when processing time series data. This coding form can highlight the trend characteristics in the data and realize data binarization to improve computing efficiency.
[0074] S203, process the encoding result to obtain first intermediate feature data, and input the first intermediate feature data into N intermediate layers in sequence and progressively to obtain the prediction result output by the output layer.
[0075] In this embodiment, the encoding result is further processed to obtain the first intermediate feature data, which is then progressively input into the N intermediate layers in sequence. As the first intermediate feature data is transmitted and processed in the intermediate layers, the neural network can learn feature representations at different levels, and continuously refine and optimize information. Finally, the prediction result is outputted by the output layer, and the prediction result is used to predict the device status.
[0076] The embodiment of the present application provides a prediction method for time series data based on FPGA, which obtains time series data, inputs the time series data into a binary neural network model, and uses the trend coding calculation unit in the input layer of the binary neural network model to perform trend coding processing on the time series data to obtain a coding result; the coding result is processed to obtain the first intermediate feature data, and the first intermediate feature data is sequentially and progressively input into the N intermediate layers of the binary neural network model to obtain the prediction result output by the output layer of the binary neural network model. This method obtains a binary coding result by encoding the time series data, that is, it realizes data binarization to improve the calculation efficiency and also maintains the time series information in the data, and then uses the intermediate layer to process the data to finally obtain the prediction result, thereby achieving the technical effect of improving the accuracy of data prediction.
[0077] Figure 3 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, a possible implementation of a method for predicting time series data is described in detail, and the method includes:
[0078] S301, obtaining time series data, and inputting the time series data into a binary neural network model.
[0079] Step S301 is similar to the above step S201 and will not be described again.
[0080] S302: Acquire first time series data of a preset time window length, and obtain a baseline according to the first time series data.
[0081] In this embodiment, according to the preset time window length, first time series data of corresponding time length is intercepted from the time series data, and a relatively stable and representative baseline is constructed based on the first time series data for subsequent analysis and comparison.
[0082] Specifically, T is represented as the preset time window length, and the first time series data of the preset time window length is X T , then the baseline I0 is expressed as:
[0083]
[0084] S303, using a trend coding calculation unit, performing trend coding processing on the time series data according to a baseline to obtain a coding result, and processing the coding result to obtain first intermediate feature data.
[0085] In this embodiment, the specific process of using the trend coding calculation unit to perform trend coding processing on the time series data according to the baseline is as follows:
[0086] ;
[0087] ,
[0088] Where R is the resolution, which is calculated by subtracting the minimum value from the maximum value in the time series data. x i r is the input time series data, x i b is the encoding result.
[0089] After the above encoding process, Figure 4 As shown, Figure 4 A schematic diagram of the encoding process provided by the embodiment of the present application. The left side is the time series data, which includes the trend chart of the blue line and the full-precision data corresponding to each trend chart, and the right side is the encoding result corresponding to the time series data.
[0090] S304: Input the first intermediate feature data into the first intermediate layer, and use the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer to process the first intermediate feature data to obtain second intermediate feature data.
[0091] In this embodiment, after the first intermediate feature data is input into the first intermediate layer, the static activation calculation unit will process the data in its specific way to adjust the characteristics of the data, while the dynamic gating calculation unit will operate more flexibly according to the specific situation of the data, thereby achieving more targeted processing of the data. The combination of the two makes the processing of the first intermediate feature data more comprehensive and refined, and can capture different types of features and changes. The second intermediate feature data finally generated contains the information after these complex processing, providing a more expressive and adaptable data foundation for subsequent model processing and analysis.
[0092] Among them, the N intermediate layers deploy static activation calculation units and dynamic gating calculation units respectively. The dynamic gating calculation unit includes an activation importance perception layer, a fully connected layer, and a precision gated convolutional layer.
[0093] S305: Input the second intermediate feature data to N-1 intermediate layers in sequence and progressively to obtain the prediction result output by the output layer.
[0094] Step S306 is similar to the above step S203 and will not be described again.
[0095] The embodiment of the present application provides a prediction method for time series data based on FPGA, which determines the baseline by obtaining the first time series data of a specific preset time window length, and uses the trend coding calculation unit to perform trend coding processing on the time series data based on the baseline to obtain the coding result, which helps to better retain the trend information of the time series data and improve the capture and utilization of data features. The coding result is further processed to obtain the first intermediate feature data. The first intermediate feature data is input into the first intermediate layer, where the static activation calculation unit and the dynamic gating calculation unit will process it to generate the second intermediate feature data. The second intermediate feature data is then progressively input into the subsequent N-1 intermediate layers in sequence, and the processing of the intermediate layers improves the performance of the model, and finally the output layer outputs the prediction result. This method improves the limitations of the binary neural network due to the low quantization bit width, and improves its performance in processing time series data, including better coping with information loss, enhancing the diversity of the model, and improving the representation ability, thereby achieving more accurate, stable and reliable prediction results.
[0096] Figure 5 A schematic diagram of a method for predicting time series data based on FPGA provided in an embodiment of the present application Figure 3 ,like Figure 5 As shown, in this embodiment Figure 3 Based on the embodiment, a possible implementation method of inputting the first intermediate feature data into the first intermediate layer, processing the first intermediate feature data using the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer, and obtaining the second intermediate feature data is described in detail, and the method includes:
[0097] S501. Input the first intermediate feature data into the first intermediate layer, use the static activation calculation unit to quantize the first intermediate feature data to obtain first feature data and second feature data, and perform binary convolution on the first feature data to obtain a first calculation result.
[0098] In this embodiment, the static activation calculation unit is an indicator vector of the channel dimension, and its value only includes 0 and 1, 0 represents that only the traditional 1-bit binary convolution processing is required, and 1 represents that 2-bit activation is required for dynamic gated convolution processing. Therefore, the first intermediate feature data is quantized using the static activation calculation unit to obtain the first feature data and the second feature data, wherein the first feature data refers to 1 bit and the second feature data refers to 2 bits.
[0099] It should be noted that the specific process of quantization using static activation computing units is as follows:
[0100] ,
[0101] in, is the static activation factor, is the binary activation at channel c, is the quantization interval, for 2-bit quantization it is The back propagation training of the static activation factor is carried out according to the STE (Straight-Through-Estimator) method, and its gradient calculation formula is as follows:
[0102] ,
[0103] Among them, the static activation factor is an offline learning factor. At the end of the training process, each channel will be specifically and fixedly quantized to a specified accuracy level.
[0104] S502: Analyze the first intermediate feature data using the activated importance perception layer to obtain an analysis result, and perform an average pooling operation on the analysis result to obtain a pooling result.
[0105] In this embodiment, the activation importance perception layer is used to analyze the first intermediate feature data, which is floating-point activation data, to determine the importance of the activation information, and then obtain the analysis result, which is subjected to an average pooling operation. In this way, the analysis result can be simplified and summarized to highlight its main features. After the average pooling operation, a pooling result is obtained, which is more concise and representative than the original analysis result.
[0106] S503: Obtain a weight parameter and a first learning threshold of a fully connected layer, input a pooling result into the fully connected layer, calculate the pooling result and the weight parameter, and obtain a third calculation result.
[0107] In this embodiment, since the binary neural network model mentioned above is a trained model, that is, the weight parameters of the fully connected layer and the first learning threshold can be directly used. Therefore, the pooling result is calculated according to the weight parameters of the fully connected layer to obtain the third calculation result.
[0108] S504: Compare the third calculation result with the first learning threshold to obtain an important bit indication vector, and distinguish the first intermediate feature data according to the important bit indication vector to determine a high-efficiency feature bit and an inefficient feature bit.
[0109] In this embodiment, the important bit indication vector The calculation process is:
[0110] ,
[0111] Among them, AvgPool is the average pooling, W is the weight parameter of the fully connected layer, is the first intermediate feature data (floating point activation data) located at channel c, t c is the learnable threshold, H c is the gate importance score.
[0112] The first intermediate feature data is distinguished to determine the efficient feature bit:
[0113] .
[0114] After the efficient feature bits are distinguished, the remaining ones are all inefficient feature bits.
[0115] S605. Analyze the second feature data using a precision gated convolutional layer according to the efficient feature bits and the inefficient feature bits to obtain a high-precision bit feature matrix corresponding to the efficient feature bits and a low-precision bit feature matrix corresponding to the inefficient feature bits.
[0116] In this embodiment, the division of efficient feature bits and inefficient feature bits is first clarified, and the second feature data is input into the precision gated convolution layer. In this process, the precision gated convolution layer will analyze and process the second feature data in a targeted manner according to the different properties of the feature bits (efficient or inefficient). For efficient feature bits, the feature information with higher precision related to them will be extracted, and this information will be combined to form a high-precision bit feature matrix. For inefficient feature bits, the corresponding feature information will also be extracted, but the precision of this information is relatively low, thereby forming a low-precision bit feature matrix.
[0117] S506. Obtain convolution kernel parameters and a second learning threshold of the precision gated convolution layer, and use the convolution kernel parameters to calculate the high-precision bit feature matrix to obtain a fourth calculation result.
[0118] In this embodiment, since the binary neural network model mentioned above is a trained model, the convolution kernel parameters and the second learning threshold of the precision gated convolution layer can be directly used. First, the high-precision bit feature matrix is calculated using the convolution kernel parameters. This calculation process is similar to a feature transformation and extraction, and the features in the high-precision bit feature matrix are interactively operated with the convolution kernel to obtain a fourth calculation result, which contains a new feature representation after the convolution operation.
[0119] S507, analyzing the fourth calculation result and the second learning threshold to generate a mask result, and processing the low-precision bit feature matrix according to the mask result to obtain an activation part corresponding to the low-precision bit feature matrix.
[0120] In this embodiment, the generated mask result can be regarded as an indicator, which marks which positions should be paid attention to or processed according to the analyzed mask result. The low-precision bit feature matrix is processed according to this mask result. This means that only the part indicated as valid by the mask (i.e., the activated part) will be selected and further operated or processed, while other parts may be ignored or remain unchanged.
[0121] S508. Calculate the activated part using the convolution kernel parameters to obtain a fifth calculation result, and add the fourth calculation result and the fifth calculation result to obtain a second calculation result.
[0122] In this embodiment, when the activation part is calculated using the convolution kernel parameters, the convolution kernel is usually convolved with the activation part. The convolution operation involves moving the convolution kernel point by point on the activation part, performing multiplication and summation operations between elements. For each position, the weight of the convolution kernel is multiplied by the activation part element at the corresponding position, and then all products are added to obtain the result at that position. In this way, the entire activation part is traversed to obtain the fifth calculation result. The fourth calculation result and the fifth calculation result obtained previously are added to obtain the second calculation result.
[0123] S509: Obtain second intermediate feature data according to the first calculation result and the second calculation result.
[0124] In this embodiment, the first calculation result and the second calculation result are calculated and processed to obtain second intermediate feature data, and the second intermediate feature data is used to participate in the calculation of the next intermediate layer.
[0125] An embodiment of the present application provides a prediction method for FPGA-based timing data. By means of an adaptive quantization accuracy level indication of a statically activated computing unit, a quantization accuracy level can be assigned to activations. By means of a dynamic convolution strategy of a dynamic gating computing unit, high-efficiency feature bits and low-efficiency feature bits that are affected by activations are dynamically identified, thereby improving the performance of the model and thereby improving the accuracy of the model prediction data.
[0126] The terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein, for example, can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, products or devices.
[0127] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0128] It should be noted that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flow chart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0129] It should be understood that the above system embodiments are only illustrative, and the system of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0130] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0131] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A prediction method for time series data based on FPGA, It is characterized in that A prediction system for time series data based on FPGA, the prediction system includes a model parameter cache module formed by FPGA, a binary neural network model and multiple result cache modules: The model parameter cache module is used to store the time series data to be processed and store the model parameters of the binary neural network model obtained through training, wherein the model parameters include weight parameters, learning thresholds and convolution kernel parameters; The binary neural network model is used to generate multiple computing engines, and the computing engines and the model parameters are used to perform computing processing on the time series data to obtain prediction results; wherein the binary neural network model includes an input layer, N intermediate layers and an output layer, and the input layer and the N intermediate layers respectively include multiple computing logic units; the computing engines are distributed in the input layer and the N intermediate layers, and corresponding connection relationships are established according to the computing logic units, and the calculation of one thread corresponds to multiple computing engines; The result caching module is used to cache the calculation results obtained by the multiple calculation engines; The computing engine is used to retrieve the computing result of the previous computing engine in the result cache module and the model parameters in the model parameter cache module according to the computing logic unit, perform calculations in sequence to obtain the computing result of the current computing engine, and cache the computing result in the corresponding result cache module; The method comprises: Acquire time series data, and input the time series data into a binary neural network model, wherein the binary neural network model includes an input layer, N intermediate layers, and an output layer, and the input layer deploys a trend coding calculation unit; Using the trend coding calculation unit in the input layer to perform trend coding processing on the time series data to obtain a coding result; Processing the encoding result to obtain first intermediate feature data, inputting the first intermediate feature data into the N intermediate layers in sequence and progressively, obtaining a prediction result output by the output layer, and the prediction result is used to predict the device state; The step of progressively inputting the first intermediate feature data into the N intermediate layers in sequence to obtain a prediction result output by the output layer includes: The N intermediate layers respectively deploy static activation computing units and dynamic gating computing units; Inputting the first intermediate feature data into a first intermediate layer, and processing the first intermediate feature data using the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer to obtain second intermediate feature data; Inputting the second intermediate feature data progressively into N-1 intermediate layers in sequence to obtain the prediction result output by the output layer; The step of inputting the first intermediate feature data into the first intermediate layer, and processing the first intermediate feature data using the static activation calculation unit and the dynamic gating calculation unit in the first intermediate layer to obtain second intermediate feature data includes: Inputting the first intermediate feature data into the first intermediate layer, and performing quantization processing on the first intermediate feature data using the static activation calculation unit to obtain first feature data and second feature data; Performing binary convolution processing on the first feature data to obtain a first calculation result; Processing the first intermediate feature data and the second feature data using the dynamic gating calculation unit to obtain a second calculation result; The second intermediate feature data is obtained according to the first calculation result and the second calculation result.
2. The method according to claim 1, It is characterized in that The input layer and the N intermediate layers each include a plurality of computing logic units: The computing logic unit includes a trend coding computing unit, a static activation computing unit and a dynamic gating computing unit, wherein the trend coding computing unit is deployed in the input layer, and the static activation computing unit and the dynamic gating computing unit are deployed in the N intermediate layers.
3. The method according to claim 1, It is characterized in that The step of performing trend coding processing on the time series data using the trend coding calculation unit in the input layer to obtain a coding result includes: Acquire first time series data of a preset time window length, and obtain a baseline according to the first time series data; The trend coding calculation unit is used to perform trend coding processing on the time series data according to the baseline to obtain the coding result.
4. The method according to claim 1, It is characterized in that The using the dynamic gating calculation unit to process the first intermediate feature data and the second feature data to obtain a second calculation result includes: The dynamic gating calculation unit includes an activation importance perception layer, a fully connected layer and a precision gated convolution layer; Analyzing the first intermediate feature data by activating the importance perception layer to obtain an analysis result, and performing an average pooling operation on the analysis result to obtain a pooling result; Inputting the pooling result into the fully connected layer to obtain an important bit indication vector, and determining a high-efficiency feature bit and an inefficient feature bit according to the important bit indication vector and the first intermediate feature data; According to the efficient feature bits and the inefficient feature bits, the second feature data is calculated and processed using the precision gated convolution layer to obtain the second calculation result.
5. The method according to claim 4, It is characterized in that The step of inputting the pooling result into the fully connected layer to obtain an important bit indication vector, and determining a high-efficiency feature bit and an inefficient feature bit according to the important bit indication vector and the first intermediate feature data includes: Obtaining a weight parameter and a first learning threshold of a fully connected layer, inputting the pooling result into the fully connected layer, calculating the pooling result and the weight parameter, and obtaining a third calculation result; Compare the third calculation result with the first learning threshold to obtain a significant bit indication vector; The first intermediate feature data is distinguished according to the important bit indication vector to determine the high-efficiency feature bit and the low-efficiency feature bit.
6. The method according to claim 4, It is characterized in that According to the efficient feature bit and the inefficient feature bit, the second feature data is calculated and processed by using the precision gated convolution layer to obtain the second calculation result, including: According to the high-efficiency feature bits and the low-efficiency feature bits, the second feature data is analyzed using the precision gated convolution layer to obtain a high-precision bit feature matrix corresponding to the high-efficiency feature bits and a low-precision bit feature matrix corresponding to the low-efficiency feature bits; The high-precision bit feature matrix and the low-precision bit feature matrix are calculated to obtain the second calculation result.
7. The method according to claim 6, It is characterized in that The step of calculating and processing the high-precision bit feature matrix and the low-precision bit feature matrix to obtain the second calculation result includes: Obtaining convolution kernel parameters and a second learning threshold of the precision gated convolution layer, and calculating the high-precision bit feature matrix using the convolution kernel parameters to obtain a fourth calculation result; Analyze the fourth calculation result and the second learning threshold to generate a mask result, and process the low-precision bit feature matrix according to the mask result to obtain an activation part corresponding to the low-precision bit feature matrix; Calculating the activated part using the convolution kernel parameters to obtain a fifth calculation result; The fourth calculation result and the fifth calculation result are added to obtain the second calculation result.
