{'fraction_non_alphanumeric': 0.0353167941304483, 'fraction_numerical': 0.009596053804223922, 'mean_word_length': 4.911541288899779, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
SSL-Lanes: Self-Supervised Learning for Motion Forecasting in Autonomous Driving

Self-supervised learning (SSL) is an emerging technique that has been successfully employed to train convolutional neural networks (CNNs) and graph neural networks (GNNs) for more transferable, generalizable, and robust representation learning. However its potential in motion forecasting for autonomous driving has rarely been explored. In this study, we report the first systematic exploration and assessment of incorporating self-supervision into motion forecasting. We first propose to investigate four novel self-supervised learning tasks for motion forecasting with theoretical rationale and quantitative and qualitative comparisons on the challenging large-scale Argoverse dataset. Secondly, we point out that our auxiliary SSL-based learning setup not only outperforms forecasting methods which use transformers, complicated fusion mechanisms and sophisticated online dense goal candidate optimization algorithms in terms of performance accuracy, but also has low inference time and architectural complexity. Lastly, we conduct several experiments to understand why SSL improves motion forecasting. Code is open-sourced at \url{https://github.com/AutoVision-cloud/SSL-Lanes}.


Introduction
Motion forecasting in a real-world urban environment is an important task for autonomous robots. It involves predicting the future trajectories of traffic agents including vehicles and pedestrians. This is absolutely crucial in the self-driving domain for safe, comfortable and efficient operation. However, this is a very challenging problem. Difficulties include inherent stochasticity and multimodality of driving behaviors, and that future motion can involve complicated maneuvers such as yielding, nudging, lane-changing, turning and acceleration or deceleration.
The motion prediction task has traditionally been based on kinematic constraints and road map information with handcrafted rules. These approaches however fail to capture long-term behavior and interactions with map structure and other traffic agents in complex scenarios. Tremendous progress has been made with data-driven methods in motion forecasting [6,7,16,24,32,33,35,52]. Recent methods use a vector representation for HD maps and agent trajectories, including approaches like Lane-GCN [28], Lane-RCNN [49], Vector-Net [12], TNT [52] and Dense-TNT [16]. More recently, the enormous success of transformers [42] has been leveraged for forecasting in mm-Transformer [32], Scene transformer [35], Multimodal transformer [20] and Latent Variable Sequential Transformers [15]. Most of these methods however are extremely complex in terms of architecture and have low inference speeds, which makes them unsuitable for real-world settings.
In this work, we extend ideas from self-supervised learning (SSL) to the motion forecasting task. Self-supervision has seen huge interest in both natural language processing and computer vision [5] to make use of freely available data without the need for annotations. It aims to assist the model to learn more transferable and generalized representation from pseudo-labels via pretext tasks. Given the recent success of self-supervision with CNNs, transformers, and GNNs, we are naturally motivated to ask the question: Can self-supervised learning improve accuracy and generalizability of motion forecasting, without sacrificing inference speed or architectural simplicity?
Contributions: Our work, SSL-Lanes, presents the first systematic study on how to incorporate self-supervision in a standard data-driven motion forecasting model. Our contributions are: • We demonstrate the effectiveness of incorporating self-supervised learning in motion forecasting.
Since this does not add extra parameters or compute during inference, SSL-Lanes achieves the best accuracy-simplicity-efficiency trade-off on the challenging large-scale Argoverse [8] benchmark. • We propose four self-supervised tasks based on the nature of the motion forecasting problem. The key idea is to leverage easily accessible map/agent-level information to define domain-specific pretext tasks that encourage the standard model to capture more superior and generalizable representations for forecasting, in comparison to pure supervised learning.
• We further design experiments to explore why forecasting benefits from SSL. We provide extensive results to hypothesize that SSL-Lanes learns richer features from the SSL training as compared to a model trained with vanilla supervised learning.

Related Work
Motion Forecasting: Traditional methods for motion forecasting primarily use Kalman filtering [23] with a prior from HD-maps to predict future motion states [18,45]. With the huge success of deep learning, recent works use datadriven approaches for motion forecasting. These methods explore different architectures involving rasterized images and CNNs [3,7,39], vectorized representations and GNNs [12,24,33,34,49], point-cloud representations [46], transformers [15,20,32,35] and sophisticated fusion mechanisms [28], to generate features that predict final output trajectories. While the focus of these works is to find more effective ways of feature extraction from HD-maps and interacting agents, they need huge model capacity, heavy parameterization, and extensive augmentations or large amounts of data to converge to a general solution. Other works [6,40,50,52] build on them to incorporate prior knowledge in the form of predefined candidate trajectories from sampling or clustering strategies from training data. However the disadvantage of these methods is that their performance is highly related to the quality of the trajectory proposals, which becomes an extra dependency. End-to-end solutions for optimizing end-points of these candidates trajectories are proposed by Dense-TNT [16] and HOME [14]. Dense-TNT has state-ofthe-art accuracy with a reasonable parameter budget, but its online dense goal candidate optimization strategy is computationally very expensive, which is unrealistic for realtime operations like autonomous driving. Lately, ensembling techniques like MultiPath++ [41] and DCMS [47] have been proposed. While they have high forecasting performance, a major disadvantage is their high memory cost for training and heavy computational cost at inference.
Self-supervised Learning: SSL is a rapidly emerging learning framework that generates additional supervised signals to train deep learning models through carefully designed pretext tasks. In the image domain, various selfsupervised learning techniques have been developed for learning high-level image representations, including predicting the relative locations of image patches [10], jigsaw puzzle [36], image rotation [13], image clustering [4], image inpainting [38], image colorization [51] and segmentation prediction [37]. In the domain of graphs and graph neural networks, pretext tasks include graph partitioning, node clustering, context prediction and graph completion [19,22,31,48]. To the best of our knowledge, this is the first principled approach that explores motion forecasting for autonomous driving with self-supervision.

Problem Formulation
We are given the past motion of N actors. The ith actor is denoted as a set of its center locations over the past L time-steps. We pre-process it to represent We are also given a highdefinition (HD) map, which contains lanes and semantic attributes. Each lane is composed of several consecutive lane nodes, with a total of M nodes. X ∈ R M ×F denotes the lane node feature matrix, where x j = X[j, :] T is the Fdimensional lane node vector. Following the connections between lane centerlines (i.e., predecessor, successor, left neighbour and right neighbour), we represent the connectivity among the lane nodes with four adjacency matrices {A f } f ∈{pre,suc,left,right} , with A f ∈ R M ×M . This implies that if A f,gh = 1, then node h is an f -type neighbor of node g. Our goal is to forecast the future motions of all actors in the scene O 1:

Background
In this section, we first briefly introduce a standard datadriven motion forecasting framework.
Modeling Interactions: Since the behavior of agents depends on map topology and social consistency, each encoded agent i subsequently aggregates context from the surrounding map features and its neighboring agent features, via spatial attention [43] as given by Eq. (3): Here, y j is the feature of the j-th node,p i is the feature of the i-th agent, φ the composition of layer normalization and ReLU, and where v denotes the (x, y) 2-D BEV location of the agent or the lane node. The parameters for map and agent feature aggregation is represented by Trajectory Prediction: Finally, we decode the future trajectories from the featuresṕ i corresponding to the agents of interest as given by: O 1:T pred = {g dec (ṕ i )|i = 1, ..., N }, where g dec is the parameterized trajectory decoder. The parameters for the motion forecasting model are learned by minimizing the supervised loss (L sup ) calculated between the predicted output and the ground-truth future trajectories (O 1:T GT ), as given by Eq. (4): g enc , Θ , Λ , g dec = arg min genc,Θ,Λ,g dec

SSL-Lanes
The goal of our proposed SSL-Lanes framework is to improve the performance of the primary motion forecasting baseline by learning simultaneously with various selfsupervised tasks. Fig. 2 shows the pipeline of our proposed approach, and Tab. 1 summarizes the self-supervised tasks.

Self-Supervision meets Motion Forecasting
Before we discuss designing pretext tasks to generate self-supervisory signals, we consider a scheme that will allow combined training for self-supervised pretext tasks and our standard framework.
How to combine motion forecasting and SSL? Selfsupervision can be combined with motion forecasting in various ways. In one scheme we could pre-train the forecasting encoder with pretext tasks (which can be viewed as an initialization for the encoder's parameters) and then fine-tune the pre-trained encoder with a downstream decoder as given by Eq. (4). In another scheme, we could choose to freeze the encoder and only train the decoder. In a third scheme, we could optimize our pretext task and primary task jointly, as a kind of multi-task learning setup. Inspired by relevant discussions in GNNs, we choose the third-scheme, i.e., multi-task learning, which is the most general framework among the three and is also experimentally verified to be the most effective [22,48].
Joint Training: Considering our motion forecasting task and a self-supervised task, the output and the training process can be formulated as: Ψ , Ω , Θ ss = arg min Ψ,Ω,Θss where, L ss (·, ·) is the loss function of the self-supervised task, Θ ss is the corresponding linear transformation parameter, and α 1 , α 2 ∈ R >0 are the weights for the supervised and self-supervised losses. If the pretext task only focuses on the map encoder, then Ψ = {Θ} and Ω = {g enc , Λ, g dec }. Otherwise, Ψ = {g enc , Θ, Λ} and Ω = {g dec }. Henceforth, we also define the following representations. We will represent the primary task encoder as function f Ψ , parameterized by Ψ. Furthermore, given a pretext task, which we will design in the next section, the pretext decoder p Θss is a function that predicts pseudolabels and is parameterized by Θ ss .
Benefit of SSL-Lanes: In Eq. (5), the self-supervised task as a regularization term throughout network training. It acts as the regularizer learned from unlabeled data under the minor guidance of human prior (design of pretext task). Therefore, a properly designed task would introduce data-driven prior knowledge that improves model generalizability.

Pretext tasks for Motion Forecasting
At the core of our SSL-Lanes approach is defining pretext tasks based upon self-supervised information from the underlying map structure and the overall temporal prediction problem itself. Our proposed prediction-specific selfsupervised tasks are summarized in Tab. 1, and assign different pseudo-labels from unannotated data to solve Eq. (5). Our core approach is simple in contrast to state-of-the-art that rely on complex encoding architectures [20,24,28,32,35,49,52], ensembling forecasting heads [41,47], involved final goal-set optimization algorithms [16,40] or heavy fusion mechanisms [28], to improve prediction performance.

Lane-Masking
Motivation: The goal of the Lane-Masking pretext task is to encourage the map encoder Ψ = {Θ} to learn local structure information in addition to the forecasting task that is being optimized. In this task, we learn by recovering feature information from the perturbed lane graphs. Vector-Net [12] is the only other motion forecasting work that proposes to randomly mask out the input node features belonging to either scene context or agent trajectories, and ask the model to reconstruct the masked features. Their intuition is to encourage the graph networks to better capture the interactions between agent dynamics and scene context. However, our motivation differs from VectorNet in two respects: (a) We propose to use masking to learn local map-structure better, as opposed to learning interactions between map and the agent. This is an easier optimization task, and we outperform VectorNet. (b) A lane is made up of several nodes. We propose to randomly mask out a certain percentage of each lane. This is a much stronger prior as compared to randomly masking out any node and ensures that the model pays attention to all parts of the map.
Formulation: Formally, we randomly mask (i.e., set equal to zero) the features of m a percent of nodes per lane and then ask the self-supervised decoder to reconstruct Here,X is the node feature matrix corrupted with random masking, i.e., some rows of X corresponding to nodes v i are set to zero. p Θss is a fully connected network that maps the representations to the reconstructed features. L mse is the mean squared error (MSE) loss function penalizing the distance between the reconstructed map features Benefit of Lane-Masking: Since Argoverse [8] has imbalanced data with respect to maneuvers, there are cases when right/left turns, lane-changes, acceleration/deceleration are missed by the baseline even with multi-modal predictions. We hypothesize that stronger map-features can help the multi-modal prediction header to infer that some of the predictions should also be aligned with map topology. For example, even if an agent is likely to go straight at an intersection, some of the possible futures should also cover acceleration/deceleration or right/left turns guided by the local map structure.

Distance to Intersection
Motivation: The Lane-Masking pretext task is from a local structure perspective based on masking and trying to predict local attributes of the vectorized HD-map. We further develop the Distance-to-Intersection pretext task to guide the map-encoder, Ψ = {Θ}, to maintain global topology information by predicting the distance (in terms of shortest path length) from all lane nodes to intersection nodes. Datasets like Argoverse [8] provide lane attributes which describe whether a lane node is located within an intersection. This will force the representations to learn a global positioning vector of each of the lane nodes.
Formulation: We aim to regress the distances from each lane node to pre-labeled intersection nodes annotated as part of the dataset. Given K labeled intersection nodes V intersection = {v intersection,k |k = 1, ...K}, we first generate reliable pseudo labels using breadth-first search (BFS). Specifically, BFS calculates the shortest distance d i ∈ R for every lane node v i from the given set V intersection . The target of this task is to predict the pseudo-labeled distances using a pretext decoder.
is the prediction of node v i , and L mse is the mean-squared error loss function for regression, then the loss formulation for this SSL pretext task is as follows: Benefit of Distance to Intersection Task: We hypothesize that since change of speed, acceleration, primary direction of movement etc. for an agent can change far more dramatically as an agent approaches or moves away from an intersection, it is beneficial to explicitly incentivize the model to pick up the geometric structure near an intersection and compress the space of possible map-feature encoders, thereby effectively simplifying inference. We also expect this to improve drivable area compliance nearby an intersection, which is often a problem for current motion forecasting models.

Maneuver Classification
Motivation: The Lane-Masking and Distance to Intersection pretext tasks are both based on extracting feature and topology information from a HD-map. However, pretext tasks can also be constructed from the overall forecasting task itself. Thus we propose to obtain free pseudo-labels in the form of a 'maneuver' the agent-of-interest intends to execute, and define a set of 'intentions' to represent common semantic modes (e.g. change lane, speed up, slow down, turn-right, turn-left etc.) We call this pretext task Maneuver Classification, and we expect it to provide prior regularization to Ψ = {g enc , Θ, Λ}, based on driving modes.
Formulation: We aim to construct pseudo label to divide agents into different clusters according to their driving behavior and explore unsupervised clustering algorithms to acquire the maneuver for each agent. We find that using naive k-Means (on agent end-points) or DBSCAN (on Hausdorff distance between entire trajectories [1]) leads to noisy clustering. We find that constrained k-means [44] on agent end-points works best to divide trajectory samples into C clusters equally. We define C = {maintain-speed, accelerate, decelerate, turn-left, turn-right, lane-change} and the clustering function as ρ. If is its ground-truth endpoint, then the learning objective is to classify each agent maneuver into its corresponding cluster using cross-entropy loss L ce as: Benefit of Maneuver Classification Task: We hypothesize if one can identify the intention of a driver, the future motion of the vehicle will match that maneuver, thereby reducing the set of possible end-points for the agent. We also expect that agents with similar maneuvers will tend to have consistent semantic representations.

Forecasting Success/Failure Classification
Motivation: In contrast to maneuver classification, which provides coarse-grained prediction of the future, selfsupervision mechanisms can also offer a strong learning signal through goal-reaching tasks which are generated from the agent's trajectories. We propose a pretext task called Success/Failure Classification, which trains an agent specialized at achieving end-point goals which directly lead to the forecasting-task solution. We expect this to constrain Ψ = {g enc , Θ, Λ} to predict trajectories distance away from the correct final end-point. Conceptually, the more examples of successful goal states we collect, the better understanding of the target goal of the forecasting task we have.
Formulation: Similar to maneuver classification, we wish to create pseudo-labels for our data samples. We la-bel trajectory predictions as successful (c = 1) if the final prediction (x T i,pred , y T i,pred ) is within < 2m of the final endpoint E i , and as failure (c = 0) otherwise. We choose 2m as our threshold because it is also used for miss-rate calculation (Sec. 6). In this case, c ∈ C = {0, 1} is the pseudolabel which belongs to label set C. If the pretext decoder predicts agent i's final-endpoint as p Θss (f Ψ (P i , X, A f )), and given ground-truth end-point E i its success or failure label is c i , then the pretext loss can be formulated as: Benefit of Success/Failure Classification Task: We hypothesize that this task will especially provide stronger gains for cases where the final end-point is not aligned with the general direction of agent movement for majority of samples given in the dataset, and is thus not well captured by average displacement based supervised loss functions.

Learning
As all the modules are differentiable, we can train the model in an end-to-end way. We use the sum of classification, regression and self-supervised losses to train the model. Specifically, we use: For classification and regression loss design, we adopt the formulation proposed in [28]. L2 loss that minimizes the distance between predicted final-endpoints and the ground-truth. This is because L reg is averaged across all time-points 1 : T , and from a practical end user perspective, minimizing the endpoint loss is much more important than weighting loss from all time-steps equally. Our proposed pretext tasks contributes to L ss . During evaluation, we study each pretext task separately, and their corresponding loss formulations defined in Eq. (6), Eq. (7), Eq. (8), Eq. (9) are used for joint training.

Experiments
Dataset: Argoverse provides a large-scale dataset [8] for the purpose of training, validating and testing models, where the task is to forecast 3 seconds of future motions, given 2 seconds of past observations. This dataset has more than 30K real-world driving sequences collected in Miami (MIA) and Pittsburgh (PIT). Those sequences are further split into train, validation, and test sets, without any geographical overlap. Each of them has 205,942, 39,472, and 78,143 sequences respectively. In particular, each sequence contains the positions of all actors in a scene within the past 2 seconds history, annotated at 10Hz. It also specifies one actor of interest in the scene, with type 'agent', whose future 3 seconds of motion are used for the evaluation. The train and validation splits additionally provide future locations of all actors within 3 second horizon labeled at 10Hz, while annotations for test sequences are withheld from the public and used for the leaderboard evaluation. HD map information is available for all sequences.
We have two main requirements for the dataset: (a) Scale of Data: Modern motion forecasting methods and selfsupervised learning systems require a large amount of training data to imitate human maneuvers in complex real-world scenarios. Thus, the dataset should be large-scale and diverse, such that it has a wide range of behaviors and trajec-tory shapes across different geometries represented in the data. (b) Interesting Scenarios for Forecasting Evaluation: The dataset should be collected for interesting behaviours by biasing sampling towards complex observed behaviours (e.g., lane changes, turns) and road features (e.g., intersections), since we wish to focus on these cases. We find that on the basis of these requirements, as well as its popularity in the the motion forecasting community, Argoverse [8] is the best candidate to showcase our method. Please refer to the supplementary for more details regarding why we choose to focus on it in comparison to other motion forecasting benchmarks.
Metrics: ADE is defined as the average displacement error between ground-truth trajectories and predicted trajectories over all time steps. FDE is defined as displacement error between ground-truth trajectories and predicted trajectories at the final time step. We compute K likely trajectories for each scenario with the ground truth label, where K = 1 and K = 6 are used. Therefore, minADE and minFDE are minimum ADE and FDE over the top K predictions, respectively. Miss rate (MR) is defined as the percentage of the best-predicted trajectories whose FDE is within a threshold (2 m). Brier-minFDE is the minFDE plus (1−p) 2 , where p is the corresponding trajectory probability.
Experimental Details: To normalize the data, we translate and rotate the coordinate system of each sequence so that the origin is at current position t = 0 of 'agent' actor and x-axis is aligned with its current direction, i.e., orientation from the agent location at t = −1 to the agent location at t = 0 is the positive x axis. We use all actors and lanes whose distance from the agent is smaller than 100 meters as the input. We train the model on 4 TITAN-X GPUs using a batch size of 128 with the Adam [25] optimizer with an initial learning rate of 1 × 10 −3 , which is decayed to 1 × 10 −4 at 100,000 steps. The training process finishes at 128,000 steps and takes about 10 hours to complete. For our final test-set submission, we use success/failure classification as the pretext task, and initialize the map-encoder with the parameters from a model trained with the lane-masking pretext task. To avoid overfitting to the general directions that agents move, we augment the data from each scene for the test-set submission. We rotate all trajectories in a scene around the scene's origin by γ, where γ varies from 0°to 360°in 30°intervals. We provide more implementation details in the supplementary.

Ablation Studies
Effectiveness of Pretext tasks: We first examine the effect of incorporating our proposed pretext tasks (Sec. 5) with the standard data-driven motion forecasting baseline (Sec. 4). While evaluating the importance of our proposed pretext tasks, we wish to underline that motion prediction for autonomous driving is a safety-critical task, especially at intersections where most of our data is collected, and most accidents also happen. We thus posit that in this situation, even a small error in predicting final locations (FDE) for a given agent can lead to dangerous potential collisions.
Results in Tab. 2 show that all proposed pretext tasks improve motion forecasting performance for Argoverse. Specifically, the lane-masking pretext task improves min-FDE by 8.9% and MR@2m by 20.3%. distance to intersection improves min-FDE by 7.1% and 19.3%. Maneuver classification improves min-FDE by 6.3% and MR@2m by 15.4%. We expect that improving the quality of clustering for maneuvers and thus creating better pseudo-labels will improve this further. Finally, success/failure classification improves min-FDE by 9.8% and MR@2m by 22.4%. Moreover, since pretext tasks are not used for inference and only for training, they also do not add any extra parameters or FLOPs to the baseline, thereby increasing accuracy but at no cost to computational efficiency or architectural complexity. We present qualitative results with the different pretext tasks on several hard cases in Fig. 1.
Similarity in feature space: We analyze the CKA similarity [26] between the representations learnt by: a model trained with pretext task 'D2I' (refers to distance to intersection task) and baseline; two models trained with different pretext tasks. In Fig. 4, Base(M2A) refers top i , Base(A2A) refers toṕ i (see Eq. (3)), 'Mask' refers to lane-masking, 'success/fail' refers to success or failure classification task and 'intention' suggests maneuver classification.
Our main questions are: (a) how much does the pretext task feature differ from the baseline? (b) do the features from different pretext tasks collapse to the same feature? First we note that representation learned by D2I does not collapse to the same representation learned by Mask or Suc- cess/Fail or Intention. Secondly we note that D2I features are quite different from Base-M2A featuresp i and Base-A2A featuresṕ i , which suggests that task-specific regularization has indeed resulted in different parameters.

Comparison with State-of-the-Art
Performance: We compare our approach with top entries on Argoverse motion forecasting leaderboard [8] in Tab. 3. SSL-Lanes improves the metrics for K = 1 convincingly and outperforms existing approaches w.r.t. min-ADE 1 , min-FDE 1 and MR 1 . We are also strongly competitive w.r.t. min-ADE 6 , min-FDE 6 and MR 6 against top approaches, with a relatively simple architecture.
Trade-off between min-FDE and Miss-Rate: min-FDE 6 and MR 6 are both important for autonomous robots to optimize. Ideally we wish for both of these metrics to be low. However, there exists a frequent trade-off between them. We compare this trade-off in Fig. 3(a) with six other popular motion forecasting models (in terms of citations and GitHub stars), namely: Lane-GCN [28], Lane-RCNN [28], MultiPath [7], mm-Transformer [32], TNT [52] and Dense-TNT [16] on the Argoverse validation set. We are on the lowest-left of meaning we optimize both min-FDE 6 and MR 6 successfully in comparison to other top models.
Trade-off between accuracy, efficiency and complexity: We are the first to point out a trade-off that exists for current state-of-the-art motion forecasting models between forecasting performance, architectural complexity and inference speed. This is illustrated in Fig. 3(b)-(c). NN+Map [8] (see Tab. 3) is a simple nearest-neighbor based approach that also uses map-features, and while it has advantages in terms of fast inference and low model complexity, the forecasting performance is very low. MultiPath [7] is a very popular approach that has reasonable accuracy and inference speed but is parametrically heavy due to it's use of convolutional kernels. Lane-GCN is a vector based approach [28] has comparatively fast inference time and high accuracy, but uses multiple GNN layers which can lead  Table 4. Different experimental settings to provide evidence for why SSL-based training helps motion forecasting to problems with over-smoothing for map-encoders [27] and also has a complicated four-stage fusion mechanism. Lane-RCNN [49] proposes to capture interactions between agents and map using not just a single vector, but a local interaction graph per agent -this adds huge number of hyper-parameters to the model and makes it very complex. Transformer-based models [15,20,32,35] also suffer in this regard. Scene-transformer for example has 15M parameters and uses heavy augmentation to prevent overfitting. A light high-performing model is Dense-TNT [16]. However, Dense-TNT's inference speed on average is 50ms per agent, because it proposes a time-intensive optimization algorithm to find a dense goal set that minimizes the expected error of the given set. In contrast to these popular models, our approach has high accuracy (min-FDE: 1.25m, MR: 13.3%) while also having low architectural complexity (1.84M parameters) and high inference speed (3.30 ms).
Thus it provides a great balance for application to real-time safety-critical autonomous robots. Qualitative Results: We present some multi-modal prediction trajectories on several hard cases shown in Fig. 1. The yellow trajectory represents the observed 2s. Red represents ground truth for the next 3s and green represents the multiple forecasted trajectories for those 3s. In Row 1, the agent turns right at the intersection. The baseline misses this mode completely, despite having access to the map. The model trained with lane-masking successfully predicts this right turn within 2m of the ground-truth end-point. In Row 2, the agent has a noisy past history and accelerates while turning left at the intersection. The pretext task distanceto-intersection can correctly capture this, while the baseline has only one trajectory covering this mode but vastly overshoots the ground-truth. Interestingly, we note that the success/failure pretext task is unable to capture this mode. We believe this is due to a stronger prior imposed by the model during learning. In Row 3, we have an agent accelerating while going straight at an intersection. We find that the maneuver classification pretext task is the only model that correctly predicts trajectories aligned with the groundtruth. In Row 4, we have an agent turning left at an intersection. Most of the predictions of other models predicts that the agent will go straight. The success/failure pretext task however picks up on the left-turn, possibly due to the priors imposed upon it by end-point conditioning. Overall, SSL-Lanes can capture left and right turns better, while also being able to discern acceleration at intersections. Our pretext tasks provide priors for the model and provides data-regularization for free. We believe this can improve forecasting through better understanding of map topology, agent context with respect to the map, and generalization with respect to imbalance implicitly present in data.

When does SSL help Motion Forecasting?
Hypotheses: We hypothesize that training with SSL pretext tasks probably helps motion forecasting as following: (a) Topology-based context prediction assumes feature similarity or smoothness in small neighborhoods of maps. Such a context-based feature representation can greatly improve prediction performance, especially when the neighborhoods are small. (b) Clustering and classification assumes that feature similarity implies target-label similarity and can group distant nodes with similar features together, leading to better generalization. (c) Supervised learning with imbalanced datasets sees significant degradation in performance. Although most of the data samples in Argoverse are at an inter-section, a significantly large number involve driving straight while maintaining speed. Recent studies [30] have shown that SSL tends to learn richer features from more frequent classes which also allows it to generalize to to other classes better. Experiments: In order to provide evidence for our hypotheses, we propose to design 6 different training and testing setups as shown in Tab. 4. We use success/failure classification as the pretext task, and all models are trained for 50,000 steps. We initialize the map-encoder with the parameters from a model trained with the lane-masking pretext task. Our first setting is to train with 25% of the total data available for training and testing on the full validation set. We expect the SSL-based task to capture richer features and generalize better than the baseline. Our second setting assumes that SSL also generalizes to topology from different cities and trains on 100% of data from Pittsburgh (PIT) but only 20% of data from Miami (MIA). For evaluation, we only test on data examples taken from the city of MIA. For our third setting, we assume that SSL learns superior features and can thus perform better in difficult cases like lane-changes and turning cases. For evaluation, we only test on data examples which involves these difficult cases. In our fourth setting, we choose to explicitly train with data that contains 2× 'straight-with-same-speed' maneuver and 1× all other maneuvers. We test only on lane-changes and turning cases from validation. Finally in order to test the effect of noise on motion forecasting performance, we take two models already trained on full data. We now take the full validation set, randomly select agent trajectories or map nodes with probability p = 0.25 and p = 0.5, and then add Gaussian noise with zero mean and 0.2 variance to their features. We expect this to have the most impact on forecasting performance as compared to all other settings since this is the most aggressive form of corruption. But we also expect SSL-based pretext task training to provide robustness to noise for free due to better generalization capabilities. Our takeaway from these experiments is that there is strong evidence SSL-based tasks do provide better generalization capabilities and can thus prove to be more effective than pure supervised training based approaches.

Conclusion
We propose SSL-Lanes to leverage supervisory signals generated from data for free in the form of pseudo-labels and integrate it with a standard motion forecasting model. We design four pretext tasks that can take advantage of map-structure and similarities between agent dynamics to generate these pseudo-labels, namely: lane masking, distance to intersection prediction, maneuver classification and success/failure classification. We validate our proposed approach by achieving competitive results on the challenging large-scale Argoverse benchmark. The main advantage of SSL-Lanes is that it has high accuracy combined with low architectural complexity and high inference speed. We further demonstrate that each proposed SSL pretext task improves upon the baseline, especially in difficult cases like left/right turns and acceleration/deceleration. We also provide hypotheses and experiments on why SSL-Lanes can improve motion forecasting.
Limitations: A limitation of our framework is that it uses the different losses for our formulation only in a 1:1 ratio without tuning them. We also use only one pretext task at a time and do not explore the combination of these different tasks. For our future work, we plan to incorporate meta-learning [21] to identify an effective combination of pretext tasks and automatically balance them-we expect that this will lead to more gains in terms of forecasting performance. Another limitation is that we report improvements with SSL-pretext tasks in scenarios without specifically considering multiple heavily interacting agents. In the future we would like to explore how the interactions between road agents can influence our SSL losses on the interaction split of the Waymo Open Motion dataset (WOMD) [11]. Finally, we explore generalization in terms of implicit data imbalance only in comparison to pure supervised training on the same dataset from which training samples are derived. We would like to study the generalization of our work to other datasets without re-training.

Detailed Network Architecture for Baseline
We provide the detailed network architecture of our baseline in Fig. 5. For the agent feature extractor, the architecture is similar to [28]. We use an 1D CNN to process the trajectory input. The output is a temporal feature map, whose element at t = 0 is used as the agent feature. The network has three groups/scales of 1D convolutions. Each group consists of two residual blocks [17], with the stride of the first block as 2. Feature Pyramid Network (FPN) [29] fuses the multiscale features, and applies another residual block to obtain the output tensor. For all layers, the convolution kernel size is 3 and the number of output channels is 128. Layer normalization [2] and Rectified Linear Unit (ReLU) are used after each convolution. The map feature extractor has two LaneConv residual [17] blocks which are the stack of a LaneConv (1,2,4,8,16,32) and a linear layer, as well as a shortcut. All layers have 128 feature channels. Layer normalization [2] and ReLU are used after each LaneConv and linear layer. For the map-aware agent feature (M2A) module, the distance threshold is 12m. It is 100m for the agent-to-agent (A2A) interaction module. The two interaction modules have two residual blocks, which consist of a stack of an attention layer and a linear layer, as well as a residual connection. All layers have 128 output feature channels. Taking the interaction-aware actor features as input, our trajectory decoder is a multi-modal prediction header that outputs the final motion forecasting. For each agent, it predicts K possible future trajectories and confidence scores. The header has two branches, a regression branch to predict the trajectory of each mode and a classification branch to predict the confidence score of each mode. Key differences with Lane-GCN [28]: Our main difference is we use two Lane-Conv blocks instead of four as map-feature extractor in order to prevent over-smoothing in GNNs [27]. We also do not use the four-way fusion proposed by Lane-GCN and do away with the agent to map (A2M) and the map to map (M2M) interaction blocks, which saves compute and memory.

Implementation of Pretext Tasks
In this section, we discuss various design decisions for the proposed pretext tasks.

Lane-Masking
For this pretext task, we mask m a percent of every lane and reconstruct its features. In Tab. 5, we study the influence of masking ratio on the final forecasting performance. Random masking refers to masking out m a percent random

Distance to Intersection
For this pretext task, we explore two different options for framing the problem of predicting the distance to the nearest intersection node in Tab. 6. We first explore predicting this distance as a classification task. We group the lengths into four categories: d ij = 1, d ij = 2, d ij = 3, d ij = 4 and d ij >= 5. We however find that this is harder to optimize than the regression loss proposed in Eq. (7), which we finally choose as our loss for the distance to intersection pretext task.  Table 6. Effect of pretext loss type on forecasting performance for distance to intersection task

Maneuver Classification
For this pretext task, we first divide the lateral and longitudinal maneuvers by choosing a threshold angle of 20°f rom the vertical. We next find that constrained k-means [44] on agent end-points for lateral and longitudinal maneuvers works best to separate the trajectory samples into different clusters. This is illustrated in Fig. 6. For differentiating the longitudinal maneuvers from the lane-change maneuver, we check a combination of the distance from the lane centerlines for start and stop positions and the orientations of the nearest centerline for start and stop positions.  the points in the scene can be considered as failure examples. We consider first setting = 3m, i.e. a wider area for success examples, and then reducing it to = 2m linearly over the total number of training steps. We find that this can actually harm the final forecasting performance. We thus follow [53] to use focal loss to train our auxiliary classification task.

Qualitative Results
We first present some multi-modal prediction trajectories on several hard cases shown in Fig. 1  priors for the model and provides data-driven regularization for free. This can improve forecasting because of better understanding of map topology, agent context with respect to the map, and also improve generalization for maneuver im-balance implicitly present in data. We next provide more visual results of our proposed SSL-Lanes on the Argoverse validation set in Fig. 7. Generally, these qualitative results demonstrate the effectiveness of our proposed pretext tasks.

Discussion: SSL-Lanes vs. State-of-the-Art
We use this section to distinguish our work from methods that we believe have similar intuition but very different construction, in order to highlight its novelty and value.
• SSL-Lanes vs. VectorNet [12]: Vector-Net is the only other motion forecasting work that proposes to randomly mask out the input node features belonging to either scene context or agent trajectories, and ask the model to reconstruct the masked features. Their intuition is to encourage the graph networks to better capture the interactions between agent dynamics and scene context. However, our motivation differs from VectorNet in two respects: (a) We propose to use masking to learn local map-structure better, as opposed to learning interactions between map and the agent. This is an easier optimization task, and we out-perform VectorNet. (b) A lane is made up of several nodes. We propose to randomly mask out a certain percentage of each lane. This is a much stronger prior as compared to randomly masking out any node (which may correspond to either a moving agent or map) and ensures that the model pays attention to all parts of the map.
• SSL-Lanes vs. CS-LSTM [9]: CS-LSTM appends the encoder context vector with a one-hot vector corresponding to the lateral maneuver class and a onehot vector corresponding to the longitudinal maneuver class. Subsequently, the added maneuver context allows the decoder LSTM to generate maneuver specific probability distributions. This construction however is quite different from our work because it is not auxiliary in nature -it always outputs and appends a maneuver to the decoder, even during inference. This we believe is too strong of a bias for the prediction model, especially given the fact that the maneuvers are generated using very simple velocity profiles and not from careful mining of the data. In our conditioning, the maneuvers are mined from data and the final motion prediction does not depend directly on them. We believe this design is much more flexible since it allows to generate more supervisory signals in the form of maneuvers during training, but at the same time does not require an explicit maneuver to condition the final future forecast trajectory output during inference.
• SSL-Lanes vs. MultiPath [7]: MultiPath is also not auxiliary in nature: it factorizes motion uncertainty into intent uncertainty and control uncertainty; models the uncertainty over a discrete set of intents with a softmax distribution; and then outputs control uncertainty as a Gaussian distribution dependent on each waypoint state of the anchor trajectory (corresponding to the intent). While this construction is highly intuitive and effective by design, it is very different from our SSL-based construction. Ours is an auxiliary task which provides supervision during training, and effectively functions as a regularizer, while being general enough to be used with any other data-driven motion forecasting model.

Discussion: Choice of Dataset
We now compare the commonly used motionforecasting datasets, i.e., nuScenes [?], Waymo-Open-Motion-Dataset (WOMD) [11] and Argoverse [8]. We individually discuss why Argoverse is best positioned to bring out the benefits of our proposed work.
• Scale of Data: We first compare the dataset size and diversity. We note that Argoverse is not only larger and more diverse than nuScenes, but also has greater number of training samples and unique trajectories compared to WOMD. • Interesting Scenarios for Forecasting Evaluation: We next compare if the datasets specifically mines for interesting scenarios, which is the area we want to improve the current baseline. nuScenes was not collected to capture a wide diversity of complex and interesting driving scenarios. WOMD on the other hand specifically mines for pairwise interaction scenarios, where the main objective is to improve forecasting for interacting agents. However, the scope of our study is to primarily focus on motion at intersections undergoing lane-changes and turns. We expect the SSL-losses to improve understanding of the context/environment, trajectory embeddings and address data-imbalance w.r.t. maneuvers. We leave heavy interaction-based use cases for future work. Finally, Argoverse mines for interesting motion patterns at intersections, which involve lane-changes, acceleration/deceleration, and turns. We thus find this dataset best suited to showcase our proposed method.
• Community focus on Argoverse: We also find that many popular motion forecasting methods published by the robotics community have also included evaluations only on the Argoverse dataset including: Lane-GCN, Lane-RCNN, PRIME, DCMS, TPCN, mm-Transformer, HiVT, Multi-modal Transformer, DSP etc. This makes it easier for us to position our work with respect to these approaches.

Discussion: Potential of this Work
We expect this work to influence real world deployment of SSL forecasting methods for autonomous driving. Another use case for this work is realistic behavior generation in traffic simulation. The general construction of the prediction problem, inspired by [28], enables a generic understanding of how an object moves in a given environment without memorizing the training data. A neural network may learn to associate particular areas of a scene with certain motion patterns. To prevent this, we centre around the agent of interest and normalize all other trajectory and map coordinates with respect to it. We predict relative motion as opposed to absolute motion for the future trajectory. This helps to learn general motion patterns. Reconstructing the map or predicting distances from map elements are conducted in a frame-of-reference relative to the agent of interest. This helps in learning general map connectivity. Following work in pedestrian trajectory prediction, we also additionally add random rotations to the training trajectories to reduce directional bias. Furthermore, we provide strong evidence that SSL-based tasks provide better generalization compared to pure supervised training, thereby having the ability to effectively reuse the same prediction model across different scenarios.