Hierarchical Attention and Graph Neural Networks: Toward Drift-Free Pose
  Estimation
The most commonly used method for addressing 3D geometric registration is the
iterative closet-point algorithm, this approach is incremental and prone to
drift over multiple consecutive frames. The Common strategy to address the
drift is the pose graph optimization subsequent to frame-to-frame registration,
incorporating a loop closure process that identifies previously visited places.
In this paper, we explore a framework that replaces traditional geometric
registration and pose graph optimization with a learned model utilizing
hierarchical attention mechanisms and graph neural networks. We propose a
strategy to condense the data flow, preserving essential information required
for the precise estimation of rigid poses. Our results, derived from tests on
the KITTI Odometry dataset, demonstrate a significant improvement in pose
estimation accuracy. This improvement is especially notable in determining
rotational components when compared with results obtained through conventional
multi-way registration via pose graph optimization. The code will be made
available upon completion of the review process.
Kathia Melbouci, Fawzi Nashashibi
# Hierarchical Attention and Graph Neural Networks: Toward Drift-Free Pose Estimation

###### Abstract

The most commonly used method for addressing 3D geometric registration is the iterative closet-point algorithm, this approach is incremental and prone to drift over multiple consecutive frames. The Common strategy to address the drift is the pose graph optimization subsequent to frame-to-frame registration, incorporating a loop closure process that identifies previously visited places. In this paper, we explore a framework that replaces traditional geometric registration and pose graph optimization with a learned model utilizing hierarchical attention mechanisms and graph neural networks. We propose a strategy to condense the data flow, preserving essential information required for the precise estimation of rigid poses. Our results, derived from tests on the KITTI Odometry dataset, demonstrate a significant improvement in pose estimation accuracy. This improvement is especially notable in determining rotational components when compared with results obtained through conventional multi-way registration via pose graph optimization. The code will be made available upon completion of the review process.

## I Introduction

Geometric registration is a critical prerequisite for a myriad of subsequent robotics tasks. These encompass surface reconstruction, obstacle avoidance, augmented reality, sensor fusion and more. The Iterative Closest Point (ICP) algorithm, a key tool for estimating geometric registration for point-clouds, operates by aligning consecutive frames which pre-suppose an alignment for initialization.

When tracking consecutive frames, errors can gradually build up, resulting in pose drift. This drift is corrected using optimization techniques [1]. One such technique includes detecting loop closures, where previously visited places are recognized. The goal is to find the rigid (or similarity) transformation that best re-align the frames [2]. Nevertheless, place recognition can lead to false positives, constraining the user to process the optimization part several times to achieve accurate results. Moreover, processing frames with a large number of point clouds to find the optimal matches can be time-consuming, compromising the ability to process in real-time.

In the past few years, several works have investigated the use of new neural network based pipelines to process large point-clouds, essentially attention mechanisms popularized in transformer architectures [3, 4, 5, 6]. More specifically, when applied to point-clouds, the attention vector encodes the relationship between points, disentangles most relevant information from input data [7] and learn to focus on different aspects of temporal patterns [5]. This vector is permutation invariant which makes it better candidate for handling unordered point clouds.

In this work, we undertake an examination of the potential for employing a learned model as an alternative to the conventional geometric registration with pose graph optimization. This idea originates from the questions: Can we replace this complex, computationally-intensive process with a unique learned model?.

Our proposed model operates directly on a bundle of frames instead of processing them sequentially. A key feature of this model is a dual-layer hierarchical attention mechanism applied to the concatenated frames. This mechanism enables the model to selectively concentrate on segments of the sequence that are most pertinent to geometric registration. Within the context of our work, this could mean giving more attention to frames that display substantial motion or notable changes in the environment. To distill and capture only the most essential information, we have utilized the maximum values across various dimensions of the point cloud embeddings.

We have evaluated our approach on the KITTI odometry benchmark [34] to demonstrate that this model can leverage large point clouds generated by recent LiDAR sensors, establishing its potential utility in autonomous vehicle tasks.

The remainder of this paper is organized as follows: Section II discusses the work related to attention mechanisms in point cloud registration. In Section III, we introduce the proposed architecture. Section IV provides details on the experiments we conducted. Finally, Section V concludes the paper and outlines the directions for future work.

## II Related works

For many years, the task of aligning and matching 3D shapes was achieved using classic computer vision techniques. These techniques leverage ICP [8], Feature matching using descriptors [9], and RANSAC [10] to remove outliers.

In the past few years, many research works have focused on the development of new neural network based pipelines for point clouds registration, following the ground-breaking results obtained with these architectures in other domains [11, 12]. However, they faced several challenges: (1) point-sets are irregular and order invariant, (2) scaling up point neural networks to large datasets (N \(>\) 10k points) remains difficult even with the availability of modern hardwares, and (3) the impact of the choice of a specific method on the
performance of deep learning models remains only partially understood [13].

Solutions based on intermediate representations such as meshes and voxels were dominant until PointNet [14] which proposed to leverages multiple MLPs and symmetric functions to process unordered point-clouds directly through 3D coordinates, learning both global and local features, to efficiently perform classification and segmentation tasks.

Since then, the attention mechanism popularized in transformer architecture [3] has proven to be a better candidate for handling unordered point clouds. Indeed, the attention vector is permutation invariant, allows encoding long range dependencies and thus, it is analogous to a weighted adjacency vector.

It has been demonstrated that predictive performances of attention mechanisms for perception and computer vision tasks can be attributed to their similarities with spacial smoothing: (1) they flatten the cost landscapes, (2) they are low-pass filters then less vulnerable to high-frequency noises [15]. When applied to point clouds, the attention vectors have the ability to encode similarity scores between data points, providing a robust tool to understand complex spatial relationships. Furthermore, using multiple attention heads enables to focus on different aspects of temporal patterns.

As a result, several works have leveraged attention mechanisms to learn 3D geometric registration. The initial step in this process is embedding the point clouds in an appropriate space before introducing them to attention blocks. Among these, some works adopt a representation where the point cloud is structured as a graph [16, 17, 18, 19, 20]. The graph takes the Cartesian coordinates of the data points and their associated normals and/or intensities, and outputs a down-sampled point cloud, with the aggregated nearest-neighbor features. The graph representation enables to process irregular point clouds. However, as the size of the point cloud grows, the computational complexity might increase substantially.

To mitigate time complexity, a variety of approaches learns hierarchical features from the point cloud. PadLoc [21] utilizes the PV-RCNN [22] that discretize the point clouds into voxel grids, which are then processed using sparse 3D convolution layers to create a series of feature maps. These maps are combined to generate a bird's eye view (BEV) map from where key points and their associated features are sampled. Lepard [23] uses KpConv [24] that learns deformable kernel points, enhancing its ability to adapt to the local geometry of the point clouds. Super-point based methods [25] divide features from the KpConv into super points where lower layers capture fine-grained local features and higher layers capture more global features.

Other works expand the use of the attention mechanism to non-rigid objects [26]. The approach detailed in [27] incorporates raw 3D shapes into the attention block. The attention vector has been modified to take into account the points' density in a local area. The method cited in [19] use dynamic GCNN architecture [28] for feature extraction and computes the relative drift of point pairs to address the registration task. To better constraint the registration process, an optimal transport loss is used in [29].

The works cited above predominantly focus on utilizing attention mechanisms on a single frame of data, from which they derive rigid transformation by comparing it to a target frame. In this work, we explore the improvements achieved by applying hierarchical attention mechanisms to bundles of frames simultaneously, aligning with multiway registration techniques. We further explore the combination of attention mechanisms and graph neural networks to understand spatial relationships and dynamics, leveraging both local and global contextual information for pose estimation.

## III Algorithm architecture

An overview of our model is shown in Figure 1.

Let \(X\) represent the collection of LiDAR scans, denoted as \(X=\{X_{1},X_{2},\ldots,X_{n}\}\), where each point cloud \(X_{i}=\{p_{1},p_{2},\ldots,p_{M}\}\) is of shape \([M,D]\). Here, \(M\) refers to the number of points \(p_{i}\) in each scan, and \(D\) indicates the dimensionality of the points. For 3D cartesian coordinates, \(D=3\), but \(D\) could be higher if more coordinates are added. We are interested in finding a set of \(n\) rigid transformations, \(\{T_{1},T_{2},\ldots,T_{n}\}\), from the special Euclidean group \(SE(3)\), to align each \(X_{i}\) to a common reference frame \(F_{w}\). Each transformation \(T_{i}\) is expressed as a \((4\times 4)\) matrix including a \((3\times 3)\) rotation matrix \(R_{i}\) from the special orthogonal group \(SO(3)\) and a \((3\times 1)\) translation vector \(t_{i}\).

Without loss of generality, we consider \(F_{w}\) to be identical to \(X_{1}\) for the remainder of the paper.

Point cloud encoderThe initial phase of our architectural framework focuses on generating embeddings for each data point in a given point cloud, denoted as \(E\equiv\{e_{1},e_{2},\ldots,e_{M}\}\).

\[e_{i}=\text{EmbeddingFunction}(p_{i}),\quad\forall p_{i}\in X_{i}\]

To achieve this we employ a variation of the Dynamic Graph CNN (DGCNN) architecture[28]. The first step consists of mapping the point normals into a higher-dimensional feature space through the application of dual convolutional layers. These enriched normal features are combined with the original data points to serve as the input for the DGCNN. This later enables the generation of node representations that integrate both topological connectivity and feature attributes from localized neighborhoods [30].

Hierarchical Attention MechanismIn the second step, we introduce a hierarchical attention mechanism. This consists of dual-stage attention, where the first stage -multihead self attention in Figure 1- focuses on quantifying relationships among points within individual point cloud. It accomplishes this by calculating attention scores based on the embeddings generated for each data point.

\[A_{ij}^{(1)}=\text{softmax}(f(e_{i},e_{j})),\quad\forall e_{i},e_{j}\in E\]

\[e_{i}^{\prime}=\sum_{j}A_{ij}^{(1)}\cdot e_{j}\]

where \(f(\cdot,\cdot)\) is a function that computes a normalized attention score between the features embeddings \(e_{i}\) and \(e_{j}^{\prime}\).
To extract the most salient features from a \(D^{\prime}\)-dimensional space, spanning \(M^{\prime}\) points within each point cloud (where \(D^{\prime}\) and \(M^{\prime}\) are derived from the point cloud encoder), we use a maximum operation to obtain the top \(S\) embeddings.

\[e_{i}^{\prime\prime}=\left\{e_{i\sigma_{1}}^{\prime},e_{i\sigma_{2}}^{\prime}, \ldots,e_{i\sigma_{S}}^{\prime}\right\}\]

\[\forall i\in\{1,2,\ldots,M^{\prime}\}\]

Where \(S\) is the predefined number such that \(1\leq S\leq D^{\prime}\), and \(\sigma\) is a permutation function that sorts the indices of vector \(e_{i}^{\prime}\) in decreasing order based on their corresponding values in vector \(e_{i}^{\prime}\).

The second stage of attention -multi-head cross attention in Figure 1- is designed to encode relationships between points across different sets. This enables our model providing a comprehensive representation that accounts for global context within the point cloud data.

\[A_{kl}^{(2)}=\text{softmax}\left(g(e_{k}^{\prime\prime},e_{l}^{\prime\prime}) \right)\quad\text{for}\quad k\neq l\]

where \(g(\cdot,\cdot)\) is a function that computes a normalized attention score between the features \(e_{k}^{\prime\prime}\) and \(e_{l}^{\prime\prime}\).

\[e_{k}^{\prime\prime\prime}=\sum_{l\neq k}A_{kl}^{(2)}\cdot e_{l}^{\prime\prime}\]

_Rigid Transformation Decoder_To align each point cloud with the global coordinate system, we utilize a Multi-layer Perceptron (MLP) on the \(N\times M^{\prime}\) embeddings derived from the cross-attention module. The initial frame is set as a \((4\times 4)\) identity matrix. The MLP is designed to generate unique feature sets representing both translation and rotation. For translation, it outputs three features, each corresponding to the x, y, and z coordinates.

The rotation representation, however, depends on the specific parametrization approach selected. In this work, we adopt the Gram-Schmidt orthonormalization method [31]. This method is used to project the rotation features outputted by the decoder onto the nearest rotation matrix. In utilizing the Gram-Schmidt orthonormalization, the output rotation of the MLP encompasses a 6-dimensional space, reshaped as \((3\times 2)\) matrix \(W\). The nearest rotation matrix is then retrieved by minimizing the Frobenius norm as illustrated in Eq. 1.

\[\text{argmin}_{R^{*}\in SO(3)}\|R^{*}-W_{3\times 2}\|_{F}^{2}, \tag{1}\]

Nonetheless, it is possible to use the special orthogonal procrustes parametrization as presented by Bregier et al. [32], which includes a total of 9 features for the rotation. The arbitrary \((3\times 3)\) matrix \(W\) produced by the decoder is then projected onto the nearest rotation matrix by minimizing the Frobenius norm (Eq. 2).

\[\text{argmin}_{R^{*}\in SO(3)}\|R^{*}-W_{3\times 3}\|_{F}^{2}, \tag{2}\]

_Loss functions_We formulate the loss function with individual constraint on the translation and rotation components. Since estimating distances tends to be simpler than directly determining absolute poses, we define the loss function as depicted in Eq. (3).

\[\mathcal{L}(\theta)=\alpha f_{t}(\Delta t_{ij}^{*},\Delta t_{ij})+\beta f_{R} (\Delta\mathcal{R}_{ij}^{*},\Delta R_{ij}), \tag{3}\]

Where \(\alpha\), \(\beta\) are weighting factors to balance the contributions of the translational and rotational components respectively. \(f_{t}\) returns the mean squared error (MSE) between the pair \((\Delta t_{ij}^{*},\Delta t_{ij})\) and \(f_{R}\) returns the angular distance \(\delta\) between a pair of rotation matrices, based on the equality \(|\,\Delta R_{ij}^{*}-\Delta R_{ij}\mid_{F}=2\sqrt{2}sin(\delta/2)\).

## IV Experiments

To evaluate the efficacy of our architecture, we benchmarked it against the multiway registration with pose graph optimization as outlined in [10] and available in the Open3D library [33]. We evaluated our model using the KITTI odometry dataset [34] to demonstrate its applicability in scenarios involving a large number of points.

In multiway registration via pose graph optimization a pose graph is created where each node represents a piece of geometry associated with a pose matrix transforming it into a global space. These nodes are linked by edges that signify the relationship and transformations needed to align one piece of

Fig. 1: Graphical Overview of the Ego-Pose Estimation Framework: The pose estimation model takes \(N\) point-clouds as input, with each point cloud represented through a distinct set of embeddings. These embeddings are learned using a Graph Neural Network (DGCNN), which processes them to obtain an enriched representation for each point cloud. These representations are then passed through a hierarchical attention mechanism, that operates in two distinct stages: self-attention and cross-attention. These mechanisms help to capture of both intra and inter-set relationships respectively. Derived self attention scores guide the salient features’ selection, carrying aggregated information to be utilized by the subsequent cross-attention layer, enhancing the comprehensibility of global context in each point cloud. The 6DoF poses decoder leverages this rich representation to deduce the rigid transformations needed to align the point clouds in a common reference frame, guided by the loss function defined in Equation. (3).
geometry with another. The alignments are categorized into two classes: odometry edges for neighboring nodes aligned using local registration techniques like ICP, and loop closure edges for non-neighboring nodes - considered less reliable-aligned through global registration.

To optimize the pose graph, uncertain parameters and information matrices are assigned to the edges, allowing for the identification and pruning of false alignments through a two-pass optimization process. The first pass tries to identify false alignments considering all edges, while the second pass optimizes the alignment without these false alignments.

Different optimization methods and criteria can be selected to suit specific needs and achieve better results. In our experiment we have fixed the voxel size to be 0.05 and we kept the default values -as specified in Open3D- for the remaining parameters [33].

The training of our model is done on single NVIDIA GeForce RTX 2080 Ti with \(\sim\!10G\) memory. We chose to train our model on a one-second window of a specific trajectory, equivalent to roughly \(\sim\!10\) LiDAR scans. These scans are fed sequentially into the model, which outputs a corresponding sequence of rigid poses (Figure 2). It's worth noting that the window parameter, once set during training, can be reduced for inference without requiring retraining. However, increasing the window parameter necessitates specifying the new value and retraining the model from scratch.

Point cloud preprocessingBefore feeding the point cloud data into the graph neural network, we subject it to a series of preprocessing steps. First, we employ voxel downsampling to reduce the data's complexity by decreasing the number of points. Next, we employ the RANSAC algorithm to fit a plane that separates ground features, thereby removing any undesired rough ground surfaces from the data. These procedures are illustrated in Figure 3.

Upon completion of these preprocessing steps, each processed point cloud contains approximately \(70,000\) points. To standardize the tensor sizes, padding is applied to each point cloud to match the dimensions of the largest point cloud.

Rigid pose estimationEach point cloud in the sequence is transformed into vectors with dimensions \([1024,256]\) through the DGCNN network [28]. These vectors serve as inputs to determine attention scores in the first stage of the attention mechanism.

To aggregate this high-dimensional data while retaining the most significant features, we use a max pooling operation. This yields a one-dimensional vector for each point cloud in the batch, capturing the most important attributes from the initial set of 1024 points.

By highlighting the peak value in each feature dimension, we aim to accentuate the most noteworthy characteristics of each point cloud. This leads to a concise yet data-rich 1024-dimension representation for every cloud in the batch, allowing for the preservation of key attributes.

The sequence, configured as [10, 1024], is subsequently processed by an additional attention mechanism to discern the interrelations between distinct point clouds. In our experiments, we've configured both attention mechanisms with 4 heads and 4 layers.

The 6DOF pose decoder, configured as a two-stage Multi-Layer Perceptron (MLP), generates 9-dimensional feature set to represent both translation and rotation. The translation component is represented through three outputs corresponding to the x, y, and z coordinates. Meanwhile, the rotation is represented using six features to project the arbitrary \((3\!\times\!2)\) matrix onto a rotation matrix using special Gram-Schmidt orthonormalization [31], as explained in section III. For this task, we leveraged the Roma library [32], maintaining a value of 1 for both \(\alpha\) and \(\beta\) parameters.

The qualitative results are presented in Figure 4. This Figure showcases the alignment of point clouds using three methods: the ground truth, the multiway registration via pose graph optimization, and our proposed approach. These alignments are demonstrated for select examples from the test trajectories from the KITTI Odometry benchmark [34].

The quantitative results are detailed in Table I. This table presents the average Root Mean Square Error (RMSE) values derived from absolute pose errors, showcasing the performance of our model over various sequences. These averages have been computed across 100 sub-trajectories, with each trajectory containing 10 scans. The RMSE values are differentiated into translational (measured in meters) and rotational (measured in radians) errors to offer a comprehensive view of the trajectory accuracies observed in the different sequences

In the majority of test sequences examined, both methods yielded a largely comparable translational error. However, our learned model presents significantly less rotational error.

Essentially, initializing the pose to estimate using the pre

Fig. 3: Visual comparison of point cloud data from KITTI odometry sequence 5. (a) shows the original, unprocessed point cloud, while (b) displays the point cloud after segmentation to remove rough ground features and reduce the number of points.

Fig. 2: Left: Ten non-aligned scans from Sequence 7 of KITTI odometry benchmark; Right: aligned point clouds using our model-derived poses.
vious frame can indeed make the optimization process easier, especially when dealing with sequences of frames where changes between consecutive frames are relatively small. However, this method can encounter problems when there is significant rotational movement, where the assumption of pose similarity between successive frames may not hold, rendering the method less effective.

The trained model takes advantage of temporal dynamics, reducing its dependence on pose information from the previous data frame, a strategy that gives it better flexibility and adaptability in the search for a wide range of potential solutions.

## V Conclusion

In this work, we presented a learned model for processing point clouds data and determining rigid poses through a deep learning architecture that integrates a dynamic graph neural network with a hierarchical attention mechanism. Our method demonstrated promising results in the rigid pose estimation task, effectively compressing high-dimensional data into a low-dimensional vector representation. This was achieved by leveraging hierarchical attention mechanism and maximum operation to extract the most crucial features of

\begin{table}
\begin{tabular}{l c c c c} \hline \hline Sequence & \multicolumn{2}{c}{Our Model} & \multicolumn{2}{c}{Multiway registration via Pose Graph Optimization} \\  & RMSE Trans(m). & RMSE Rot(rad). & RMSE Trans(m). & RMSE Rot(rad). \\ \hline Sequence 0 & **0.064** & **0.614** & 0.385 & 2.842 \\ Sequence 1 & **0.027** & **0.016** & 0.068 & 0.065 \\ Sequence 2 & **0.363** & **0.121** & 0.407 & 1.056 \\ Sequence 3 & **0.027** & **0.016** & 0.068 & 0.065 \\ Sequence 4 & **0.181** & **0.745** & 0.249 & 2.420 \\ Sequence 5 & 0.051 & **0.013** & **0.017** & 0.201 \\ Sequence 6 & **0.387** & **1.851** & 2.158 & 2.473 \\ Sequence 7 & **0.013** & **0.018** & 0.105 & 0.098 \\ Sequence 8 & **0.384** & **0.689** & 3.234 & 0.507 \\ Sequence 9 & **0.192** & **0.369** & 0.443 & 0.521 \\ \hline \hline \end{tabular}
\end{table} TABLE I: Comparison of RMSE for absolute pose error in translation and rotation.

Fig. 4: From top to bottom, each row represents 10 point clouds derived from different sequences of the KITTI odometry dataset. From left to right: (1) Non-aligned scans; (2) Point clouds aligned using our estimated poses; (3) Point clouds aligned through multiway registration via pose-graph optimization; (4) Point clouds aligned according to ground truth poses.
each point cloud. Moreover, we opted for a Gram-Schmidt orthonormalization parametrization in the pose decoding stage, which yielded more precise results. This framework inherently supports a deep understanding of the spatial relationships and dynamics, leveraging both local and global contextual information in estimating ego-poses.

A significant insight drawn from our evaluations, conducted on the KITTI Odometry dataset, reveals that in many instances, our method outperforms the established multiway registration via pose graph optimization approach, notably reducing rotational error in several test sequences. This assert the potential effectiveness and applicability of our proposed model for geometric registration over large point clouds, particularly where rotational accuracy is of crucial importance.

In future work, we plan to further investigate the relevance of our model over larger windows and its direct usability within Simultaneous Localization and Mapping (SLAM) algorithm. This will involve applying the model to submaps or tiles [1] that compile a larger number of scans, aggregated from odometry poses. Our objective is to replace the existing loop closure optimization scheme in SLAM with our learned model.
