Next Article in Journal
TabNet: Locally Interpretable Estimation and Prediction for Advanced Proton Exchange Membrane Fuel Cell Health Management
Previous Article in Journal
A New 3-Dimensional Graphene Vertical Transistor with Channel Length Determination Using Dielectric Thickness
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Dual-Branch Structure Network of Custom Computing for Multivariate Time Series

1
School of Information Science and Technology, Shanghaitech University, Shanghai 201210, China
2
Shanghai Advanced Research Institute, Chinese Academy of Sciences, Shanghai 201210, China
3
University of Chinese Academy of Sciences, Beijing 100049, China
*
Author to whom correspondence should be addressed.
Electronics 2024, 13(7), 1357; https://doi.org/10.3390/electronics13071357
Submission received: 29 February 2024 / Revised: 22 March 2024 / Accepted: 2 April 2024 / Published: 3 April 2024

Abstract

:
Time series are a common form of data, which are of great importance in multiple fields. Multivariate time series whose relationship of dimension is indeterminacy are particularly common within these. For multivariate time series, we proposed a dual-branch structure model, composed of an attention branch and a convolution branch, respectively. The algorithm proposed in our work is implemented for custom computing optimization and deployed on the Xilinx Ultra 96V2 device. Comparative results with other state-of-the-art time series algorithms on public datasets indicate that the proposed method achieves optimal performance. The power consumption of the system is 6.38 W, which is 47.02 times lower than that of a GPU.

1. Introduction

Time series are a common form of data, which are of great importance in multiple fields, such as power systems, medical study, finance analysis, and so on. Multivariate time series whose relationship of dimension is indeterminacy are particularly common within these.
In 2017, the Google team improved Transformer-like models [1], abandoning traditional architectures such as recurrent neural networks and convolutional neural networks. They constructed models by stacking encoders and decoders, with each encoder and decoder having the same structure. In 2018, Google introduced the BERT model, which only utilizes the encoding part of Transformer. It is a bidirectional network capable of simultaneously observing contextual information from both directions [2]. In 2019, OpenAI proposed the GPT model, which utilizes the decoding part of Transformer. It is a unidirectional network with causality in its processing [3]. In 2020, George Zerveas from Brown University and IBM jointly released the TST model [4]. They utilized the Transformer model for analyzing multidimensional time series, demonstrating impressive performance in prediction and classification tasks. Unlike the original BERT model applied to NLP problems, TST employs BatchNorm instead of LayerNorm. Proposed by Ismail Fawaz et al. in 2020, InceptionTime adapts the inception module to the unique characteristics of time series data [5]. It introduces parallel pathways with different filter sizes to effectively capture diverse temporal patterns and hierarchical features. This model has proven to be particularly adept at handling various time series analysis tasks, including classification and forecasting. Its performance across different benchmarks highlights its effectiveness in capturing intricate patterns within time series datasets. Proposed by Y. Lin, I. Koprinska, and M. Rana in 2021 [6], the Temporal Convolutional Attention Neural Network focuses on advancing the field of time series forecasting. This model uniquely combines the efficiency of Convolutional Neural Networks (CNNs) in processing temporal data with the capabilities of Attention Mechanisms to capture long-term dependencies more effectively in time series.
In recent years, significant strides have been made in multivariate time series forecasting and classification. Shih et al. introduced an innovative method to capture temporal patterns in time series data [7], emphasizing multivariate forecasting. This method demonstrates the growing importance of nuanced pattern recognition in time series analysis. Qin et al. proposed a dual-stage attention mechanism [8]. This method significantly enhances prediction accuracy in complex, multivariate time series contexts, highlighting the efficacy of sophisticated neural network architectures in handling intricate data patterns. Khodabakhsh et al. focused on the application of LSTM networks for multivariate time series forecasting [9]. Their paper addresses the efficiency and effectiveness of batch-processing techniques, underscoring the importance of computational efficiency in handling large-scale time series data.
MengHao Guo et al. proposed an external attention mechanism, which utilizes two external learnable and shareable memory modules consisting of two linear layers and two normalization layers, reducing the algorithm complexity to linear [10]. Similarly, Chuhan Wu designed additive attention based on classic attention structures and proposed Fastformer [11]. This attention mechanism models global information and further processes elements based on their relationships with the global context, rather than computing pairwise relationships between elements. In this manner, Fastformer achieves linear complexity as well.
Layer normalization (LayerNorm) and residual connection structures can stabilize deep neural networks during training, avoiding unstable gradient changes and model degradation. However, LayerNorm operations have relatively high computational complexity, leading some researchers to analyze and improve these operations. Xu et al. pointed out through empirical observations and experimental analysis that the derivatives of data mean and variance are crucial factors for the excellent performance of LayerNorm, while other learnable parameters have minimal impact on experimental results [12]. Shen et al. discussed the differences between BatchNorm and LayerNorm and proposed PowerNorm based on BatchNorm [13]. PowerNorm no longer requires normalization operations with a mean of 0, and it utilizes the square mean of sequences instead of variance.
There has been significant optimization work on feedforward layers as well. The GPT model proposed by OpenAI replaced the ReLU activation function in the feedforward layers with GELU, which has almost become a standard setting in language modeling [3]. Meanwhile, Shazeer et al. utilized GLU instead of ReLU, which is an activation function similar to the gating structure in LSTM [14]. Apart from activation functions, some researchers aimed to alter the simple structure of feedforward layers to increase model capacity. The Mixture-of-Experts (MoE) with auxiliary learnable parameters is a representative work in this regard [15]. Conversely, many researchers have sought to streamline the structure of feedforward layers. Zhanghao Wu from MIT’s Han Song Laboratory pointed out that in language models, feedforward layers themselves do not effectively capture contextual information but consume a significant amount of computational resources [16]. He improved the traditional bottleneck-style feedforward layer structure, keeping the channel dimension unchanged while reducing computation and parameters. Sukhbaatar et al. suggested adding a matrix with learnable parameters to the attention layer to mimic the role of the feedforward layer in the model, thereby discarding the feedforward layer and simplifying the structure [17]. Yang et al. directly discarded the feedforward layer in the decoding part of the Transformer model. From experimental data, they concluded that although feedforward layers have a large volume of data, their computational efficiency is low. Removing this part directly does not result in significant losses; instead, it greatly improves training and inference speed [18].
The large number of parameters in fully connected layers can slow down training speed and potentially lead to overfitting. Min Lin first proposed simplifying fully connected layers using global average pooling to reduce parameter count and computational complexity while enhancing experimental results [19]. Due to the simplicity and efficiency of global average pooling, it has been widely adopted in convolutional neural networks. Scholars from Zhejiang University found a linear relationship between the fundamental component of 2D discrete cosine transform and global average pooling. Consequently, they introduced frequency domain features into pooling operations for the first time, proposing FcaNet [20]. Proposed by Lee-Thorp et al. in 2020, FNet deviates from the conventional Transformer architecture by replacing the self-attention mechanism with a simple and efficient Fourier transform [21]. The key idea is to leverage the Fourier transform’s ability to capture global dependencies in a sequence, offering an alternative approach to sequence modeling. The FNet model has shown promising results in various natural language processing and time series tasks, demonstrating competitive performance while mitigating some of the computational complexities associated with traditional self-attention mechanisms. This unique design choice has sparked interest in exploring alternative architectures for sequence modeling.
We address algorithm design and hardware deployment for multivariate time series, focusing on the integration of both domains. Our proposed method, characterized by its efficiency and high parallelism, optimizes computational processes within hardware architectures, enhancing analysis speed. In response to the complex traits of multivariate time series, such as unpredictable correlations among dimensions, subtle features, and varied historical data needs, we employ a unified approach, utilizing a deep learning network algorithm tailored for this context. Our methodology, validated across diverse multidimensional datasets, exhibits proficient feature extraction and strong generalization. Emphasizing custom computing compatibility, our design achieves substantial parallelism, exploiting custom computing’s parallel processing benefits. Moreover, it enables low-power, accurate processing for a spectrum of time series tasks, demonstrating the effectiveness of our integrated approach in algorithm and hardware synergy.

2. Methodology

2.1. Model Architecture

The model is divided into two parts: the attention branch and the convolution branch. Firstly, the original data x are mapped to x conv using a linear layer, where the channel dimensions of x and x conv are m and 6 n , respectively, with m 6 n . x conv is directly transmitted to the convolutional branch. For the attention branch, we additionally introduce learnable positional encoding information L, and the input to the attention branch is x att = x conv + L . Positional encoding is an important encoding method for Transformer-like models because the self-attention mechanism alone cannot distinguish the sequential order of elements. However, in fields such as text modeling and speech recognition, the order relationship of elements is crucial. Therefore, additional positional encoding is particularly important for the attention mechanism. A common approach is to encode the position information into vectors, which are then input into the model. The convolutional module does not require positional encoding since convolution analyzes sequences in order during computation.

2.2. Attention Branch

The attention branch is constructed by several submodules, each comprising a self-attention layer and a feedforward layer. This work draws inspiration from Google’s FNet and utilizes a two-dimensional Discrete Fourier Transform (DFT) to model the self-attention layer. Implementing Fourier transforms in time series analysis presents a blend of advantages. Their main strengths include a significant boost in processing speed, which is especially beneficial for handling long sequences in time series data. This method simplifies the model architecture while effectively handling tasks like anomaly detection and trend analysis in time series data. Fourier transforms also have a lower memory footprint, which is advantageous in applications where model size and computational resources are limiting factors. However, there are notable drawbacks. The accuracy of Fourier transform-based methods may not always match the precision of more conventional time series analysis techniques. Additionally, their computational efficiency can be dependent on the specific hardware used and the length of the time series. The definition of the one-dimensional DFT is as follows: Given a sequence x n with a length of H, the H-point DFT of x n is defined as:
X ( k ) = DFT [ x ( h ) ] = h = 0 H 1 x ( h ) e 2 π i H h k , 0 k H 1
The computational complexity of the DFT is O ( N 2 ) . We utilize fast Fourier transform (FFT) to accelerate DFT. FFT is the most commonly used method to implement DFT, leveraging the symmetry and periodicity of DFT to reduce the computational complexity to O ( N log N ) . The two-dimensional FFT in the attention branch operates separately on the channel and sequence length dimensions, ultimately outputting only the real part of the data. In the design of the feedforward layer in the classical Transformer model, the feedforward layer consists of two linear layers. Each linear layer requires an “Add + Norm” operation, meaning the data are added to the upper-layer data and then normalized. In the attention branch design of this paper, only the “Add + Norm” operation is retained, and linear layers are not added. LayerNorm is a common normalization method in NLP tasks, but this paper opts for BatchNorm. In NLP problems, data mapped from words to sentences often exhibit large fluctuations, whereas time series data tend to have smaller fluctuations. BatchNorm can mitigate the impact of outliers in the data, making it more suitable for time series rather than NLP problems. The structural design of the feedforward layer will be discussed in detail in the experimental section later in the paper. In summary, the formula for the attention module is as follows:
y = BatchNorm ( x + R ( F seq ( F channel ( x ) ) ) )
Here, x and y represent the module’s input and output, respectively. F channel and F seq denote the fast Fourier transforms in the channel and sequence length dimensions, and R represents the real part.

2.3. Convolution Branch

Compared to the self-attention layer, the convolutional branch focuses more on processing partial information. Drawing inspiration from the InceptionTime model, this paper adopts a design with several parallel convolutional layers. However, unlike InceptionTime, we discard both bottleneck and residual structures, as these structures have minimal impact on experimental results. The convolutional branch is comprised of six stacked convolutional modules. Each module consists of six parallel one-dimensional convolutional layers with different kernel sizes but identical input and output dimensions. The default kernel sizes are {1, 3, 5, 11, 25, 49}, allowing the extraction of features at different scales. The input and output dimensions are 6n and n, respectively, enabling feature extraction and dimensionality reduction concurrently, achieving a bottleneck-like effect. Although the convolutional layer with a kernel size of 1 cannot capture features at specific time scales, it effectively preserves the information of the original sequence, resembling the effect of a residual structure. The convolutional branch in this paper simplifies the max-pooling layer in the InceptionTime model, enabling parallel computation of the six convolutional layers to enhance parallelism. The convolutional results are concatenated along the channel dimension, restoring the module’s output dimension to 6n for input into the next convolutional branch.

2.4. Global Frequency Pooling

After the parallel computation of the attention and convolution branches, they are concatenated along the channel dimension and input into a global frequency pooling layer, where the channel dimension is set to 12 n . Following the design of the classical Transformer structure, several fully connected layers are expected to be added for the final output. This paper introduces frequency domain information into the pooling operation and proposes an innovative global frequency pooling layer. This layer extracts features from the results of the dual-branch computation, thereby streamlining the model structure.
The one-dimensional Discrete Cosine Transform (DCT) is defined as follows:
C ( 0 ) C ( 1 ) C ( n 1 ) = 1 N 1 1 1 2 cos π 2 N 2 cos 3 π 2 N 2 cos ( 2 N 1 ) π 2 N 2 cos ( N 1 ) π 2 N 2 cos 3 ( N 1 ) π 2 N 2 cos ( 2 N 1 ) ( N 1 ) π 2 N x ( 0 ) x ( 1 ) x ( N 1 )
Here, C represents the sequence obtained after the DCT transformation, and x is the original sequence.
As observed from the previous DCT and DFT transformation formulas, the first element of the output results from both DCT and DFT, i.e., the “DC component”, involves summing all the data in the sequence. This process is analogous to global average pooling. The difference lies in the normalization coefficients of DFT and DCT, which do not affect the results. Pooling operations are employed to extract effective features and reduce dimensions. Global average pooling characterizes only the “DC component” information of the sequence. To obtain more comprehensive features, this paper introduces other frequency domain information, namely the “AC components”, enriching the feature extraction methods from a frequency domain perspective.
The process of global frequency pooling is as follows: Firstly, the data are transformed into the frequency domain to acquire frequency domain signals. Subsequently, P features (defaulting to 5) are selected as the output. Four methods for selecting frequency domain features are designed in this paper: The first method involves selecting several low-frequency components from low to high. The second method is to select several maximum values from the frequency domain signal. The third and fourth methods involve uniformly dividing the frequency domain into several segments and selecting the average or maximum value for each frequency domain band. The last two methods can more comprehensively reflect information from the entire frequency domain.
The frequency pooling layer analyzes each dimension separately. If the input data have dimensions of ( 12 n , s e q _ l e n ), the output data dimensions after the frequency pooling layer will be ( 12 n , P ), where P s e q _ l e n . The specific experimental section will discuss in detail the impact of different frequency domain processing methods on the experimental results.

3. Experiment Results and Evaluation

3.1. Experiment Setup

We conducted experiments in various aspects, including position encoding, the attention mechanism, the feedforward layer, and the global frequency pooling layer. Comparisons are made with other state-of-the-art methods in time series processing. The network model is implemented using Python 3.6.8 + PyTorch 1.10.0, and the experiments are conducted on a Tesla V100-SXM2-32GB GPU. The experimental data are sourced from multidimensional datasets in publicly available datasets such as UCR, UEA, and Monash [22], categorized into classification and prediction tasks. The dataset configurations, including training set size, sequence length, and sequence dimensions, remain consistent with the original datasets.
Standardization normalization is applied to all input data in each dimension, following the formula:
x = x μ σ
where x is the standardized normalized data, x is the original data, μ is the mean of the original data, and σ is the standard deviation of the original data. Each experimental data point is obtained by averaging the results of 10 experiments. Each experiment is run for a sufficient amount of time to ensure model convergence.

3.2. Position Encoding

To begin with, we investigate the impact of position encoding on the experimental results. In this segment of the experiments, the global frequency pooling layer incorporates discrete cosine transform for low-dimensional feature extraction. The classification results are presented in Table 1, with accuracy as the performance metric, while the prediction task outcomes are displayed in Table 2, evaluated based on the Root Mean Square Error (RMSE). Consistent with these metrics, other experiments are assessed.
The experimental results from Table 1 and Table 2 underscore the pivotal significance of position encoding. Position encoding demonstrates the ability to enhance model performance to a certain extent. Particularly notable is the reduction in RMSE across seven distinct prediction tasks. Among the twelve classification tasks, seven tasks (indicated by underlined entries in the tables) exhibit a substantial improvement in classification accuracy through the incorporation of position encoding. This highlights the crucial role of position encoding information for both the attention branch and the overall model, despite the presence of a convolutional branch capable of sequentially processing data.
It is noteworthy that, when facing diverse time series tasks, position encoding is not a panacea. For some tasks, the performance improvement brought by position encoding is modest, and in isolated cases, it even leads to a certain degree of degradation in experimental results. However, overall, the addition of position encoding proves effective in enhancing the model’s overall performance.

3.3. Attention Mechanism

The experimental design involves a specific analysis of the comparative performance between the classical self-attention mechanism and the two-dimensional fast Fourier transform. Table 3 and Table 4 provide a detailed juxtaposition of their respective experimental results in classification and prediction tasks.
Comparison of Experimental Results: The 2DFFT model demonstrates excellent performance in effectively approximating the classical self-attention mechanism. Remarkably, in the context of 12 classification tasks, 2DFFT outperforms the classical self-attention mechanism in 6 tasks (underscored data in the table). In the case of 7 prediction tasks, 2DFFT surpasses the classical self-attention mechanism in 2 tasks. Although 2DFFT leads to a slight reduction in experimental results in some tasks, the decline is not significant. Thus, the conclusion can be drawn that, in the realm of time series tasks, 2DFFT serves as an effective surrogate for the classical self-attention mechanism.
Subsequently, an analysis of the parameters and computational requirements of the two methods is conducted. As observed from the table, 2DFFT exhibits a faster computational speed compared to the classical self-attention mechanism, resulting in reduced training times across all tasks. Assume the number of channels is d and the sequence length is S. The classical self-attention mechanism requires a number of operations (i.e., multiply-add operations) of 2 d S 2 + 4 d 2 S , whereas the operation count for the 2DFFT transformation is d S log ( S ) + d S log ( d ) . Moreover, the parameter count for the classic self-attention is 4 d 2 + 4 d , while it is zero for 2DFFT. When the sequence length is 100 and the number of channels is 64, the classic self-attention requires 16 K parameters. However, when the number of channels increases to 512, the parameter count reaches 1 M. It is also worth mentioning that the above parameter counts are for a single transformation; the total count of transformation parameters in the overall model will increase linearly with the number of encoding blocks.
In summary, 2DFFT effectively emulates the classical self-attention mechanism in addition to offering enhanced computational efficiency. Unlike the substantial computational demands of the classical self-attention mechanism, the Fourier transform requires no predetermined parameters. Therefore, we opt to use 2DFFT for the implementation of the attention mechanism.

3.4. Feedforward Layer

This section outlines the experiments designed to specifically analyze optimization methods for the feedforward layer. Firstly, a comparison is made between the single-layer “Add + Norm” structure and the classical bilinear layer structure. The formula for the classical bilinear layer is given by:
y = BatchNorm ( SelfAttention ( x ) + x ) FFN ( y ) = GELU ( y W 1 + b 1 ) W 2 + b 2 y = BatchNorm ( FFN ( y ) + y )
Here, x represents the original input data; y is the output after applying self-attention to x; W 1 , b 1 , W 2 , b 2 are the weights and biases of the feedforward neural network within the Transformer layer, respectively; and y is the final output of the layer.
From the experimental results in Table 5 and Table 6, it can be observed that simplifying the feedforward layer not only did not compromise experimental performance but actually improved it. This is attributed to the fact that the feedforward layer does not perform any attention mechanism computations. In Transformer-like networks, the feedforward layer is responsible for introducing residual connections and enhancing the modeling capacity of the model through linear transformations. In the network model proposed in this paper, these tasks are handled by the convolutional branch, allowing for simplification of the feedforward layer, which is a module with complex computational requirements.

3.5. Global Frequency Pool

In this section, the experiments are designed to analyze the global frequency pooling layer with two variables: the frequency domain transformation method and the feature selection method. The experiments reveal that due to the diversity of time series tasks, it is challenging to select a single best-performing frequency pooling method. Different frequency domain transformation methods and feature extraction methods show significant differences in performance for different tasks. However, through experimenting with various frequency pooling methods, it is found that introducing frequency domain information can greatly enhance experimental results, both for classification and prediction tasks.
Table 7 and Table 8 present a comparison between the optimal models using different global frequency pooling methods and global average pooling. From the experimental data in the tables, it is evident that, in the seven prediction tasks listed, all frequency pooling methods outperform global average pooling. Among the twelve classification tasks, only one task exhibits lower classification accuracy with frequency pooling compared to global average pooling. Additionally, for datasets such as PEMS-SF and StandWalkJump, global frequency pooling significantly improves classification accuracy.

4. Customized Computational Deployment

Deep learning networks are divided into two major steps: training and inference. During the training process, weights are continuously updated through learning, while in the inference process, the weights are fixed and no longer updated. The customized computational implementation in this work is focused on the inference part of the model. Leveraging the parallel nature of the dual-branch network and harnessing the flexible and efficient characteristics of FPGA devices, the algorithm undergoes customized computational optimization to accelerate the inference process.

4.1. Parallel Pipeline Design

This paper implements the entire system with customized computation deployment, and the overall network structure consists of three parts: the convolutional branch, attention branch, and pooling output. The convolutional branch consists of six identical convolution modules, each module containing six convolution layers computed in parallel. The convolutional branch and attention branch run in parallel. The attention branch is composed of three attention modules, each module containing two FFT and one “Add + Norm” operation. Through experimental design and optimization, the runtime of one attention module is approximately close to the computation time of two convolution modules. This structure enables the convolutional branch and attention branch to complete computations almost simultaneously and input data into the global frequency domain pooling layer. The pipeline structure allows each submodule to compute different tasks simultaneously, improving the model throughput. The specific pipeline architecture is shown in Figure 1:

4.2. Operator Fusion

In the customized computation implementation, we have chosen DCT and low-dimensional information as features for global frequency domain pooling. We employ the matrix of DCT coefficients for the implementation of DCT. In the model design, the frequency domain pooling is followed by the fully connected layer used for output results. The DCT transformation and the fully connected layer can be expressed as follows:
x c = W c x y = W x c + b
Here, x represents the input data, x c denotes the output features of the DCT transformation combined with low-dimensional information extraction, y is the output data, representing either classification or prediction results, W c is the DCT coefficient matrix with only the first P rows, W is the weight matrix of the fully connected layer, and b is the bias matrix. The frequency domain pooling and the fully connected layer can be fused, constructing a new computation method:
y = W n x + b
where W n = W c · W , and W n can be precomputed and deployed in the FPGA system. This operator fusion greatly simplifies the pooling output layer, requiring only the parameters and computational cost of the final fully connected layer to complete the entire process of frequency domain transformation, feature extraction, and output computation.

4.3. System Structure

This paper employs the Xilinx Ultra96V2 (144 GOPS @200 MHz) device manufactured by Xilinx, San Jose, CA, USA for experimentation. The device is an edge computing device with limited on-chip resources, featuring 0.95 M on-chip memory and limited storage resources. The Ultra96V2 is a PYNQ development board that supports upper-level CPU programming in Python for task scheduling.
To enhance operational efficiency, this paper quantizes single-precision floating-point numbers into 8-bit fixed-point numbers. After quantization, the parameter count of the basic model (consisting of six convolutional modules and three attention modules) is 37.28 M. Due to the limited on-chip memory, it is not feasible to deploy all parameter information on-chip. Therefore, the parameters are deployed in external storage DRAM.
As shown in Figure 2, the upper-level CPU in the system is responsible for task scheduling and utilizes DMA to transfer data. Time series data are stored in DRAM, and two buffers are allocated, employing a ping-pong buffer structure for data preparation and preprocessing. This optimized data transfer structure aims to improve the throughput of the entire system.

4.4. Results and Discussion

Here, a summary of the results and comparisons between the proposed model and other state-of-the-art time series algorithms, including InceptionTime, LSTM, BiLSTM, ResNet, and MiniRocket is presented. The tables present the optimal performance metrics for each algorithm, and an additional column indicates the ranking of the proposed model among all models in the experimental data.
From the experimental results presented in Table 9 and Table 10, it is evident that the proposed algorithm in this paper demonstrates excellent performance in both classification and prediction tasks when compared to five other advanced time series algorithms. However, we observed that our model achieved the lowest RMSE on the AppEnergy dataset but ranked fourth in the Covid3Month dataset. This finding necessitated a deeper analysis of the performance variations. Firstly, the AppEnergy dataset is characterized by its series having more pronounced periodicity and regularity, which aligns well with our model’s strong capability in trend capturing and periodic analysis. Our model effectively identifies and leverages these characteristics to enhance prediction accuracy. In contrast, the Covid3Month dataset’s time series may be influenced by nonlinear factors and abrupt events, complicating the forecasting process. While our model excels in capturing long-term trends, it may not be as adept as some specially designed models in handling such nonlinear and sudden changes. In summary, the proposed model consistently achieves top-ranked results in most datasets, often securing the first position in terms of experimental effectiveness. While the model is not flawless and, in some tasks, may rank second or third, the differences are marginal compared to the optimal results for those tasks. Overall, the model presented in this paper attains state-of-the-art performance across a variety of time series tasks.
In this section, a system test is conducted using three-channel time series data with a length of 512 as an example. The final operating frequency of the customized computing system is set at 200 MHz, with a power consumption of 6.380 W. The system achieves a speed of 32.6 FPS, and the resource utilization is summarized in Table 11. Compared to the 300 W power consumption of the Tesla V100, the customized computing system demonstrates a 47.02 times reduction in power consumption.

5. Conclusions

This paper presents a customized computing algorithm design for multidimensional time series, introducing a dual-branch model with a parallel architecture. The use of positional encoding and global frequency domain pooling both enhance the model’s performance in different ways, while the utilization of two-dimensional fast Fourier transform and simplified feedforward layers greatly reduces the number of parameters and improves operational efficiency. Comparative results with other advanced time series algorithms on public datasets demonstrate the superior performance of our algorithm. Additionally, the algorithm proposed in this paper is implemented in edge devices for custom computational deployment. The design includes a coarse-grained dual-branch parallel architecture and a fine-grained parallel structure for convolution operations. Furthermore, a pipeline architecture between submodules is designed to enhance overall operational efficiency, significantly reducing the overall system power consumption.

Author Contributions

Conceptualization, J.Y.; investigation, J.Y.; methodology, J.Y.; supervision, J.Y., Y.F. and Z.H.; validation, J.Y.; writing—original draft, J.Y.; writing—review and editing, J.Y. and Z.H. All authors have read and agreed to the published version of the manuscript.

Funding

This work is supported by the National Key Research and Development Project (Grant No. 2021YFB2206302) and the National Ministry of Industry and Information Technology High-quality Development Project (Grant No. E412151).

Data Availability Statement

The data presented in this study are available in this article.

Acknowledgments

The authors would like to express their gratitude to all those who helped them during the writing of this manuscript. The authors owe their sincere gratitude to friends and colleagues who gave them much enlightening advice and encouragement.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30, 5998–6008. [Google Scholar]
  2. Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
  3. Radford, A.; Narasimhan, K.; Salimans, T.; Sutskever, I. Improving Language Understanding by Generative Pre-Training. 2018. Preprint. Available online: https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf (accessed on 28 February 2024).
  4. Zerveas, G.; Jayaraman, S.; Patel, D.; Bhamidipaty, A.; Eickhoff, C. A transformer-based framework for multivariate time series representation learning. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, Virtual, 14–18 August 2021; pp. 2114–2124. [Google Scholar]
  5. Ismail Fawaz, H.; Lucas, B.; Forestier, G.; Pelletier, C.; Schmidt, D.F.; Weber, J.; Webb, G.I.; Idoumghar, L.; Muller, P.A.; Petitjean, F. Inceptiontime: Finding alexnet for time series classification. Data Min. Knowl. Discov. 2020, 34, 1936–1962. [Google Scholar] [CrossRef]
  6. Lin, Y.; Koprinska, I.; Rana, M. Temporal convolutional attention neural networks for time series forecasting. In Proceedings of the 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 18–22 July 2021; pp. 1–8. [Google Scholar]
  7. Shih, S.Y.; Sun, F.K.; Lee, H.Y. Temporal pattern attention for multivariate time series forecasting. Mach. Learn. 2019, 108, 1421–1441. [Google Scholar] [CrossRef]
  8. Qin, Y.; Song, D.; Chen, H.; Cheng, W.; Jiang, G.; Cottrell, G. A dual-stage attention-based recurrent neural network for time series prediction. arXiv 2017, arXiv:1704.02971. [Google Scholar]
  9. Khodabakhsh, A.; Ari, I.; Bakır, M.; Alagoz, S.M. Forecasting multivariate time-series data using LSTM and mini-batches. In Data Science: From Research to Application; Springer: Cham, Switzerland, 2020; pp. 121–129. [Google Scholar]
  10. Guo, M.H.; Liu, Z.N.; Mu, T.J.; Hu, S.M. Beyond self-attention: External attention using two linear layers for visual tasks. IEEE Trans. Pattern Anal. Mach. Intell. 2022, 45, 5436–5447. [Google Scholar] [CrossRef] [PubMed]
  11. Wu, C.; Wu, F.; Qi, T.; Huang, Y.; Xie, X. Fastformer: Additive attention can be all you need. arXiv 2021, arXiv:2108.09084. [Google Scholar]
  12. Xu, J.; Sun, X.; Zhang, Z.; Zhao, G.; Lin, J. Understanding and improving layer normalization. Adv. Neural Inf. Process. Syst. 2019, 32, 4383–4393. [Google Scholar]
  13. Shen, S.; Yao, Z.; Gholami, A.; Mahoney, M.; Keutzer, K. Powernorm: Rethinking batch normalization in transformers. In Proceedings of the International Conference on Machine Learning, Virtual, 12–18 July 2020; pp. 8741–8751. [Google Scholar]
  14. Shazeer, N. Glu variants improve transformer. arXiv 2020, arXiv:2002.05202. [Google Scholar]
  15. Shazeer, N.; Mirhoseini, A.; Maziarz, K.; Davis, A.; Le, Q.; Hinton, G.; Dean, J. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv 2017, arXiv:1701.06538. [Google Scholar]
  16. Wu, Z.; Liu, Z.; Lin, J.; Lin, Y.; Han, S. Lite transformer with long-short range attention. arXiv 2020, arXiv:2004.11886. [Google Scholar]
  17. Sukhbaatar, S.; Grave, E.; Bojanowski, P.; Joulin, A. Adaptive attention span in transformers. arXiv 2019, arXiv:1905.07799. [Google Scholar]
  18. Yang, Y.; Wang, L.; Shi, S.; Tadepalli, P.; Lee, S.; Tu, Z. On the sub-layer functionalities of transformer decoder. arXiv 2020, arXiv:2010.02648. [Google Scholar]
  19. Lin, M.; Chen, Q.; Yan, S. Network in network. arXiv 2013, arXiv:1312.4400. [Google Scholar]
  20. Qin, Z.; Zhang, P.; Wu, F.; Li, X. Fcanet: Frequency channel attention networks. In Proceedings of the IEEE/CVF international Conference on Computer Vision, Virtual, 11–17 October 2021; pp. 783–792. [Google Scholar]
  21. Lee-Thorp, J.; Ainslie, J.; Eckstein, I.; Ontanon, S. Fnet: Mixing tokens with fourier transforms. arXiv 2021, arXiv:2105.03824. [Google Scholar]
  22. Tan, C.W.; Bergmeir, C.; Petitjean, F.; Webb, G.I. Monash University, UEA, UCR time series extrinsic regression archive. arXiv 2020, arXiv:2006.10996. [Google Scholar]
Figure 1. Dual-branch parallel pipeline structure, where the convolutional branch and the attention branch operate in parallel.
Figure 1. Dual-branch parallel pipeline structure, where the convolutional branch and the attention branch operate in parallel.
Electronics 13 01357 g001
Figure 2. Custom computing architecture.
Figure 2. Custom computing architecture.
Electronics 13 01357 g002
Table 1. Compare the accuracy of non-position encoding and position encoding in classification tasks.
Table 1. Compare the accuracy of non-position encoding and position encoding in classification tasks.
DatasetNon-Position EncodingPosition Encoding
EthanolConcentration0.26380.2586
FaceDetection0.67000.6711
Handwriting0.66240.6647
Heartbeat0.64880.6829
JapaneseVowels0.87840.9162
NATOPS0.86670.8833
PEMS-SF0.83820.8497
PhonemeSpectra0.22160.2320
RacketSports0.86840.8553
SpokenArabicDigits0.74350.7835
StandWalkJump0.40000.4667
UWaveGestureLibrary0.89060.8844
Tasks underlined exhibit a substantial improvement.
Table 2. Compare the RMSE of non-position encoding and position encoding in forecast tasks.
Table 2. Compare the RMSE of non-position encoding and position encoding in forecast tasks.
DatasetNon-Position EncodingPosition Encoding
AppliancesEnergy3.10023.0068
Covid3Month0.11720.0809
FloodModeling10.03280.0240
FloodModeling20.02400.0209
FloodModeling30.04950.0413
IEEEPPG30.083925.1032
LiveFuelMoistureContent51.500951.3536
Table 3. Comparison of self-attention mechanism and 2DFFT in classification tasks.
Table 3. Comparison of self-attention mechanism and 2DFFT in classification tasks.
DatasetClassical Self-Attention2DFFT
Accuracy Times (s) Accuracy Times (s)
EthanolConcentration0.2395460.258631
FaceDetection0.68026380.6595507
Handwriting0.6412290.664722
Heartbeat0.6683230.682917
JapaneseVowels0.9162300.916222
NATOPS0.8722170.883312
PEMS-SF0.8439330.803523
PhonemeSpectra0.19153900.2320283
RacketSports0.8750180.855312
SpokenArabicDigits0.80406880.8835430
StandWalkJump0.333380.46676
UWaveGestureLibrary0.8594130.884410
Table 4. Comparison of self-attention mechanism and 2DFFT in forecast tasks.
Table 4. Comparison of self-attention mechanism and 2DFFT in forecast tasks.
DatasetClassical Self-Attention2DFFT
RMSE Times (s) RMSE Times (s)
AppliancesEnergy2.9991233.00686
Covid3Month0.0550170.080910
FloodModeling10.0416510.024032
FloodModeling20.0191520.020931
FloodModeling30.0258440.041329
IEEEPPG29.659119825.1032143
LiveFuelMoistureContent51.605239651.3536262
Table 5. Comparison of the accuracy of classic FFN and simplified FFN in classification tasks.
Table 5. Comparison of the accuracy of classic FFN and simplified FFN in classification tasks.
DatasetClassic FFNSimplified FFN
EthanolConcentration0.23570.2586
FaceDetection0.67200.6595
Handwriting0.68240.6647
Heartbeat0.66340.6829
JapaneseVowels0.91080.9162
NATOPS0.85000.8833
PEMS-SF0.85550.8035
PhonemeSpectra0.22190.2320
RacketSports0.84870.8553
SpokenArabicDigits0.90000.8835
StandWalkJump0.40000.4667
UWaveGestureLibrary0.85630.8844
Table 6. Comparison of the RMSE of classic FFN and simplified FFN in forecast tasks.
Table 6. Comparison of the RMSE of classic FFN and simplified FFN in forecast tasks.
DatasetClassic FFNSimplified FFN
AppliancesEnergy3.45743.0068
Covid3Month0.11260.0809
FloodModeling10.03600.0240
FloodModeling20.03510.0209
FloodModeling30.05490.0413
IEEEPPG35.632825.1032
LiveFuelMoistureContent57.459851.3536
Table 7. Comparison of the accuracy of global average pool and global frequency pool in classification tasks.
Table 7. Comparison of the accuracy of global average pool and global frequency pool in classification tasks.
DatasetGlobal Average PoolGlobal Frequency Pool
EthanolConcentration0.27760.3004
FaceDetection0.68390.6862
HandMovementDirection0.52700.5270
Heartbeat0.65370.7707
JapaneseVowels0.89190.9162
NATOPS0.87780.9000
PEMS-SF0.79770.8786
PhonemeSpectra0.21710.2574
RacketSports0.86840.8947
SpokenArabicDigits0.84810.8249
StandWalkJump0.33330.6667
UWaveGestureLibrary0.86250.9063
Table 8. Comparison of the RMSE of global frequency pool and global average pool in forecast tasks.
Table 8. Comparison of the RMSE of global frequency pool and global average pool in forecast tasks.
DatasetGlobal Average PoolGlobal Frequency Pool
AppliancesEnergy2.81042.6043
Covid3Month0.05750.0477
FloodModeling10.05390.0168
FloodModeling20.02940.0209
FloodModeling30.03230.0241
IEEEPPG25.091023.3082
LiveFuelMoisture50.466646.3127
Table 9. The comparison of accuracy in classification tasks with other methods.
Table 9. The comparison of accuracy in classification tasks with other methods.
DatasetInceptionTimeLSTMBiLSTMResNetMiniRocketOursRanking
EthanolConcen0.25100.24710.25100.25100.25480.30041
FaceDetection0.66170.57010.58430.53920.58310.68621
Handwriting0.59530.06710.05650.45760.46710.52702
Heartbeat0.67800.64390.63900.51710.68780.77071
JPVowels0.95140.78110.79730.92160.59190.91623
NATOPS0.90000.68890.67780.88330.86670.90001
PEMS_SF0.83240.79770.89020.82660.82080.87862
RacketSports0.84210.70390.70390.79610.72370.89471
SpokenArabic0.56210.78540.85680.59390.34830.82492
StandWalkJump0.40000.20000.33330.40000.40000.66671
UWaveGesture0.68440.35000.36560.70630.59690.90631
Table 10. The comparison of RMSE in forecast tasks with other methods.
Table 10. The comparison of RMSE in forecast tasks with other methods.
DatasetInceptionTimeLSTMBiLSTMResNetMiniRocketOursRanking
AppEnergy10.23617.73705.73999.969411.31292.60431
Covid3Month0.04780.04310.04240.04641.24440.04774
FloodModeling10.01790.01810.01800.01691.07120.01681
FloodModeling20.01280.01830.01810.01410.84820.01292
FloodModeling30.02280.02240.02240.02250.63710.02141
IEEEPPG31.612453.813331.08942.797739.781623.30821
LiveFuelMois47.437241.161441.198546.409642.226341.31273
Table 11. Resource utilization.
Table 11. Resource utilization.
ResourceUtilizationAvailableUtilization (%)
LUT49,62070,56070.32
FF79,823141,12056.56
BRAM20021692.59
DSP360360100.0
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Yu, J.; Feng, Y.; Huang, Z. A Dual-Branch Structure Network of Custom Computing for Multivariate Time Series. Electronics 2024, 13, 1357. https://doi.org/10.3390/electronics13071357

AMA Style

Yu J, Feng Y, Huang Z. A Dual-Branch Structure Network of Custom Computing for Multivariate Time Series. Electronics. 2024; 13(7):1357. https://doi.org/10.3390/electronics13071357

Chicago/Turabian Style

Yu, Jingfeng, Yingqi Feng, and Zunkai Huang. 2024. "A Dual-Branch Structure Network of Custom Computing for Multivariate Time Series" Electronics 13, no. 7: 1357. https://doi.org/10.3390/electronics13071357

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop