Spatial-Temporal Transformer for 3D Point Cloud Sequences

Effective learning of spatial-temporal information within a point cloud sequence is highly important for many down-stream tasks such as 4D semantic segmentation and 3D action recognition. In this paper, we propose a novel framework named Point Spatial-Temporal Transformer (PST2) to learn spatial-temporal representations from dynamic 3D point cloud sequences. Our PST2 consists of two major modules: a Spatio-Temporal Self-Attention (STSA) module and a Resolution Embedding (RE) module. Our STSA module is introduced to capture the spatial-temporal context information across adjacent frames, while the RE module is proposed to aggregate features across neighbors to enhance the resolution of feature maps. We test the effectiveness our PST2 with two different tasks on point cloud sequences, i.e., 4D semantic segmentation and 3D action recognition. Extensive experiments on three benchmarks show that our PST2 outperforms existing methods on all datasets. The effectiveness of our STSA and RE modules have also been justified with ablation experiments.


Introduction
Point cloud sequences provide both spatial and temporal information of a scene over a period and can be applied in various vision tasks such as 4D semantic segmentation and 3D action recognition. With the rapid development of dynamic point cloud acquisition technologies (such as LiDARs and depth cameras), point cloud sequences are becoming increasingly available and have been investigated for different applications, such as self-driving vehicles, robotics, and augmented reality.
4D semantic segmentation is challenging due to several reasons. First, different from regular and dense 2D image sequences, raw point cloud sequences usually have a regular order in the temporal domain but are unordered in the spatial domain. Besides, point clouds are usually highly sparse. Therefore, it is extremely difficult to model the spatiotemporal structure in a point cloud sequence. Second, it is hard to predict the motion of points within a point cloud sequence. However, the construction of spatio-temporal neighborhoods rely on tracking the motion of points across different frames. It is therefore, difficult to effectively extract and aggregate the spatio-temporal context information of points within inter-frame neighborhoods.
Recently, several methods have been proposed to capture the spatio-temporal dynamics of points from point cloud sequences by utilizing cross-frame information. These methods can be roughly divided into voxel-based methods [5,15] and point-based methods [20,2,19,8]. A voxel-based method converts a 3D point cloud sequence into regular sparse voxels and then extracts pointwise features via a network with 3D convolutions or sparse convolutions. Due to the introduction of quantization error, the performance of this approach is limited. A point-based method constructs a spatial-temporal neighborhood for each seed point (e.g., sampled by Farthest Point Sampling (FPS)), and then applies Multi-Layer Perceptron (MLP) to extract point-wise features. It then passes these features backward and aggregates them with the features of subsequent frames using an inter-frame feature fusion strategy.
Although existing point-based methods can avoid the quantization error by directly processing raw point cloud sequences, they still face two major challenges. First, existing methods usually adopt attention operations [2,19] or Recurrent Neural Network (RNN) models [15,8] to fuse inter-frame features. However, since these methods reply on long-term dependency, the inter-frame information fusion conducted at a frame depends on the fusion of the information of all its previous frames, leading to information redundancy. It is necessary for an inter-frame feature fusion strategy to capture spatio-temporal point context information while reducing the redundancy of previous frames. Besides, current semantic segmentation methods mainly adopt an encoder-decoder architecture. The encoder usually consists of multiple hierarchically stacked feature extraction layers (e.g., the set abstraction layer [24]) and extracts rich semantic features by reducing the resolution of its feature maps. Therefore, information loss is introduced and the Figure 1. The architecture of our P ST 2 model. Our P ST 2 model is employed for two tasks: 4D semantic segmentation (as shown in (a)) and 3D action recognition (as shown in (b)). In the 4D semantic segmentation task, we apply two set abstraction layers to extract features, and then employ the Resolution Embedding (RE) module to recover the lost geometric information of the extracted features. Next, we perform convolution on the features of adjacent frames to obtain spatial-temporal patches, and then fed these patches into a Spatio-Temporal Self-Attention (STSA) module to capture spatial-temporal context information. Finally, we use multiple Feature Propagation (FP) layers to produce point-wise semantic predictions. In the 3D action recognition task, we insert our STSA module into the MeteorNet [20] model to achieve action recognition. segmentation performance is decreased.
In this paper, we propose a novel Point Spatial-Temporal Transformer (P ST 2 ) network to tackle the above two challenges. First, we introduce a self-attention based module, i.e., Spatio-Temporal Self-Attention (STSA), to capture inter-frame spatial-temporal context information. More specifically, our P ST 2 model adaptively aggregates these correlated inter-frame neighborhood features based on the self-attention operation instead of fusing all previous frames. Consequently, the redundancy is reduced, the training speed is increased, and the robustness is improved (with residual connection and layer normalization). Second, we introduce a Resolution Embedding (RE) module to enhance the resolution (which is lost in the encoderdecoder architecture). By aggregating inter-neighborhood features with the attention weights, the resolution can be enhanced and the segmentation performance can be improved significantly. To further demonstrate the effectiveness of our point spatial-temporal transformer, we introduce a new framework to leverage the proposed STSA module for action recognition from 3D point clouds. Experiments on the Synthia [25], SemanticKITTI [1], and MSR-Action3D [18] datasets demonstrate that our P ST 2 model outperforms existing methods [20,2].
The contributions of this paper are summarized as follows: 1) We propose a self-attention based module (namely, STSA) to capture point dynamics in point cloud sequences. It is shown that this module can encode the spatio-temporal features from point cloud sequences.
2) We introduce an RE module to enhance the resolution of feature maps. This module clearly improves the segmentation performance.
3) Our P ST 2 model is tested with two different tasks: 4D semantic segmentation and 3D action recognition. Experiments on three datasets show that the proposed STSA and RE modules can easily be plugged into exiting static point cloud processing pipelines to achieve improved performance.

Related Work
In this section, we briefly review those works that are highly related to our method, i.e., deep learning method on static point clouds, deep learning method on 3D point cloud sequences, and the transformer.

Deep Learning on Static Point Clouds
Deep learning has been widely used in many point cloud tasks, such as classification [23,24,13], part segmentation [37,14,36], semantic segmentation [35,17,31,12], reconstruction [6,39], and object detection [4,22,11]. Existing methods for deep learning on static point clouds can be roughly divided into multi-view based, volumetricbased, and point-based methods. Multi-view based meth-ods [27,34] first project a point cloud into multiple views and extract view-wise features, and then fuse these features for static point cloud processing. Volumetric-based methods [21,32] convert a point cloud into regular 3D voxels and then employ 3D Convolution Neural Network (CNN) or sparse convolution on the volumetric representation. These two approaches introduce quantization errors and exhibit performance declination, while point-based methods directly work on raw point clouds and reduce the quantization error.
PointNet [23] is a pioneering work of point-based methods. Qi et al. [23] used several MLP layers to extract point-wise local features and adopted a max-pooling layer to aggregate these features. The local features and the aggregated global features are then concatenated to predict the category of each point. In follow-up work, Qi et al. [24] introduced a hierarchical structure and multi-scale feature learning mechanism into PointNet++, thereby improving the performance of scene semantic segmentation. Subsequent works have been proposed based on the improvement of PointNet++ [24]. However, these methods cannot directly process dynamic point cloud sequences due to the lack of the inter-frame feature fusion strategy.

Deep Learning on 3D Point Cloud Sequences
In recent years, two major mainstream methods focusing on 3D dynamic point cloud sequences have been explored.
Several voxelization based methods have been proposed to handle dynamic point cloud sequences. MinkowskiNet et al. [5] first converted 3D point cloud sequences into 4D occupancy grids, and then employed sparse 4D convolution to process 4D occupancy grids. In 3D Sparse Conv LSTM, Huang et al. [15] voxelized 3D point cloud sequences into sparse 4D voxels and convolved them on a sparse grid, then passed the memory and hidden features through a sparse convolution inside the LSTM network. The LSTM network produces hidden and memory features that will be passed to the next frame and fused with features of subsequent frames.
Several methods directly working on raw point cloud sequences have also been explored. MeteorNet [20] is a leading deep learning method for dynamic 3D point cloud sequences. The structure of MeteorNet [20] is inherited from PointNet [23]. By proposing two grouping approaches (including direct grouping and chained-flow grouping) to construct spatio-temporal neighborhoods, inter-neighborhood features are aggregated to capture point dynamics in the point cloud sequence. Cao et al. [2] proposed an Attention and Structure Aware (ASAP) model, which contains a novel grouping approach (i.e, Spatio-Temporal Correlation) to construct spatio-temporal neighborhoods and a novel attentive temporal embedding layer to fuse the related inter-frame local features in a recurrent fashion. Our Point Spatial-Temporal Transformer P ST 2 is also directly performed on raw point cloud sequences, but aims at enhancing the resolution when capturing spatio-temporal dynamics across entire point cloud sequences.

Transformer
Transformer is a typical deep neural network based on the self-attention mechanism and particularly suitable for modeling long-range dependencies.
Transformer was first proposed in [28] for the sequenceto-sequence machine translation task, and then extended to various computer vision tasks. In computer vision tasks, image features are obtained from a backbone network and converted into sequences, and then a transformer-based network is employed to process sequence-form features. DEtection TRansformer (DETR) [3] is a landmark work that considers object detection as a set prediction problem. Specifically, an image is first divided into several candidate regions, and then the object in candidate regions is classified. Recently, transformer has been used in various computer vision applications, including image classification, high/mid-level vision, low-level vision, and video processing. In these applications, Transformer excels to process video sequences and has extended many video tasks, such as video retrieval [26], action recognition [9], and video object detection [38]. The Video Instance Segmentation Transformer (VisTR) [33] extends DETR [3] for video object instance segmentation (VIS). Specifically, frame-level features are concatenated and fed into a Transformer, and then instance predictions are produced.
Very recently, Transformer is extended from video tasks to point cloud tasks with promising results. Guo et al. [40] proposed a novel transformer-based framework (namely, Point Cloud Transformer (PCT)) for static point cloud learning. They used self-attention to design an offsetattention layer to model irregular point clouds. Zhao et al. [10] proposed a Point Transformer (PT) layer to fuse point cloud features.
However, there are few prior Transformer applications to model point cloud sequences. Intuitively, Transformer has the advantage of modeling long-range dependencies and should be an ideal candidate for point cloud sequences tasks. Therefore, we propose the P ST 2 model to model spatial-temporal information in point cloud sequences with Transformer.
Our P ST 2 model is different from the transformers designed in PCT [10] and PT [40]. First, our STSA module introduces skip connection and layer normalization operations based on the self-attention operation. Besides, our STSA module divides the input features of the adjacent frame into spatial-temporal patches for further processing, while the input feature is directly processed in [10,40]. Consequently, our module is better at capturing the spatial-temporal context information than [10,40].

Point Spatial-Temporal Transformer P ST 2
In this section, we first use 4D semantic segmentation as an example to describe our Point Spatial-Temporal Transformer network P ST 2 , including the overall architecture, the step for spatial-temporal neighborhood construction, the Resolution Embedding (RE) module, and the Spatio-Temporal Self-Attention (STSA) module. We then adapt the proposed module for 3D action recognition.

Overview Architecture
For 4D semantic segmentation, which is a point-level classification task, our P ST 2 model takes a multi-frame point cloud sequence as its input, and predicts the category of each point in the point cloud sequence. Our P ST 2 model adopts an encoder-decoder architecture. Specifically, the encoder consists of a backbone, an RE module and an STSA module, and the decoder includes multiple Feature Propagation (FP) layers. The FP layer is originally introduced in PointNet++ [24] to interpolate the semantic features extracted by the encoder upwards and predict the semantic category of each point.
As illustrated in Fig. 1 (a), given a point cloud sequence, three steps are adopted to capture point dynamics in our P ST 2 model. First, we use a backbone network (including two set abstraction layers [24]) to construct the spatialtemporal neighborhoods and extract point features in each frame (Sec. 3.1.2). Then, we adopt the proposed RE module to enhance the resolution of features in each frame (Sec. 3.1.3). Finally, we employ the proposed STSA module to fuse the inter-frame features and produce the predictions (Sec. 3.1.3).

Spatial-Temporal Neighborhood Construction
Given a point cloud sequence j } m j=1 can be sampled from S t by the FPS method [23,24], where m is the number of seed points and m < n.
We first sample the seed points in the first frame S 1 , and groups all points within a certain radius around these seed points to form a neighborhood. Next, we use the same seed points in subsequent frames {S 2 , ..., S T } to construct spatial-temporal neighborhoods with stable spatial locations at different times. Then, we apply two set abstraction layers [24] to extract local features h

Resolution Embedding (RE)
Given the feature representation h (t) i , we propose a novel resolution block in the RE module to enhance the resolution of point features in each frame. The RE module consists of a feature block and a resolution block. The feature block was designed to further extract semantic features, while the resolution block extracts the spatial context information from the input features, and treats these context information as an enhanced resolution to incorporate with the features produced by the feature block.
(1) Feature block: As shown in the Fig. 2(a), we perform a set abstraction layer on h i . The set abstraction layer is used in the encoder-decoder architecture to hierarchically extract local (even global) features.
(2) Resolution block: As shown in Fig. 2 1 and m (t) 2 along the spatial dimension, and then concatenate them along the feature dimension to obtain g (t) i . We employ a learnable multi-layer perception f to update the feature dimension of g i . This process aims at effectively extracting the spatial interneighborhood related information.
Once n is calculated based on these two attentions: where the attention weights a 1 and a 2 are calculated as: Figure 3. The architecture of our STSA module. SA, Norm, Smax, T and FF stand for the self-attention operation, the layer normalization function, the softmax operation, the matrix transpose operation, and the feed-forward network, respectively.

Spatio-Temporal Self-Attention (STSA)
Given spatial features I (t) i of each frame, the STSA module is used to incorporate inter-frame features along the temporal dimension and capture the spatio-temporal context information. Intuitively, different inter-frame spatialtemporal neighbors contribute differently to the final results. Specifically, for objects with slow-moving speeds, interframe spatial-temporal neighbors that are closer in space contributed more than those neighbors that are far apart. In contrast, for objects with fast-moving speeds, inter-frame spatial-temporal neighbors that are far in space should also be considered. Transformer-based methods have the potential to learn the correlation within inter-frame spatialtemporal neighborhoods.
As shown in Fig. 3, our STSA module consists of two blocks: spatial-temporal patch division, and self-attention.
(1) Spatial-Temporal Patch Division This block is designed to correlate multiple frame features and generate spatial-temporal patches. Inspired by [7], we first divide spatial features I (t) i into patches and then align these inter-frame spatial patches along the temporal domain based on the same seed points to form spatialtemporal patches. These spatial-temporal patches F input are adjacent along the temporal dimension, and neighborhoods in each patch is consistent along the spatial dimension.
(2) Self-Attention The self-attention mechanism measures intra-term semantic affinities within a data sequence by mapping a query and a set of key-value pairs. Following this mechanism, the self-attention block is designed to learn the similarities of the above spatio-temporal patches. Given query matrix Q, key matrix K, and value matrix V , the query, key and value are generated by linear transformations based on the input features F input ∈ R N ×d : where Q, K, V ∈ R N ×d , W q , W k , W v ∈ R d×d are the shared learnable linear transformation implemented by an MLP function, and d is the dimension of the query and key vectors. We then use the query and key matrices to calculate the attention weights A 1 : These weights are scaled by √ d to produce A 2 = (a 2 ) i,j : A 2 is further then normalized to produce A 3 = (a 3 ) i,j : Then, the features F sa out with self-attention are obtained as the weighted sums of the value vector using their attention weights: Finally, the features produced by self-attention F sa out and the input features F input are further concatenated to obtain the feature F output through residual connection, a feed-forward network F eedF orward(), and a layer normalization function LayerN orm(): The self-attention operation introduces randomness in the initial weights and tends to make the output features different from the input feature semantics. To reduce the influence of this randomness and accelerate the model fitting process, skip connection is used to incorporate the input feature and the output feature. Moreover, the difficulty to converge is a generally recognized problem with the original transformer [28]. Layer normalization is employed to accelerate the model training speed and to improve the robustness of the model by normalizing the output features.

Adaption to 3D Action Recognition
To further evaluate the ability of P ST 2 for modeling dynamic point cloud sequences, we also employ P ST 2 to perform 3D action recognition.
In a sequence-level classification task (e.g., action recognition), our P ST 2 model takes a multi-frame point cloud sequence as its input, and predicts the label of the sequence (e.g., action category). Since the RE module is specifically designed to enhance the resolution of a segmentation network (implemented with an encoder-decoder structure), we remove the RE module in the classification task. In addition, to intuitively show the effectiveness and easy portability of our STSA module, we improve an existing model MeteorNet [20] with our STSA module for action recognition. As shown in Fig. 1(b), we insert the STSA module into the encoding layer of MeteorNet. The remaining settings are the same as those in [20]. Note that, the meteor module proposed in [20] adopts a direct grouping method to roughly group the points in a spatial-temporal neighborhood and further extracts features, which ignore the correlation between these spatial-temporal neighborbors. After inserting our STSA module, more spatial-temporal context information can be obtained and performance can be improved. The effectiveness of the STSA module for a long sequence is evaluated with experimental comparison (see Sec. 4.4).

Experiments
In this section, we first introduce the Synthia [25], Se-manticKITTI [1], and MSRAction3D [18] datasets and their experimental settings in Sec. 4.1. Then, we report our results on these datasets and compare our model with several existing methods (Secs. 4.2 ∼ 4.4). Finally, we provide ablation analyses on two spatial-temporal correlation strategies (i.e., STSA and RE) proposed in this paper and justify their contributions in Section 4.5.

Datasets and Settings
We evaluate our P ST 2 model on the Synthia and Se-manticKITTI datasets for 4D semantic segmentation, and the MSRAction3D dataset for 3D action recognition.

4D Semantic Segmentation
We conducted two 4D semantic segmentation experiments on the large-scale synthetic dataset Synthia [25] and the largest publicly available real LiDAR dataset Se-manticKITTI [1]. Then, we compare our P ST 2 model with the MeteorNet [20], ASAP-Net [2], and MinkNet [5] baselines and perform an ablation study on the SemanticKITTI dataset.
Synthia The dataset consists of six sequences of driving scenarios in nine different weather conditions. Each sequence includes 4 stereo RGB-D images from four viewpoints captured from the top of a moving car. Following [20], we reconstruct 3D point clouds from RGB and depth images, and then employ the FPS method to downsample the point cloud to 16,384 points per frame. We employ the mean Intersection over Union (mIoU) and the mean Accuracy (mAcc) as the evaluation metrics in our experiments.
SemanticKITTI The dataset provides 23,201 frames for training and 20,351 frames for testing. To compare our method with the state-of-the-art method ASAP-Net [2], we follow the multi-frame experiments proposed in [2]. We only use the mean Intersection over Union (mIoU) as the evaluation metric in our experiments.

MSR-Action3D
The MSR-Action3D dataset consists of 567 depth map sequences acquired by Kinect v1. The depth map sequences include 10 different people, 20 categories of actions, and 23,797 frames. We reconstruct point cloud sequences from these depth maps, and use the same train/test split as previous work [20,30]. The overall accuracy is used as the evaluation metric in this experiments.

Implementation Details
The main hyper-parameters adopted in the experiments are reported in Table 1. In our P ST 2 model, we set the number of sampling points in the stacked feature encoding layers as [2048,512,128,64] in the Synthia experiment. Other implementation details, including those for the experiments on Synthia and SemanticKITTI, are set the same as in ASAP-Net [2]. For 3D action recognition, we improve the Me-teorNet [20] baseline with our STSA module, while other settings of the network are the same as MeteorNet [20]. Moreover, we follow the implementation of FPS provided by PointNet++ [24], which is implemented in GPU. All experiments are conducted on an NVIDIA RTX 2080Ti GPU using the ADAM optimizer. Table 2 reports the semantic segmentation results on the Synthia dataset. Our P ST 2 consistently outperforms MinkowskiNet [5], MeteorNet [20], and ASAP-Net [2]. It establishes a new state-of-the-art result with a mIoU of 81.86 and a mAcc of 87.03. Further, our method achieves the best performance under 5 out of 12 categories. This is mainly caused by the fact that our P ST 2 model can capture the spatial-temporal context information in a point cloud sequence.

Evaluation on SemanticKITTI
In the SemanticKITTI experiment, the state-of-the-art method ASAP-Net [2] adopts PointNet++ (PNv2) [24] as its backbone network to be incorporated with our ASAP module. For rigorous comparison, we employ the same encoder as ASAP-Net [2] to incorporate with the proposed STSA and RE module in our P ST 2 . Table 3 shows the semantic segmentation results on the SemanticKITTI dataset. As shown in Table 3, it can seen that our P ST 2 outperforms PNv2 by a large margin (16.4% in mIoU). Further, our P ST 2 surpasses the state-of-the-art method ASAP-Net [2] by 3.2% in mIoU and achieves a consistent performance improvement in 15 out of 19 categories. To provide an intuitive comparison, we visualize two segmentation results from the SemanticKITTI dataset, as shown in Fig. 4. It can be seen that our P ST 2 can accurately segment most objects, even in some complex scenes. For example, as can be seen from the first row of Fig. 4, most points on the objects of the motorcyclist category (c8) and the trunk category (c16) are misclassified as unlabeled category by ASAP-Net [2], but correctly classified by our P ST 2 . This is mainly because our RE module can enhance the resolution of the features in each frame, and our STSA module can better incorporate the spatial-temporal context information between adjacent frames. Table 4 presents the classification results on the MSRAc-tion3D dataset. MeteorNet [20] achieves a significant improvement under the different number of input frames in a sequence by plugging our STSA module. Specifically, given 16 frames in a sequence, our classification pipeline achieves the best performance among these methods, with a mAcc of 89.22. Given 8 frames in a sequence, the most remarkable improvement of 5.39% is achieved by our method. Moreover, it is observed that better classification results can be achieved with more frames in a sequence. That is because, our STSA module can better capture the inter-frame spatial-temporal context information. Given more frames in a sequence, more information can be encoded by our method.

Ablation Study
In this section, we analyze the impacts of two proposed modules on the semanticKITTI dataset.

Method
param (M)  nframe  mIoU  c1  c2  c3  c4  c5  c6  c7  c8  c9  c10  c11  c12  c13  c14  c15  c16  c17  c18   tion of the RE strategy. First, it can be seen from Table 5 that the PNv2 [24] network achieves better performances by incorporating our RE-module (i.e., PNv2+RE). That is, the mIoU is improved by 18.5%. Moreover, with the RE strategy, PNv2+RE outperforms PNv2 in all categories, and the performance is improved by up to 38.9% in the terrain category, and 31.7% in the car category. Second, the RE strategy contributes 4.1% in terms of mIoU, and achieves better performance in all categories. Specifically, the mIoU gains introduced by the RE strategy on all these categories vary from 0.1% to 10.5%. Large improvements can be observed on parking, building, and motorcyclist.

STSA Strategy
The STSA strategy not only improves the static point cloud pipeline with the ability to process point cloud sequences, but also makes the model achieve better performance. The qualification results are reported in Table 5. It can be seen that PNv2+STSA outperforms PNv2 on all categories with our STSA module. Specifically, the performance is improved by 12.3% in terms of mIoU. The improvement is up to 36.5% in the terrain category, and 29.7% in the car category.

Conclusion
In this paper, we proposed a point spatial-temporal transformer framework to effectively modeling raw 3D point cloud sequences. Our P ST 2 model consists of two core modules: the spatio-temporal self-attention module and the resolution embedding module. We apply the STSA module to capture inter-frame spatial-temporal context information, and the RE module to aggregate inter-neighborhood features to enhance the resolution. Extensive experiments demonstrate that our P ST 2 model outperforms existing methods on the tasks of 4D semantic segmentation and 3D action classification. Further, these two modules can be easily plugged into existing static point cloud processing frameworks to achieve remarkable performance improvements.