<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Spatial-temporal Transformer Network with Self-supervised Learning for Trafic Flow Prediction</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Zhangzhi Peng</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xiaohui Huang</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Trafic flow prediction plays a critical role in improving the quality, security, and eficiency of Intelligent Transportation Systems (ITS). Accurate prediction requires modeling spatial and temporal characteristics simultaneously. Existing works usually extract the spatial features by CNN-based modules and temporal features by RNN-based modules. However, the CNNbased modules are locally biased, performing poorly in global spatial dependencies; and the RNN-based modules concentrate on learning the high-level temporal dynamics (e.g., periodicity), and fail to consider the numerical closeness between future data and historical observations as a strong prior knowledge for the prediction. To alleviate these limitations, we propose a Spatial-temporal Transformer Network with Self-supervised Learning (ST-TSNet). ST-TSNet uses a Pre-Conv Block and vision transformer to learn the spatial dependencies in both local and global contexts. Furthermore, a skip connection from the input of historical records to the output prediction is introduced to utilize similar patterns to improve the prediction results. Finally, a self-supervised strategy called stochastic augmentation is proposed to explore spatial-temporal representations from massive trafic data to benefit the prediction task. Experiments on two datasets, TaxiBJ and TaxiNYC, demonstrate the efectiveness of ST-TSNet. The codes is available at https://github.com/pengzhangzhi/spatial-temporal-transformer.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        few abrupt changes, showing many similarities in
adjacent frames. As depicted in the time series of Fig.1, the
Trafic flow prediction is a build block in Intelligent Trans- ratio of current trafic flow to the previous one (shown
portation Systems (ITS), which is essential for providing in blue line) floats up and down within a fixed ratio of
high-quality trafic service. An accurate prediction of 1 as the trafic flow (shown in orange line) periodically
future trafic flow data depends on modeling the spatial- evolves. This means that adjacent trafic flow snapshots
temporal information from the previous observations. have a close value and exhibit similar distribution. Thus,
This problem can be considered from the spatial and tem- an intuitive idea is to use historical observations as the
poral perspectives. From the spatial perspective, learn- base prediction for future data. Such motivation provides
ing the local spatial correlations is essential since trafic a prior knowledge that forces the model to predict the
fuvolume is most influenced by its nearest neighbors. How- ture data partially based on the original historical records
ever, in real-world scenarios, two distant regions may be instead of completely depending on the extracted
tempostrongly correlated in their tracfi distributions as they ral patterns. However, such similarity is overlooked in
feature the similar functionality (e.g., transportation hub). existing methods [
        <xref ref-type="bibr" rid="ref2 ref5">5, 2</xref>
        ], as they process the historical data
Most of existing works [
        <xref ref-type="bibr" rid="ref1 ref2 ref3">1, 2, 3</xref>
        ] adopt the convolutional for high-order temporal characteristics (e.g., periodicity),
layers as their backbone to extract the spatial features, distorting the numerical similarity.
which may introduce short-range bias due to their small With the rapid growth of trafic sensors deployed, a
receptive field. These methods perform well in extract- massive amount of trafic flow data is collected but not
ing local context while hindering in global dependencies. fully utilized. Similarly, in the field of natural language
Recently, Vision transformer (ViT) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] has shown impres- processing (NLP), TB-level unlabel corpus are collected
sive performance in computer vision, due to its innate but relatively fewer label data is available for various
power at extracting non-local features. We are motivated language tasks. The gap , however, in NLP is successfully
to apply ViT to learn the long-range spatial dependencies. alleviated by self-supervised learning [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], where unlabel
      </p>
      <p>
        From the temporal perspective, many works have been data are utilized to learn language representations and
proposed to extract complex temporal patterns, e.g., daily then transferred to facilitate downstream tasks. While
and weekly periodicity [
        <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
        ]. However, we argue that in the field of trafic flow prediction, current training
a simple temporal characteristic: temporal similarity is algorithms are supervised learning, where the
historioverlooked. Trafic flow data are generally smooth with cal records are regarded as input and the trafic data in
STRL’22: First International Workshop on Spatio-Temporal Reasoning the next timestamp is served as label. No efective
unand Learning, July 24, 2022, Vienna, Austria supervised learning algorithms are proposed to learn
* Corresponding author. spatial-temporal representations to facilitate the trafic
$ pengzhangzhics@gmail.com (Z. Peng); hxh016@gmail.com lfow prediction task.
(X. Huang©)2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Driven by these analyses, we propose a novel
frameCPWrEooUrckReshdoinpgs IhStpN:/c1e6u1r3-w-0s.o7r3g ACttEribUutRion W4.0oInrtekrnsahtioonpal (PCCroBYce4.0e).dings (CEUR-WS.org) work called Spatial-temporal Transformer Network with
Skip Connection
      </p>
      <p>Fusion</p>
      <p>ViT
Pre-Conv
Block</p>
      <p>−2</p>
      <p>ViT
Pre-Conv</p>
      <p>Block
concatenate</p>
      <p>−</p>
      <p>−6 …   −1  
  −3</p>
      <p>Past
Pre-training strategy</p>
      <p>Present</p>
      <p>Conv3
Conv1</p>
      <p>MSEloss</p>
      <p>ViT</p>
      <p>Traffic flow map
Future</p>
      <p>Time</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <sec id="sec-2-1">
        <title>Self-supervised Learning (ST-TSNet). ST-TSNet consists</title>
        <p>
          of a Pre-Conv Block and ViT for learning spatial
correlations in both local and global contexts. In addition, Trafic Flow Prediction . There are two types of flow
we directly connect the historical data to the output to data in the trafic flow prediction task: grid-like raster
make full use of the historical data as the base predictions. data and graph data and thus two distinct paradigms are
Lastly, a self-supervised task named stochastic augmen- derived for the two types of data [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. In our work, we
tation is proposed to pre-train our ST-TSNet to learn focus on raster data. Existing mainstream trafic
predicspatial-temporal representations and fine-tune them to tion methods for raster data fall into one of the following
benefit the prediction task. classes: statistical methods or deep learning methods.
        </p>
        <p>
          The contributions of this work are summarized as fol- Statistical methods include auto-regressive integrated
lows. moving average (ARIMA) [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ], Kalman filtering [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] and
historical average. These methods often require strong
• We propose a novel framework Spatial-temporal and trivial theoretical assumptions, which may violate
Transformer Network with Self-supervised Learn- the nonlinearity of trafic flow data, thus having poor
ing (ST-TSNet) to capture spatial-temporal fea- performance in the real world. Recent advances have
tures. witnessed the impressive capacity of deep learning to
• We employ a simple yet efective skip connection extract nonlinear features from big data [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. Many
restrategy, plugged into ST-TSNet, to make full use searchers are inspired to apply deep learning to handle
of the temporal similarities in trafic flow data. trafic flow prediction task. Existing deep learning
meth• We introduce self-supervised learning to our ods are based on convolutional neural networks (CNNs)
framework and design a pre-training task and recurrent neural networks (RNNs) [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]. ST-ResNet
called stochastic augmentation to explore spatial- [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] first employs the CNNs with residual connections to
temporal features to boost trafic flow prediction learn the spatial dependencies and construct historical
task. data into diferent branches according to the temporal
• We conduct extensive experiments on two bench- semantics to learn temporal features. Similar ideas are
marks (TaxiBJ and TaxiNYC) to evaluate the ef- adopted by subsequent works [
          <xref ref-type="bibr" rid="ref12 ref2">2, 12</xref>
          ] in which 3D
convofectiveness of our methods and the results show lution is used to learn the spatial-temporal dependencies.
that our ST-TSNet outperforms state-of-the-art Moreover, RNN-based models [
          <xref ref-type="bibr" rid="ref13 ref14">13, 14</xref>
          ] are inspired to
methods. use convolutional layer to capture spatial features and
sequential hierarchy (e.g., LSTM and GRU) to extract outflow, and H and W denote the number of rows and
temporal patterns. However, these methods are time- columns of the grid map, respectively. The purpose of
consuming as they make predictions step by step and trafic flow prediction is to predict  given historical
may sufer gradient vanishing or explosion when captur- trafic flow records ℎ = {x |  = 0, . . . ,  − 1}. As
ing long-range sequences [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. To alleviate the problems, shown in Fig.1, the historical data is summarized into
[
          <xref ref-type="bibr" rid="ref15 ref16">15, 16</xref>
          ] discard the recurrent chain structure and employ two categories in the time axis: Closeness sequence
Multiplicative Cascade Unit (CMU) with autoencoders  = {− 1, − 2, · · · , − (− 1), −  } ∈
while preserving the convolutional layers for learning R2× × ×  is a concatenation of recent
hisspatial features. The methods used by existing works can torical data where  is the length of
closebe considered from spatial and sequential perspectives. ness sequence. Trend sequence  =
Fmraoimnstthreeasmpa,tiinacllpuedrisnpge2cDtivaen,dco3nDvoclountivoonlualtiloany.erFsroamre tthhee {R2×−××,is− a 2c·oncate, n·· · atio,no−f pe·riodic}historica∈l
sequential perspective, there are many choices, including data from the past few weeks, where  is the length of
RNN, GRU, LSTM and CMU. Most existing works are trend sequence,  is the number of intervals within
a combination of these methods. In summary, existing a week.
methods that based on CNNs sufer from short-range
bias as the small receptive field limits their capacity to 3.2. Spatial-temporal Transformer
extract global dependencies.
        </p>
        <p>
          Self-supervised Learning. Self-supervised learning Network
is a great way to extract training signals from massive Overall, we employ a symmetric structure for handling
amounts of unlabelled data and to learn general represen- the trend data  and and the closeness data :
tation to facilitate downstream tasks which the labelled a Pre-Conv Block followed by a ViT with two shortcuts
data are limited. To generate supervision information (i.e., two blue lines shown in Fig.1) from the input to the
from data, a general strategy is to define pre-training fusion layer. In the end, fusion layer adaptively merges
tasks for models [
          <xref ref-type="bibr" rid="ref17 ref18">17, 18</xref>
          ] to learn semantic representa- four components (two residual components ˆ and ˆ,
tions, and then transfer them to downstream tasks to two outputs ˆ and ˆ) to generate prediction
improve performance and robustness. Many works in ˆ.
computer vision have defined various tasks based on Pre-Conv Block. The trafic flow in a region is highly
heuristic methods[
          <xref ref-type="bibr" rid="ref19 ref20">19, 20</xref>
          ]. For example, [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] learns vi- relevant to its nearby regions. We design a Pre-Conv
sual representations by predicting the image rotations. Block for capturing such short-range dependencies. As
In natural language processing (NLP), masked language illustrated in Fig.1, Conv1 and Conv2 are the main
conmodeling, e.g., Bert [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] have shown to be excellent for volutional layers to capture short-range dependencies.
pre-training language models. These methods mask a Thus, we employ a small kernel size ( i.e., 3 × 3) which
portion of the input sequence and train models to predict leads to the receptive field of 5. Such design ensures the
the missing content with the rest. Such methods are efec- Pre-Conv Block only captures the local dependencies at
tive for learning semantic correlations of elements within most in 5 × 5 regions. The short-range dependencies
a sequence, e.g., sentence. The trafic flow data can also are well-captured by the Pre-Conv Block while leaving
be viewed as a sequence temporally, while the efective- the long-range features to the vision transformer.
Inness of self-supervised learning remains unexplored in serting CNNs before ViT has shown to be efective in
trafic flow prediction task. strengthening the capacity of ViT [
          <xref ref-type="bibr" rid="ref22">22</xref>
          ]. Conv3 is the
residual shortcut, employing 64 kernels with size 1 × 1,
3. Methods which adds up to the main branch as a residual
component. Generally, we will use much more kernels (e.g., 64)
than that in Conv4. By enlarging and then reducing the
3.1. Problem Formulation number of channels, Pre-Conv Block can learn various
We partition a city into an image-like grid map according spatial-temporal dependencies and then refine them into
the longitude and latitude, as shown in the trafic flow a compact feature map.
map of Fig.1, where each grid denotes a region. The Vision transformer. We apply vision transformer (ViT)
value of a grid denotes the trafic flow (inflow or outflow). [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] after the Pre-Conv Block to capture the global
depenThe device deployed at a region will periodically record dencies, as shown in the right of Fig.1. ViT is comprised of
the number of people arriving at and departing from two main components: “Patchify” stem and transformer
the location to collect the inflow and outflow. The encoder. “Patchify” stem spatially splits the input feature
trafic flow map of the entire city at time  is noted map into non-overlap  ×  patches and linearly projects
as xt ∈ R2× ×  , where 2 refers to the inflow and patches into tokens. Each token contains the information
of a patch of regions. Then the tokens are fused with
learnable positional encoding to preserve the 2D
positional information and fed into transformer encoder. The
encoder utilizes a multi-head self-attention mechanism to
model the long-range dependencies followed by a layer
normalization and residual connection (Add &amp; Norm)
to the next sub-layer, where a Feed Forward Network
(FFN) and another Add &amp; Norm are employed to further
process the tokens. Lastly, the tokens are averaged and
then linearly transformed to generating output:ˆ
and ˆ.
        </p>
        <p>Skip Connection. Skip Connection are employed to pre-trained data (Ω ,  )
transfer similar patterns from the historical observations predictions ˆ ←  (Ω)
to the output as the base prediction. To preserve the origi- loss ←  (ˆ,  )
nal similar patterns in historical data, we directly connect ()
input  and  to the fusion layer, as shown in the blue update 
line of Fig.1. Before connecting, we aggregate histori- until stop criteria is met;
cal input data in the time dimension to match the shape.</p>
        <p>For two historical sequences  ∈ R2× × ×  and
 ∈ R2× × ×  , we compute:</p>
      </sec>
      <sec id="sec-2-2">
        <title>Algorithm 1 The pre-training procedure with stochastic</title>
        <p>augmentation.</p>
      </sec>
      <sec id="sec-2-3">
        <title>Input: MASA model:  , closeness data: , trend</title>
        <p>data: , and predicted future data: .</p>
        <p>Output: pre-trained MASA model.
repeat
 ←  ∪  ∪ 
target  ← ()</p>
        <p>
          Remaining snapshots Ω ←  − 
the rest to predict the target. Such scheme can be
expanded to three cases: (1) if the last frame is selected as
the target, then this is similar to supervised training, the
ˆ =  () ∈ R2× 1× ×  , (1) historical records are used to predict future data; (2) if the
ˆ =  () ∈ R2× 1× ×  , (2) earliest frame is the target, then future observations are
used to predict the past frame, as shown in the green axis
where ˆ and ˆ are the two residual compo- of Fig.1; (3) if any intermediate frame is selected as the
nents.  (· ) is an aggregation function R2× × ×  → target, then the historical data and future observations
R2× 1× ×  , where  denotes the length of historical are used to predict present, as shown in the red axis of
data sequence. Here we use a summation function. Fi- Fig.1. Diferent from the downstream prediction task,
nally, the two residual components will be fused in the where input historical records and future data are paired
fusion layer. to be the training samples, our stochastic augmentation
Fusion Layer. The degree of influence of the four compo- produces several times more samples for pretraining by
nents (i.e., two outputs ˆ, ˆ and two residual randomly constructing input-target pairs. For example,
components ˆ, ˆ) is diferent, and the influence given a group of five frames, the supervised learning only
in diferent regions also varies. Therefore, to dynami- gives one training sample as stated in case (1). While our
cally calibrate their contributions, we follow [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ] to use stochastic augmentation paradigm yields five pretraining
a parametric-matrix-based fusion method, where the pa- samples (every frame in the group is selected to be the
rameter matrices are learned from historical data. For- target once), five times more samples than supervised
mally, training. With the large amount of pretraining samples,
our models can explore useful spatial-temporal
represenˆ = · ˆ +  · ˆ+ tations for the downstream prediction task. Specifically
(3) for the trafic flow prediction task, we define the group
 · ˆ +  · ˆ, as the union of closeness data, trend data, and predicted
where · denotes element-wise multiplication,  is the
learnable parameter that measures the influence of each
component.
        </p>
        <sec id="sec-2-3-1">
          <title>3.3. Self-supervised Learning with</title>
        </sec>
        <sec id="sec-2-3-2">
          <title>Stochastic Augmentation</title>
          <p>Our stochastic augmentation aims to pretrain our model
to learn general spatial-temporal features to facilitate the
prediction task. The pretraining strategy is conceptually
simple: we select a group of continuous trafic frames,
randomly sample a frame as the predicted target and use
ground truth:  =  ∩  ∩ . Then
we randomly sample one snapshot as the target  and
the rest data Ω =  −  as the input,
constructing pre-training data (Ω ,  ) to pre-train our model. The
algorithm is depicted in Alg.1.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>4. Experiments</title>
      <sec id="sec-3-1">
        <title>4.1. Dataset and Evaluation</title>
        <sec id="sec-3-1-1">
          <title>Dataset. Our experiments are based on two trafic flow</title>
          <p>datasets: TaxiBJ and TaxiNYC. Additional external data</p>
          <p>
            • TaxiBJ [
            <xref ref-type="bibr" rid="ref23">23</xref>
            ]: TaxiBJ is a citywide crowd flow
dataset collected every half hour in Beijing. Based
on the geographic area of Beijing, we partition
the Beijing city into 32 × 32 regions.
• TaxiNYC [
            <xref ref-type="bibr" rid="ref16">16</xref>
            ]: TaxiNYC is the taxi trip record
dataset collected every one hour in New York
City. New York City is divided into 16 × 8 regions
based on the longitude and latitude1.
predicted target back to the original value. We split the
last 28 days as the test set for both datasets, and the
remaining are regarded as training data. During training,
we select 90% of the training data for training models
and the remaining 10% is the validation set to early-stop
our training algorithm. Our model is implemented and
trained by PyTorch. We use Adam [
            <xref ref-type="bibr" rid="ref25">25</xref>
            ] as the optimizer
with a learning rate of 0.001 for TaxiBJ and 0.005 for
TaxiNYC. Cosine learning rate decay is employed to
adjust the learning rate at each iteration. The batch size is
128 for both TaxiBJ and TaxiNYC. We run our model for
600 epochs on TaxiBJ and 800 epochs on TaxiNYC. Our
ViT has two blocks, and the patch size is set to (8, 8); the
token dimension is set to 128; the number of attention
heads is 2; the size of FFN is 512.
          </p>
        </sec>
        <sec id="sec-3-1-2">
          <title>1The raw records are available at the NYC government website. A</title>
          <p>processed version for experiments is available at github</p>
        </sec>
        <sec id="sec-3-1-3">
          <title>Evaluation Metric. Three metrics: Rooted Mean</title>
          <p>
            Square Error (RMSE), Mean Absolute Percentage Error 4.3. Quantitative Comparison
(MAPE), and Absolute Percentage Error (APE) are used
to evaluate our proposed method. We follow previous Table 1 shows the comparing results against the
stateworks that compute the metrics on trafic flow value of-the-art methods. We compare our ST-TSNet with the
that is larger than 10 to ensure a fair comparison. We following baselines: HA, ST-ResNet [
            <xref ref-type="bibr" rid="ref23">23</xref>
            ], MST3D [
            <xref ref-type="bibr" rid="ref12">12</xref>
            ],
conducted experiments ten times for reliable results and ST-3DNet [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ], 3D-CLoST [
            <xref ref-type="bibr" rid="ref14">14</xref>
            ], STAR [
            <xref ref-type="bibr" rid="ref24">24</xref>
            ], and PredCNN
presented the means and standard variances of the re- [
            <xref ref-type="bibr" rid="ref15">15</xref>
            ]. The results of the baselines are from [
            <xref ref-type="bibr" rid="ref16">16</xref>
            ].
sults. On TaxiBJ, our method exceeds the SOTA
STREEDNet in terms of MAPE and APE and achieves comparable
4.2. Implementation Details results in RMSE. While on TaxiNYC, our method
significantly outperforms the SOTA ST-ResNet across all
Min-Max normalization is applied in our experiments metrics by a fair margin (1.53 RMSE, 4.61 MAPE, and
to scale the data to range [
            <xref ref-type="bibr" rid="ref1">− 1, 1</xref>
            ] and denormalize the 1.35E+05 APE improvement).
          </p>
          <p>ST-TSNet has a more significant performance
improvement on TaxiNYC than TaxiBJ. The possible reason of
(a) Predictions on consecutive time
(b) A prediction sample for each method
(e) Absolute error of the above predictions
(d) Residual</p>
          <p>weight
(c) Self-attention map
the improvement is that the amount of data of TaxiNYC the predictions of each method at diferent time intervals.
is twice that of TaxiBJ (41,856 vs. 20,016), which sig- The magnified subplot reveals that our method has better
nificantly facilitates the pre-training. This result prove accuracy in predicting the peak. Fig.2 (b) spatially
visuthe efectiveness of the self-supervised learning module alizes a prediction sample of each method, and Fig.2 (e)
proposed in our method. STREED-Net and STAR have displays the absolute errors of these predictions,
demonimpressive performance on TaxiBJ against other base- strating that our ST-TSNet has lower prediction errors
lines due to the simple single-branch design. However, than baselines. Fig.2 (c) shows the self-attention map for
such simple architecture performs worse than ours in four reference patches. The visualizations are produced
a larger dataset TaxiNYC (1.88 RMSE higher than our by attention scores computed via query-key product in
ST-TSNet) as there are rich spatial-temporal information the ViT. We use the pentagram-marked regions as query,
that a single-branch structure can not extract efectively. and show which patch (region) they attend to. The four
Although STREED-Net and PredCNN both introduce cas- corner patches usually attend to remote regions (brighter
cading hierarchical structure in their backbone, STREED- color meaning higher attention scores) while caring less
Net has better performance than PredCNN. The reason about their neighbors. The reason is that the short-range
is that STREED-Net additionally introduces channel and features are perfectly captured and encoded into tokens
spatial attention mechanisms to dynamically refine the by Pre-Conv Block, resulting in the ViT focusing more on
learned features to generate predictions. Nevertheless, the long-range features. Fig.2 (d) visualizes the weights of
the cascading hierarchical structure still sufers from inflow and outflow of two residual components.
Combinshort-range bias as it only allows distant snapshots to ing the ground truth in Fig.2 (c), we observe that although
interact at higher layers. ST-ResNet, STAR, and Pred- the weights vary in diferent regions and difer from
inCNN introduce a 2D convolutional layer, and MST3D, flow to outflow, they tend to concentrate on the regions
ST-3DNet, and 3D-CloST employ 3D convolution. The with higher trafic flow. The reason is that these regions
3D convolutional layer is better than the 2D counterparts show a more regular time series, having more similar
as it can additionally capture temporal features, while patterns in residual components.
2D convolutions are restricted to only capture spatial
features. However, they all sufer from short-range bias 4.5. Ablation Study
due to the small receptive field of convolution.
Moreover, they do not introduce the skip connection and any
additional pre-training strategies, resulting in inferior
performance.</p>
          <p>To verify the efectiveness of proposed methods, we
design a list of variants by appending modules step by step
and comparing them on TaxiBJ and TaxiNYC. The basic
variant is Vision transformer (ViT). We separately append
skip connection (SC), Pre-Conv Block (PC), and
stochastic argumentation pre-training (SA) to ViT to construct
other variants. We further consider the external factors
on our ST-TSNet (ST-TSNet (w Ext)). We use an external</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>4.4. Qualitative Analysis</title>
        <sec id="sec-3-2-1">
          <title>We ofer four intuitive visualizations of proposed meth</title>
          <p>
            ods to explain their behaviors in Fig.2. Fig.2 (a) compares
module (two-layer multilayer perceptron) to model the
external features according to [
            <xref ref-type="bibr" rid="ref5">5</xref>
            ]. The external data is
transformed and added together with the main output to
yield prediction.
          </p>
          <p>The results in Table 2 show that: 1) the full version
of the our methods (i.e., ST-TSNet (w Ext)) achieves the
best performance. 2) Adding each module step by step
will progressively improve the performance. It suggests
that each module is an indispensable component for our
ST-TSNet.</p>
          <p>We additionally study the strategy of the skip
connection by introducing a new residual component: the
Pre-Conv Block output . We investigate two
connection strategies: additionally and solely connect 
to the fusion layer. Results show that the two strategies
degrade performance (1.66 and 1.35 RMSE degradation),
suggesting that the  is harmful for prediction. The
performance degradation may be caused by the
convolutional operations in Pre-Conv Block disrupt the semantic
information in historical data (e.g., trafic distributions),
resulting in the  and predicted target have diferent
distributions. In contrast, the historical records ( 
and ) and the predicted target are collected from
the same distribution and temporally correlated. Thus
the historical records share similar patterns with the
predicted target that can directly contribute to the prediction,
while the  confuses the model.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>5. Conclusion</title>
      <sec id="sec-4-1">
        <title>In this paper, we present a novel trafic prediction frame</title>
        <p>work, spatial-temporal Transformer Network with
Selfsupervised Learning (ST-TSNet) for learning
spatialtemporal features. ST-TSNet is equipped with Pre-Conv
Block and ViT to capture local and spatial dependencies.
In addition, we observe the similarity in trafic flow data,
which enables us to take advantage of the historical data
as the base prediction for the future. Finally, we propose
a pretext task named stochastic argumentation to enable
models to further explore spatial-temporal
representations under limited data. Experiments on two datasets
demonstrate the superiority of our proposed methods.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <sec id="sec-5-1">
        <title>This research was funded by the National Natural Sci</title>
        <p>ence Foundation of China under Grant No.62062033, and
the Natural Science Foundation of Jiangxi Province
under Grant No.20212BAB202008. Zhangzhi, in particular,
would like to thank his father Jianhua Peng and mother
Changmei Zhang for countless love and support during
the work was developed. I love you all.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Qi</surname>
          </string-name>
          ,
          <article-title>Deep spatio-temporal residual networks for citywide crowd flows prediction</article-title>
          ,
          <source>in: Proc. of AAAI</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Guo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Lin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wan</surname>
          </string-name>
          ,
          <article-title>Deep spatial-temporal 3d convolutional neural networks for trafic data forecasting</article-title>
          ,
          <source>IEEE Transactions on Intelligent Transportation Systems</source>
          (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Fang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , G. Meng,
          <string-name>
            <given-names>S.</given-names>
            <surname>Xiang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Pan</surname>
          </string-name>
          , Gstnet:
          <article-title>Global spatial-temporal network for trafic flow prediction</article-title>
          ,
          <source>in: Proc. of IJCAI</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Dosovitskiy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Beyer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kolesnikov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Weissenborn</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Unterthiner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dehghani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Minderer</surname>
          </string-name>
          , G. Heigold,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gelly</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Uszkoreit</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Houlsby</surname>
          </string-name>
          ,
          <article-title>An image is worth 16x16 words: Transformers for image recognition at scale</article-title>
          ,
          <source>in: Proc. of ICLR</source>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Qi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Yi</surname>
          </string-name>
          ,
          <article-title>Dnn-based prediction model for spatio-temporal data</article-title>
          ,
          <source>Proceedings of the 24th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems</source>
          (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J.</given-names>
            <surname>Devlin</surname>
          </string-name>
          , M.-
          <string-name>
            <given-names>W.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Toutanova</surname>
          </string-name>
          , BERT:
          <article-title>Pre-training of deep bidirectional transformers for language understanding</article-title>
          ,
          <source>in: Proc. of ACL</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>X.</given-names>
            <surname>Yin</surname>
          </string-name>
          , G. Wu,
          <string-name>
            <given-names>J.</given-names>
            <surname>Wei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Qi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Yin</surname>
          </string-name>
          ,
          <article-title>Deep learning on trafic prediction: Methods, analysis and future directions</article-title>
          ,
          <source>IEEE Transactions on Intelligent Transportation Systems</source>
          (
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B. M.</given-names>
            <surname>Williams</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. A.</given-names>
            <surname>Hoel</surname>
          </string-name>
          ,
          <article-title>Modeling and forecasting vehicular trafic flow as a seasonal arima process: Theoretical basis and empirical results</article-title>
          ,
          <source>Journal of Transportation</source>
          Engineering-asce (
          <year>2003</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>J. hua Guo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Huang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. M.</given-names>
            <surname>Williams</surname>
          </string-name>
          ,
          <article-title>Adaptive kalman filter approach for stochastic short-term trafic flow rate prediction and uncertainty quantification</article-title>
          , Transportation Research Part C-emerging
          <string-name>
            <surname>Technologies</surname>
          </string-name>
          (
          <year>2014</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>R.</given-names>
            <surname>Salakhutdinov</surname>
          </string-name>
          ,
          <article-title>Deep learning</article-title>
          ,
          <source>in: Proc. of KDD</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Lv</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Duan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Kang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Trafic flow prediction with big data: A deep learning approach</article-title>
          ,
          <source>IEEE Transactions on Intelligent Transportation Systems</source>
          (
          <year>2015</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Teo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Vijay</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Feng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zeng</surname>
          </string-name>
          ,
          <article-title>Exploiting spatiotemporal correlations with multiple 3d convolutional neural networks for citywide vehicle flow prediction</article-title>
          ,
          <source>2018 IEEE International Conference on Data Mining (ICDM)</source>
          (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. C. Y.</given-names>
            <surname>Chen</surname>
          </string-name>
          , J. Liu,
          <article-title>Lstm network: a deep learning approach for short-term trafic forecast</article-title>
          ,
          <source>Iet Intelligent Transport Systems</source>
          (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Fiorini</surname>
          </string-name>
          , G. Pilotti,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ciavotta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Maurino</surname>
          </string-name>
          , 3dclost:
          <article-title>A cnn-lstm approach for mobility dynamics prediction in smart cities</article-title>
          ,
          <source>2020 IEEE International Conference on Big Data (Big Data)</source>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Long</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Wang</surname>
          </string-name>
          , Predcnn:
          <article-title>Predictive learning with cascade convolutions</article-title>
          ,
          <source>in: Proc. of IJCAI</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>S.</given-names>
            <surname>Fiorini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ciavotta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Maurino</surname>
          </string-name>
          ,
          <article-title>Listening to the city, attentively: A spatio-temporal attention boosted autoencoder for the short-term flow prediction problem, ArXiv preprint (</article-title>
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>R.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Isola</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Efros</surname>
          </string-name>
          ,
          <article-title>Colorful image colorization</article-title>
          ,
          <source>in: Proc. of ECCV</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>D.</given-names>
            <surname>Pathak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Krähenbühl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Donahue</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Darrell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Efros</surname>
          </string-name>
          , Context encoders:
          <article-title>Feature learning by inpainting</article-title>
          ,
          <source>in: Proc. of CVPR</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>I.</given-names>
            <surname>Misra</surname>
          </string-name>
          ,
          <string-name>
            <surname>L. van der Maaten</surname>
          </string-name>
          ,
          <article-title>Self-supervised learning of pretext-invariant representations</article-title>
          ,
          <source>in: Proc. of CVPR</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>M.</given-names>
            <surname>Noroozi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Favaro</surname>
          </string-name>
          ,
          <article-title>Unsupervised learning of visual representations by solving jigsaw puzzles</article-title>
          ,
          <source>in: Proc. of ECCV</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>S.</given-names>
            <surname>Gidaris</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Komodakis</surname>
          </string-name>
          ,
          <article-title>Unsupervised representation learning by predicting image rotations</article-title>
          ,
          <source>in: Proc. of ICLR</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>A.</given-names>
            <surname>Hassani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Walton</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Shah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abuduweili</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Shi</surname>
          </string-name>
          ,
          <article-title>Escaping the big data paradigm with compact transformers</article-title>
          ,
          <source>ArXiv abs/2104</source>
          .05704 (
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Qi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Yi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Predicting citywide crowd flows using deep spatiotemporal residual networks</article-title>
          ,
          <source>Artif. Intell</source>
          . (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>H.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Su</surname>
          </string-name>
          ,
          <article-title>Star: A concise deep learning framework for citywide human mobility prediction</article-title>
          ,
          <source>2019 20th IEEE International Conference on Mobile Data Management (MDM)</source>
          (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Kingma</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ba</surname>
          </string-name>
          ,
          <article-title>Adam: A method for stochastic optimization</article-title>
          ,
          <source>in: Proc. of ICLR</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>