Sports-Traj: A Unified Trajectory Generation Model for Multi-Agent Movement in Sports

## Abstract

Abstract Understanding multi-agent behavior is critical across various fields. The conventional approach involves analyzing agent movements through three primary tasks: trajectory prediction, imputation, and spatial-temporal recovery. Considering the unique input formulation and constraint of these tasks, most existing methods are tailored to address only one specific task. However, in real-world applications, these scenarios frequently occur simultaneously. Consequently, methods designed for one task often fail to adapt to others, resulting in performance drops. To overcome this limitation, we propose a Unified Trajectory Generation model, UniTraj, that processes arbitrary trajectories as masked inputs, adaptable to diverse scenarios. Specifically, we introduce a Ghost Spatial Masking (GSM) module embedded within a Transformer encoder for spatial feature extraction. We further extend recent successful State Space Models (SSMs), particularly the Mamba model, into a Bidirectional Temporal Mamba to effectively capture temporal dependencies. Additionally, we incorporate a Bidirectional Temporal Scaled (BTS) module to comprehensively scan trajectories while maintaining the temporal missing relationships within the sequence. We curate and benchmark three practical sports game datasets, Basketball-U , Football-U , and Soccer-U , for evaluation. Extensive experiments demonstrate the superior performance of our model. To the best of our knowledge, this is the first work that addresses this unified problem through a versatile generative framework, thereby enhancing our understanding of multi-agent movement. Our datasets, code, and model weights are available at https://github.com/colorfulfuture/UniTraj-pytorch .

## 1 Introduction

Analyzing the behavior of multiple agents is invaluable across various domains, including autonomous driving [, ], video surveillance [, ], and sports analytics [, ]. To decipher agent behaviors, these applications rely heavily on key tasks such as multi-object tracking [], person re-identification [], trajectory modeling [, ], and action recognition [, ]. Among these tasks, trajectory modeling is particularly straightforward and effective for understanding the movements of agents. Despite its inherent challenges, such as the complexity of dynamic environments and the subtle agent interactions, significant advancements have been made recently. These advancements are concentrated in three main areas: trajectory prediction, imputation, and spatial-temporal recovery. As depicted in Figure 1, these tasks differ in their input constraints and requirements.

Significant developments have been made recently in modeling multi-agent trajectories, however, most approaches are specialized for specific tasks. For example, numerous studies [, , , , , , , , , , , , , , , ] have focused on multi-agent trajectory prediction, achieving promising results in public datasets. Nonetheless, these approaches often struggle to generalize to

Figure: Figure 1: Demonstration of three trajectory modeling tasks, trajectory prediction, imputation, and spatial-temporal (ST) recovery, for multi-agent movement analysis during an offensive possession in a basketball game, where each task takes different inputs.
Refer to caption: x1.png

other trajectory-related tasks, such as trajectory imputation and spatial-temporal recovery. These tasks require exploiting both forward and backward spatial-temporal dependencies, which are not typically addressed in prediction-focused models. While some studies [, ] have tackled the multi-agent trajectory imputation problem, they often overlook the future trajectories of agents. This omission limits their practical utility in complete movement understanding, where predicting future trajectories is crucial for downstream planning rather than merely reconstructing historical trajectories. Although some recent efforts [, ] have attempted to integrate imputation and prediction, they often employ a multi-task framework that relies solely on masked observations, resulting in a lack of diversity in missing formats. Given that any situation might happen in real practice, it is crucial to develop a general method that can accommodate various scenarios. This raises two pivotal questions: (1) How can we unify these disparate but relevant tasks into a general framework that accommodates different settings? (2) How can we effectively model these trajectories with varying input formulations?

Prompted by these questions, we revisit these tasks and introduce the Unified Trajectory Generation model (UniTraj), which integrates these tasks into a general scheme. Specifically, we merge different input types into a single unified formulation: an arbitrary incomplete trajectory with a mask that indicates the visibility of each agent at each time step. We uniformly process the inputs of each task as masked trajectories, aiming to generate complete trajectories based on the incomplete ones. To model spatial-temporal dependencies across various trajectory formulations, we introduce a Ghost Spatial Masking (GSM) module embedded within a Transformer-based encoder for spatial feature extraction. Leveraging the notable capability of recent popular State Space Models (SSMs), especially the Mamba model, we adapt and enhance it into a Bidirectional Temporal Mamba encoder for long-term multi-agent trajectory generation. Furthermore, we propose a simple yet effective Bidirectional Temporal Scaled (BTS) module that comprehensively scans trajectories while preserving the integrity of temporal relationships within the sequence. Owing to a lack of benchmarks in this novel setting, we benchmark and release three sports game datasets: Basketball-U, Football-U, and Soccer-U, to facilitate evaluation. In summary, the contributions of our work are as follows:

- •
We propose UniTraj, a unified trajectory generation model capable of addressing diverse trajectory-related tasks such as trajectory prediction, imputation, and spatial-temporal recovery while handling various input formulations, setting constraints, and task requirements.
- •
We introduce a novel Ghost Spatial Masking (GSM) module and extend the Mamba model with our innovative Bidirectional Temporal Scaled (BTS) module to extract comprehensive spatial-temporal features from different incomplete trajectory inputs.
- •
We curate and benchmark three sports game datasets, Basketball-U, Football-U, and Soccer-U, and establish strong baselines for this integrated challenge.
- •
Extensive experiments validate the consistent and exceptional performance of our method.

## 2 Related Work

#### Trajectory Prediction.

Trajectory prediction aims to predict the future movements of agents conditioned on their historical observations. The biggest challenge is modeling the social interactions among agents, which has driven the development of various methods. A classic approach, Social-LSTM [], introduced a pooling layer to enable information sharing. Subsequent methods [, , , ] have employed similar designs to extract comprehensive interaction features. More recent studies [, , , , , , ] have utilized Graph Neural Networks (GNNs), treating agents as nodes to model social interactions. The inherent uncertainty and diversity of future trajectories have also led to the adoption of generative models, including Generative Adversarial Networks (GANs) [, , , ], Conditional Variational Autoencoders (CVAEs) [, , , , ], and Diffusion models [, , ].

While these models have shown promising results, most assume that observations are complete, overlooking potential missing observations. Recent works [, , ] have highlighted the issue of missing observations, incorporating both imputation and prediction tasks into a multi-task framework. However, these efforts primarily address visible gaps in historical trajectory data, without considering the more complex scenarios of missing data that occur in practice. Moreover, prediction may not always be the ultimate objective in applications such as similarity analysis or action localization. Our work aims to tackle a broader range of challenges within trajectory modeling and introduces a new benchmark to better address these complexities.

#### Trajectory Imputation and Spatial-Temporal Recovery.

Imputation is a classic and extensively explored task, with time-series imputation receiving the most attention. Traditional statistical techniques include replacing missing values with the mean or median value [], as well as methods like linear regression [], k-nearest neighbors [, ], and the expectation-maximization (EM) algorithm [, ]. These methods often suffer from limited generalization ability due to their reliance on rigid priors. In response, more flexible frameworks have emerged, employing deep learning techniques for sequential data imputation, such as autoregressive imputation using RNNs [, ], or the use of GANs, VAEs, and Diffusion models [, , , , , , , , ] to generate reconstructed sequences. However, only a few studies have specifically addressed trajectory imputation for multi-agent movements. For instance, AOMI [] introduces a non-autoregressive imputation method, while GMAT [] develops a hierarchical model to generate macro-intent labels for sequence generation. Additionally, Graph Imputer [] has utilized forward and backward information to model the distribution of imputed trajectories in soccer games.

The task of trajectory spatial-temporal recovery, while similar to trajectory imputation in its focus on incomplete trajectories, differs in its broader goal of reconstructing complete spatial-temporal sequences. This task requires not only filling gaps but also mining the intrinsic relations between different agents’ trajectories, which is crucial for real-world applications like arrival time estimation [, ] and trajectory similarity computation []. A major benchmark involves recovering trajectory data from GPS points [, , , ], while few studies focus on multi-agent contexts.

Recent research has integrated trajectory imputation and prediction tasks. For instance, INAM [] introduces an imitation learning paradigm that handles both tasks asynchronously, while GC-VRNN [] proposes a multi-task framework using three different GCN layers and a variational RNN to conduct trajectory imputation and prediction simultaneously. Nevertheless, these studies primarily aim to forecast trajectories based on missing observations, whereas our work aims for a more general goal that is not restricted to specific input formats or tasks.

#### State Space Models.

The core concept of state space sequence models (SSMs) [, ] is to link input and output sequences through a latent state. Recently, a promising variant of SSMs, Mamba architecture [], which integrates time-varying parameters, has been introduced to enhance the efficiency. This architecture has inspired various recent studies in different computer vision tasks. For instance, in works [, , , , ], Mamba has been applied to effectively process image patches, learn visual representations, and achieve impressive performance in downstream tasks, proving it as an effective backbone.

More relevant to our work, several Mamba-based methods have been developed to solve the problem of sequence generation. For instance, Motion Mamba [] employs SSMs for efficient and long-term motion generation, incorporating multiple isolated SSM modules within a symmetric U-Net architecture. Similarly, Traj-LLM [] uses the Mamba model to develop a lane-aware probabilistic learning module and integrates Large Language Models (LLMs) for trajectory prediction in autonomous driving. Additionally, Simple-Mamba [] tokenizes the time points of each variable and uses the Mamba model for time series forecasting. However, the full potential of the Mamba model in trajectory modeling remains underexplored. In this work, we leverage and expand upon the Mamba model to learn temporal dependencies from both directions and introduce a novel Bidirectional Temporal Scaled (BTS) module for a comprehensive trajectory scan.

## 3 Proposed Method

### 3.1 Problem Definition

Table: Table 1: Overall architecture of our UniTraj model. The encoders extract agent features and derive latent variables, while the decoder generates the complete trajectory using the sampled latent variables and agent features.

To handle various input conditions within a single framework, we introduce a unified trajectory generative model that treats any arbitrary input as a masked trajectory sequence. The trajectory’s visible regions are used as constraints or input conditions, whereas the missing regions are the targets for our generative task. We provide the following problem definitions.

Consider a complete trajectory $X\in\mathbb{R}^{N\times T\times D}$, where $N$ is the number of agents, $T$ represents the trajectory length, and $D$ is the dimension of the agents’ states. We denote the position of agent $i$ at time $t$ as $\bm{x}^{t}_{i}\in\mathbb{R}^{D}$. Typically, we set $D=2$, corresponding to the 2D coordinates. We also utilize a binary masking matrix $M\in\mathbb{R}^{N\times T}$, valued in $\{0,1\}$, to indicate missing locations. The variable $m^{t}_{i}$ is set to $1$ if the location of agent $i$ is known at time $t$ and 0 0 otherwise. In our work, if an agent is missing, both coordinates are missing. The trajectory is therefore divided by the mask into two segments: the visible region defined as $X_{v}=X\odot M$ and the missing region defined as $X_{m}=X\odot(\mathbf{1}-M)$. Our task aims to generate a complete trajectory $\hat{Y}=\{\hat{X}_{v},\hat{X}_{m}\}$, where $\hat{X}_{v}$ is the reconstructed trajectory and $\hat{X}_{m}$ is the newly generated trajectory. For consistency, we refer to the original trajectory as the ground truth $Y=X=\{X_{v},X_{m}\}$. More formally, our goal is to train a generative model $f(\cdot)$ with parameters $\theta$ that outputs a complete trajectory $\hat{Y}$. A common approach to estimate model parameter $\theta$ involves factorizing the joint trajectory distribution and maximizing the log-likelihood, as follows:

$$ $\theta^{*}=\arg\max_{\theta}\sum_{\bm{x}^{\leq T}\in\Omega}\log p_{\theta}(\bm {x}^{\leq T})=\arg\max_{\theta}\sum_{\bm{x}^{\leq T}\in\Omega}\sum_{t=1}^{T} \log p_{\theta}(\bm{x}^{t}|\bm{x}^{<t}),$ (1) $$

where $\Omega=\{1,2,...,N\}$ is the set of agents, and $\bm{x}^{\leq T}$ represents the agent sequential trajectory.

### 3.2 Unified Trajectory Generation Model

#### Overall Architecture.

The overall high-level architecture of our UniTraj is shown in Figure 1, which illustrates the data flow during the training and testing phases. More specifically, the detailed architecture of the encoder is presented in Figure 2. This encoder incorporates a Transformer encoder equipped with a Ghost Spatial Masking (GSM) module and a Mamba encoder enhanced by a Bidirectional Temporal Scaled (BTS) module.

We employ the Conditional Variational Autoencoder (CVAE) framework to model the stochastic behavior of each agent. To learn the model parameters $\theta$, we train our model by maximizing the sequential evidence lower-bound (ELBO), defined as follows:

$$ $\mathbb{E}_{q_{\phi}(\bm{z}^{\leq T}|\bm{x}^{\leq T})}\left[\sum^{T}_{t=1}\log p _{\theta}(\bm{x}^{t}|\bm{z}^{\leq t},\bm{x}^{<t})-\text{KL}\left(q_{\phi}(\bm{ z}^{t}|\bm{x}^{\leq t},\bm{z}^{<t})\|p_{\theta}(\bm{z}^{t}|\bm{x}^{<t},\bm{z}^ {<t})\right)\right],$ (2) $$

where $\bm{z}$ represents the latent variables for all agents. $p_{\theta}(\bm{z}^{t}|\bm{x}^{<t},\bm{z}^{<t})$ is the conditional prior of $\bm{z}$, which is set as a Gaussian distribution. The encoding process is implemented through $q_{\phi}(\bm{z}^{t}|\bm{x}^{\leq t},\bm{z}^{<t})$, and the decoding process through $p_{\theta}(\bm{x}^{t}|\bm{z}^{\leq t},\bm{x}^{<t})$. Note that Equation 2 is a lower bound of the log-likelihood described in Equation 1 and is calculated by summing the CVAE ELBO across each time step.

Figure: Figure 2: Detailed architecture of the encoding process, which consists of two main components: a Transformer encoder equipped with the GSM model, and a Mamba-based encoder featuring the BTS module. These components are designed to capture comprehensive spatial-temporal features and enable the model to learn missing patterns, thus generalizing to various missing situations.
Refer to caption: x3.png

#### Input Process.

Consider an agent $i$ at time step $t$ with position $\bm{x}^{t}_{i}$. We first compute the relative velocity $\bm{v}^{t}_{i}$ by subtracting the coordinates of adjacent time steps. For missing locations, we fill in the values using $(0,0)$ by element-wise multiplication with the mask. Additionally, we define a one-hot category vector $\bm{c}^{t}_{i}\in\mathbb{R}^{3}$ to represent three agent categories: ball, offensive player, or defensive player. This categorization is crucial in sports games where players may adopt specific offensive or defensive strategies. The agent features are projected to a high-dimensional feature vector $\bm{f}_{i,x}^{t}$. During training, we compute the feature vector $\bm{f}_{i,y}^{t}$ for the ground truth trajectory using similar steps but without the multiplication with the mask. Note that $\bm{f}_{i,y}^{t}$ is not computed during testing. The input feature vectors are calculated as follows:

$$ $\begin{aligned} \bm{f}_{i,x}^{t}=&\varphi_{x}\left((\bm{x}_{i}^{t}\odot{m}_{i} ^{t})\oplus(\bm{v}_{i}^{t}\odot{m}_{i}^{t})\oplus{m}_{i}^{t}\oplus\bm{c}_{i}^{ t};\mathbf{W}_{x}\right)\\ \bm{f}_{i,y}^{t}=&\varphi_{y}\left(\bm{x}_{i}^{t}\oplus\bm{v}_{i}^{t}\oplus \mathbf{1}\oplus\bm{c}_{i}^{t};\mathbf{W}_{y}\right)\end{aligned},$ (3) $$

where $\varphi_{x}(\cdot)$ and $\varphi_{y}(\cdot)$ are projection functions with weights $\mathbf{W}_{x}\in\mathbb{R}^{8\times D}$ and $\mathbf{W}_{y}\in\mathbb{R}^{8\times D}$, $\odot$ represents element-wise multiplication, and $\oplus$ indicates concatenation. We implemented $\varphi_{x}(\cdot)$ and $\varphi_{y}(\cdot)$ using MLPs. This approach allows us to incorporate location, velocity, visibility, and category information for extracting spatial features for subsequent analyses.

#### Transformer Encoder with Ghost Spatial Masking Module.

Unlike other sequential modeling tasks, it is crucial to consider dense social interactions, especially in sports games. Existing studies on human interactions predominantly use attention mechanisms like cross-attention and graph attention to capture these dynamics. However, given that we are addressing a unified problem with arbitrary incomplete inputs, it is essential for our model to learn the spatial-temporal missing patterns. While some studies [, ] utilize edge graphs with attached labels to extract missing features, this approach is resource-intensive and requires the construction of an additional graph layer. In contrast, we propose a novel and efficient Ghost Spatial Masking (GSM) module to abstract and summarize the spatial structures of missing data. This module can be smoothly integrated into the Transformer without complicating the model structure.

The Transformer [] was originally proposed to model the temporal dependencies for sequential data, and we adopt the multi-head self-attention design along the spatial dimension. At each time step, we treat each agent’s embedding as a token and input $N$ agent tokens into the Transformer encoder. To address various missing scenarios at each time step, we repeat the mask to the feature dimension $D$ to create a feature vector, applying max-pooling to summarize the mask features, which we term as a ghost masking embedding. For a mask vector $\bm{m}^{t}\in\mathbb{R}^{N\times 1}$ of $N$ agents at time step $t$, the ghost masking embedding is computed as follows:

$$ $\bm{f}^{t}_{gho}=\max_{i=1}^{N}\left(\text{repeat}(\bm{m}^{t},D)[i,:]\right),$ (4) $$

where the $\text{repeat}(\cdot)$ function expands the mask vector into a $N\times D$ matrix by repeating it $D$ times, and max-pooling is applied across rows to derive the ghost masking embedding $\bm{f}^{t}_{gho}\in\mathbb{R}^{1\times D}$. We also explore other permutation-invariant operations like mean or sum, as shown in Section 4.3, which perform effectively in our model.

Once we obtain the ghost masking embedding, we place it at the forefront of the agent embeddings and treat it as an additional head token. This approach is designed to extract order-invariant spatial features of the agents, accommodating any possible arrangement of agent order that might occur in practice. Consequently, we opt to omit the sinusoidal positional embeddings and instead use fully learnable positional embeddings $F^{t}_{pos}\in\mathbb{R}^{(N+1)\times D}$. The Transformer encoder is defined as follows:

$$ $\begin{aligned} F^{t}_{agent}&=\bm{f}^{t}_{gho}\oplus\bm{f}^{t}_{1}\oplus\bm{f }^{t}_{2},...,\oplus\bm{f}^{t}_{N}\\ Q^{t},K^{t},V^{t}&=\text{MLP}(F^{t}_{agent}+F^{t}_{pos})\\ F_{s}^{t}&=\text{FFN}\left(\text{MultiHeadAttn}(Q^{t},K^{t},V^{t})\right)\end{ aligned},$ (5) $$

where $\text{MultiHeadAttn}(\cdot,\cdot,\cdot)$ represents the multi-head attention layer, and $\text{FFN}(\cdot)$ is a feed-forward network consisting of two linear layers and a non-linear activation function. For simplicity, we omit the subscript $x$ or $y$ from the features in Equation 5 since the same model structure is used.

Ultimately, the Transformer encoder outputs the spatial features $F_{s,x}^{t}$ and $F_{s,y}^{t}$ for all agents at each time step $t$. We then remove the first token embedding and concatenate these features along the time dimension to obtain the spatial features $F_{s,x}=\{\oplus F_{s,x}^{t}|t\in{1,2,...T}\}\in\mathbb{R}^{N\times T\times D}$ and $F_{s,y}=\{\oplus F_{s,y}^{t}|t\in{1,2,...T}\}\in\mathbb{R}^{N\times T\times D}$ for the entire trajectory.

#### Bidirectional Temporal Mamba with Bidirectional Temporal Scaled Module.

Considering the Mamba model’s ability to capture long-term temporal dependencies, we have adapted it to integrate into our framework. However, adapting the Mamba model to our unified trajectory generation task is challenging, primarily due to the lack of an architecture specifically tailored to model trajectories. Effective trajectory modeling requires a thorough capture of spatial-temporal features, which is complicated by the incomplete nature of the trajectories in our task.

To enhance the temporal features extraction while reserving missing relationships, we introduce a Bidirectional Temporal Mamba. This adaptation incorporates multiple residual Mamba blocks paired with an innovative Bidirectional Temporal Scaled (BTS) module. Initially, we process the mask $M$ for the entire trajectory by reversing it along the time dimension to produce $\overleftarrow{M}$, which facilitates the model’s learning of temporal missing relationships by utilizing both the original and flipped masks within our BTS module. This process generates the scaling matrix $\overrightarrow{S}$ and its corresponding reversed version $\overleftarrow{S}$. Specifically, for agent $i$ at time step $t$, $s^{t}_{i}$ is computed as follows:

$$ $s^{t}_{i}=\left\{\begin{aligned} &1+s^{t-1}_{i}&\text{if $t>1$ and ${m}^{t}_{i }=0$}\\ &1&\text{if $t>1$ and ${m}^{t}_{i}=1$}\\ &0&\text{if $t=1$}\end{aligned}\right.,$ (6) $$

where the flip scaling matrix takes the same calculation. Then, we project the scaling matrix $\overrightarrow{S}$ and flipped scaling matrix $\overleftarrow{S}$ to the feature matrix as follows:

$$ $\begin{aligned} \overrightarrow{F}_{bts}&=1/\exp\left(\varphi_{s}( \overrightarrow{S};\mathbf{W}_{s})\right)\\ \overleftarrow{F}_{bts}&=1/\exp\left(\varphi_{s}(\overleftarrow{S};\mathbf{W}_ {s})\right)\end{aligned},$ (7) $$

where $\varphi_{s}(\cdot)$ are projection functions with weights $\mathbf{W}_{s}$. We implement $\varphi_{s}(\cdot)$ using MLPs with the ReLU activation function.

Equation 6 is designed to calculate the distance from the last observation to the current time step, which helps in quantifying the influence of temporal gaps, particularly when dealing with complex missing patterns. The insight is that the influence of a variable that has been missing for a period decreases over time. Therefore, we utilize a negative exponential function and the ReLU to ensure that the influence decays monotonically within a reasonable range between 0 0 and $1$. In this way, the transformation function in the Mamba model [] can be revised for our purposes as follows:

$$ $\begin{aligned} F_{z,x}&=(\overrightarrow{F}_{s,x}\odot\overrightarrow{F}_{bts })*\mathbf{\overline{K}_{forw,x}}+\text{Flip}\left((\overleftarrow{F}_{s,x} \odot\overleftarrow{F}_{bts})*\mathbf{\overline{K}_{back,x}}\right)\\ F_{z,y}&=\overrightarrow{F}_{s,y}*\mathbf{\overline{K}_{forw,y}}+\text{Flip} \left(\overleftarrow{F}_{s,y}*\mathbf{\overline{K}_{back,y}}\right)\end{ aligned},$ (8) $$

where $\mathbf{\overline{K}_{forw,x}}$ and $\mathbf{\overline{K}_{back,x}}$ are convolution kernels in the forward and backward directional Mamba blocks for masked inputs, while $\mathbf{\overline{K}_{forw,y}}$ and $\mathbf{\overline{K}_{back,y}}$ are the corresponding convolution kernels for ground truth trajectory features that only calculated in the training phase. The $\text{Flip}(\cdot)$ operation reverses the output features to ensure proper alignment and aggregation.

#### Posterior.

The encoding process described above is designed to determine the parameters of the Gaussian distribution for the approximate posterior. Specifically, the mean $\bm{\mu}_{q}$ and standard deviation $\bm{\sigma}_{q}$ of the posterior Gaussian distribution are calculated as follows:

$$ $[\bm{\mu}_{q},\bm{\sigma}_{q}]=\varphi_{q}(F_{z,x}\oplus F_{z,y}),$ (9) $$

where $\varphi_{q}$ is implemented using MLPs. We sample latent variables $\bm{Z}\sim\mathcal{N}(\bm{\mu}_{q},\text{Diag}(\bm{\sigma}_{q}^{2}))$ for trajectory generation. During testing, we sample $\bm{Z}$ from the prior Gaussian distribution $\mathcal{N}(0,\mathbf{I})$.

#### Decoder.

To improve the model’s ability to generate plausible trajectories, we concatenate the feature $F_{z,x}$ with the latent variable $\bm{Z}$ before feeding it into the decoder. The trajectory generation process is then calculated as follows:

$$ $\hat{Y}=\varphi_{dec}(F_{z,x}\oplus\bm{Z}),$ (10) $$

where $\varphi_{dec}$ is the decoder function implemented using MLPs.

#### Loss Function.

Given an arbitrary incomplete trajectory, our model will generate a complete trajectory. In addition to the ELBO loss defined in Equation 2, we compute the reconstruction loss for the visible regions and include a Winner-Take-All (WTA) loss among a total $K$ generated trajectories to promote generation diversity. These losses are defined as follows:

$$ $\begin{aligned} &\mathcal{L}_{elbo}=\|\hat{X}_{m}-{X}_{m}\|^{2}_{2}+\lambda_{1 }\text{KL}\left(\mathcal{N}(\bm{\mu}_{q},\text{Diag}(\bm{\sigma}_{q}^{2}))\| \mathcal{N}(0,\mathbf{I})\right)\\ &\mathcal{L}_{rec}=\|\hat{X}_{v}-{X}_{v}\|^{2}_{2}\qquad\mathcal{L}_{wta}=\min _{K}\|\hat{Y}^{(k)}-Y\|^{2}_{2}\\ &\mathcal{L}=\mathcal{L}_{elbo}+\lambda_{2}\mathcal{L}_{rec}+\lambda_{3} \mathcal{L}_{wta}\end{aligned},$ (11) $$

where $\lambda_{1}$, $\lambda_{2}$, and $\lambda_{3}$ are hyperparameters used to balance different loss terms. For the WTA loss, we generate multiple trajectories, and $\hat{Y}^{(k)}$ denotes the $k^{\mathrm{th}}$ generated trajectory.

## 4 Experiments

### 4.1 Benchmarks and Setup

#### Datasets.

We curate and benchmark three sports game datasets for this integrated challenging trajectory generation task, Basketball-U, Football-U, and Soccer-U.
(1) Basketball-U: We build Basketball-U from NBA dataset [], with 93,490 training sequences and 11,543 testing sequences. Each sequence consists of trajectories for 1 ball, 5 offensive players, and 5 defensive players.
(2) Football-U: Football-U is created from NFL Football Dataset (^1^11[https://github.com/nfl-football-ops/Big-Data-Bowl](https://github.com/nfl-football-ops/Big-Data-Bowl)), with 10,762 training sequences and 2,624 testing sequences. Each sequence consists of trajectories for 1 ball, 11 offensive players, and 11 defensive players.
(3) Soccer-U: SoccerTrack (^2^22[https://github.com/AtomScott/SportsLabKit](https://github.com/AtomScott/SportsLabKit)) [] dataset is used as the base to build Soccer-U. The top-view scenarios are used to extract 9,882 training sequences and 2,448 testing sequences. Each sequence consists of trajectories for 1 ball, 11 offensive players, and 11 defensive players. To cover various input situations, we design different 5 masking strategies. In our datasets, we set the trajectory length to $T=50$, and the number of agents $N$ includes all the players and the ball. Details can be found in Appendix B.

#### Baselines.

We use the following three categories of methods for comparison. Although some of these models were not originally designed for our trajectory generation task, we have adapted them to fit our needs.
(1) Statistical approach: This includes basic methods such as Mean, Median, and Linear Fit,
(2) Vanilla models: These are fundamental networks such as LSTM [] and Transformer [],
(3) Advanced baselines: Advanced deep learning models such as MAT [], Naomi [], INAM [], SSSD [], and GC-VRNN [].

**Table 2: We compare our UniTraj with baseline methods and report five metrics on the Basketball-U and Football-U datasets. The best results are highlighted and the second best results are underlined.**
| Method | Basketball-U (In Feet) | Football-U (In Yards) |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D | minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D |  |
| Mean | 14.58 | 0 | 0.99 | 52.39 | 737.58 | 14.18 | 0 | 0.52 | 25.06 | 606.07 |
| Medium | 14.56 | 0 | 0.98 | 51.80 | 743.36 | 14.23 | 0 | 0.52 | 24.96 | 600.22 |
| Linear Fit | 13.54 | 4.47e-03 | 0.56 | 42.86 | 453.38 | 12.66 | 1.49e-04 | 0.17 | 15.83 | 207.57 |
| LSTM [] | 7.10 | 9.02e-04 | 0.76 | 58.48 | 449.58 | 7.20 | 2.24e-04 | 0.43 | 34.06 | 228.13 |
| Transformer [] | 6.71 | 2.38e-03 | 0.79 | 59.34 | 517.54 | 6.84 | 5.68e-04 | 0.42 | 33.01 | 202.10 |
| MAT [] | 6.68 | 1.36e-03 | 0.88 | 58.83 | 483.46 | 6.36 | 4.57e-04 | 0.40 | 31.32 | 186.11 |
| Naomi [] | 6.52 | 2.02e-03 | 0.81 | 69.10 | 450.66 | 6.77 | 7.66e-04 | 0.67 | 42.74 | 259.11 |
| INAM [] | 6.53 | 3.16e-03 | 0.70 | 58.54 | 439.87 | 5.80 | 8.30e-04 | 0.39 | 32.10 | 177.04 |
| SSSD [] | 6.18 | 1.82e-03 | 0.47 | 46.87 | 393.12 | 5.08 | 6.81e-04 | 0.39 | 23.10 | 122.42 |
| GC-VRNN [] | 5.81 | 9.28e-04 | 0.37 | 28.08 | 235.99 | 4.95 | 7.12e-04 | 0.29 | 32.48 | 149.87 |
| Ground Truth | 0 | 0 | 0.17 | 37.61 | 269.49 | 0 | 0 | 0.03 | 12.56 | 76.68 |
| UniTraj (Ours) | 4.77 | 6.12e-04 | 0.27 | 34.25 | 240.83 | 3.55 | 1.12e-04 | 0.23 | 19.26 | 114.58 |

#### Evaluation Protocol.

We generate a total of $K=20$ trajectories based on the masked trajectory input and use the minADE20 as one of the evaluation metrics. Furthermore, we include four additional metrics [, ] to comprehensively assess the generation quality.
(1) minADE20: Calculate the minimum average displacement error between the generated trajectories and the ground truth across the 20 generated trajectories, (2) Out-of-Boundary (OOB): Measure the percentage of generated locations that fall outside the predefined court boundaries,
(3) Step: Calculate the average change in step size across the generated trajectories,
(4) Path-L: Calculate the average length of the trajectories for each agent,
(5) Path-D: Calculate the maximum difference in trajectory lengths among the agents.
Implementation details are provided in Appendix C.

### 4.2 Main Results

**Table 3: We compare UniTraj with baseline methods and report five metrics on the Soccer-U dataset. The best results are highlighted and the second best results are underlined.**
| Method | Soccer-U (In Pixels) |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
| minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D |  |
| Mean | 417.68 | 0 | 4.32 | 213.05 | 8022.51 |
| Medium | 418.06 | 0 | 4.39 | 214.55 | 8041.98 |
| Linear Fit | 398.34 | 0 | 0.70 | 112.34 | 2047.19 |
| LSTM [] | 186.93 | 4.74e-05 | 7.50 | 652.98 | 4542.78 |
| Transformer [] | 170.94 | 6.59e-05 | 6.66 | 566.14 | 4269.08 |
| MAT [] | 170.46 | 7.56e-05 | 6.45 | 562.44 | 3953.34 |
| Naomi [] | 145.20 | 8.78e-05 | 7.47 | 649.62 | 4414.99 |
| INAM [] | 134.86 | 4.04e-05 | 6.37 | 547.02 | 4102.37 |
| SSSD [] | 118.71 | 4.51e-05 | 5.11 | 425.98 | 3252.66 |
| GC-VRNN [] | 105.87 | 1.29e-05 | 4.92 | 506.32 | 3463.26 |
| Ground Truth | 0 | 0 | 0.52 | 112.92 | 951.00 |
| UniTraj (Ours) | 94.59 | 3.31e-06 | 4.52 | 349.73 | 2805.79 |

Evaluation results using five metrics across three datasets are presented in Table 2 for Basketball-U and Football-U, and in Table 3 for Soccer-U. Across all datasets, our UniTraj model achieves the lowest values on the minADE20 metric, confirming its ability to generate trajectories that are closest to the ground truth. Specifically, UniTraj outperforms GC-VRNN by $17.9\%$ on the minADE20 metric for the Basketball-U dataset, $28.3\%$ for Football-U, and $10.7\%$ for Soccer-U. Regarding the OOB metric, the Mean and Median methods fill missing positions with mean and median values respectively, naturally avoiding generating out-of-bound locations. Except for these two methods, our UniTraj achieves lower rates across all three datasets, indicating its effectiveness in generating trajectories that remain within the court.

An interesting observation is that the Linear Fit method yields results very close to the ground truth for metrics such as Step, Path-L, and Path-D, comparable to our UniTraj and other deep-learning methods. This is because these metrics do not assess the quality of the locations but rather the length information of the trajectory. For instance, the Step metric measures the second-order information of each step size, where the ground truth is very small, making Linear Fit a suitable method. In comparison, our UniTraj consistently outperforms other deep-learning methods by a large margin, proving its effectiveness. These findings verify the robust performance of UniTraj.

### 4.3 Ablation Study

#### Ablation of Each Component.

We start by analyzing the contribution of each component in our UniTraj. Table 4 presents the results of the ablation study for each component. The “w/o GSM” variant omits the Ghost Spatial Masking (GSM) module, feeding only the agent embedding into the Transformer. The “w/o GSM” variant excludes the Bidirectional Temporal Scaled (BTS) module, relying solely on the bidirectional temporal mamba encoder. The “uni w/ BTS” and ‘uni w/o BTS” variants use the forward unidirectional mamba encoder, with and without the BTS module.

Comparing our full model with the “w/o GSM” variant, we see that our proposed GSM module enhances the learning of the masking pattern to boost spatial features. The comparison between the “w/o BTS” variant and the “uni w/ BTS” versus “uni w/o BTS” variants demonstrates the effectiveness of the BTS module in capturing temporal missing patterns, regardless of whether the approach is bidirectional or unidirectional. Additionally, removing the backward mamba block leads to a decrease in performance, validating the effectiveness of our bidirectional design in capturing more comprehensive temporal dependencies.

Figure: Figure 3: Ablation study results on three datasets.

#### Ghost Masking Embedding.

We explore various strategies for generating a ghost masking embedding. Table 4 presents the results of our UniTraj using different head embeddings. In the “w/ global” variant, we repeat the mask and directly element-wise multiply with the agent embedding to create a hyper embedding that captures global feature information. The “w/ learnable” variant involves replacing our ghost embedding with a fully learnable one. The “w/ mean” and “w/ sum” variants apply mean-pooling and sum-pooling in Equation 4, respectively.

Comparison with the first two variants reveals that directly mapping the mask in UniTraj yields lower ADE across all datasets, underscoring the effectiveness of our GSM module. Results from the pooling variants are comparable, with max-pooling showing a slight advantage. This indicates that any permutation-invariant operation is effective within our module.

**Table 4: Results on Basketball-U with different depths.**
| Depth | Basketball-U (In Feet) |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D | Params |  |
| L = 1 | 5.14 | 4.38e-03 | 0.38 | 39.36 | 281.40 | 0.55M |
| L = 2 | 4.93 | 1.68e-04 | 0.30 | 35.09 | 141.12 | 0.96M |
| L = 3 | 4.85 | 2.95e-03 | 0.31 | 35.38 | 155.73 | 1.36M |
| L = 4 | 4.77 | 6.14e-04 | 0.27 | 34.25 | 240.83 | 1.77M |
| L = 5 | 4.81 | 1.02e-03 | 0.29 | 35.23 | 172.05 | 2.18M |
| GT | 0 | 0 | 0.17 | 37.61 | 269.49 | $-$ |

#### Mamba Block Depth.

We explore how different depths of temporal mamba block affect performance. Table 4 presents the results for the Basketball-U dataset. We observe that with $L=4$, it achieves the best performance in minADE20 and Step while maintaining competitive results on other metrics. Results for other datasets are detailed in Appendix D, where similar trends are observed. Considering the balance between the number of parameters and overall performance, we set L to 4 across all three datasets.

## 5 Conclusion

In this work, we address the problem of modeling multi-agent trajectories by considering various situations in real practice, emphasizing the need for a general approach. To accommodate diverse real-world scenarios, we introduce a unified trajectory generation task that simultaneously handles multiple input situations. Essentially, we treat different inputs, regardless of format, as masked trajectories to generate a complete trajectory. To address various missing data scenarios, we propose a simple yet effective Ghost Spatial Masking module that integrates within the Transformer encoder and a novel Bidirectional Temporal Scaled Module embedded within the extended Bidirectional Temporal Mamba encoder. We have also curated and benchmarked three sports game datasets, Basketball-U, Football-U, and Soccer-U, to evaluate our model and establish robust baselines for future research. Extensive experiments confirm the superior performance of our approach.

#### Limitations and Social Impacts

One limitation of our approach is the use of simple MLPs for decoding the trajectory. There is potential for improvement by developing a more powerful decoder. In addition, our sports game datasets have a fixed number of agents. How to accommodate datasets with varying numbers of agents remains an area for future exploration. We have not observed any negative societal impacts from UniTraj. Instead, we aim to advance the field by building datasets and establishing strong baselines that encourage further study into the unified trajectory generation task, with potential applications across various trajectory modeling domains.

## Appendix A Datasets, Code, and Models

We provide links in the abstract to our datasets, codes, and trained checkpoints. The README.md file contains detailed instructions to download the datasets and run the codes.

## Appendix B Datasets Details

**Table 5: Number of sequences for five masking strategies applied across all sequences. The average masking rate is also included for three datasets.**
| Dataset / Masking Type | 1 | 2 | 3 | 4 | 5 | Total Num | Masking Rate |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Basketball-U | Train | 18,718 | 18,767 | 18,769 | 18,694 | 18,542 | 93,490 | $52.61\%$ |
| Test | 2,400 | 2,257 | 2,317 | 2,281 | 2,288 | 11,543 | $52.65\%$ |  |
| Football-U | Train | 2,202 | 2,195 | 2,086 | 2,093 | 2,186 | 10,762 | $45.99\%$ |
| Test | 532 | 557 | 511 | 534 | 490 | 2,624 | $46.19\%$ |  |
| Soccer-U | Train | 1,978 | 2,040 | 1,951 | 1,974 | 1,939 | 9,882 | $46.17\%$ |
| Test | 487 | 461 | 476 | 498 | 526 | 2,448 | $46.41\%$ |  |

#### Basketball-U.

The base dataset is available from Stats Perform (^3^33[https://www.statsperform.com/artificial-intelligence-in-sport/](https://www.statsperform.com/artificial-intelligence-in-sport/)), which is used by recent works [, , , ]. The original dataset contains 104,003 training sequences and 13,464 testing sequences. Each sequence includes xy-coordinates (in feet) of the ball and 10 players (5 offensive and 5 defensive) for 8 seconds, sampled at a frequency of 6.25 Hz, resulting in sequences of length 50. The coordinates are unnormalized, with (0, 0) positioned at the bottom-left corner of the court. The court measures 94 feet in length and 50 feet in width. We first clean the dataset, removing sequences that fall outside the court boundaries. After cleaning, it consists of 93,490 training and 11,543 testing sequences. We then applied five masking strategies to generate the masks.

#### Football-U.

The base dataset is sourced from Next Gen Stats (^4^44[https://nextgenstats.nfl.com/](https://nextgenstats.nfl.com/)), which includes tracking files from the first six weeks of the 2017 season, and each file records one football game. The dataset includes 91 games, of which 73 are used for training and 18 for testing in our work. Each file provides trajectory sequences with xy-coordinates (in yards). These coordinates are unnormalized, with (0, 0) at the bottom-left corner of the field, which measures 120 yards in length and 53.3 yards in width. After cleaning the dataset, we have 9,882 training sequences and 2,448 testing sequences. Each sequence details the trajectories of 1 ball, 11 offensive players, and 11 defensive players.

#### Soccer-U.

We use the top-view scenarios from SoccerTrack dataset (^5^55[https://github.com/AtomScott/SportsLabKit](https://github.com/AtomScott/SportsLabKit)) []. The dataset contains 60 tracking files, from which we use 48 for training and 12 for testing. By applying a sliding window of size 4, we extract 9,882 training sequences and 2,448 testing sequences. As the data are provided in pixel coordinates, we use the original coordinates, with the soccer field dimensions set at 3,840 by 2,160 pixels. Each sequence consists of trajectories for 1 ball, 11 offensive players, and 11 defensive players.

#### Making Strategies.

We have designed five masking strategies to cover various input conditions, which are detailed in our “generatedataset.py” script:

- 1.
“Prediction Mask”: Generates a mask from one point to the end of the sequence for the prediction task, splitting the sequence into observation and prediction parts. We randomly select one of the following time points for splitting each agent’s sequence: 25, 30, 35, or 40.
- 2.
“Random Consecutive Mask”: Generates a random consecutive hole for each agent, with the number of holes ranging from 1 to 5 and each hole length randomly set to 3, 4, or 5.
- 3.
“Random Discrete Mask”: Creates a discrete mask where each location has a $50\%$ to $80\%$ probability of being masked.
- 4.
“Center Consecutive Mask”: Generates a random consecutive hole centrally placed with a length randomly chosen between 25 to 40.
- 5.
“Random Agent Mask”: Masks 5 players randomly in each sequence.

These hyperparameters are set to achieve an approximate masking rate of $50\%$. Adjusting these parameters or combining some of them can further increase the masking rate and the generation difficulty. Each masking strategy has an equal chance of being selected for any given sequence. The statistics for the three datasets are presented in Table 5.

## Appendix C Implementation Details and Configurations

The implementation details for different mapping functions $\varphi(\cdot)$ are provided at their first mention in the main paper. We set $\lambda_{1}=\lambda_{2}=\lambda_{3}=1$ to balance the losses as described in Equation 11. To ensure reproducibility, we fix the random seed at 2024 across our model during training. We project the input to a dimension of 64 as in Equation 3. In our Transformer encoder, the model dimension is set to 64 and the number of heads to 8. The dimension of the latent variable $Z$ is set to 128. In our Mamba block, the state dimension is 64, the convolution kernel size is 4, the expansion value is 2, and the depth $L$ is 4. The experiments are conducted using PyTorch [] on an NVIDIA A100 GPU. The model is trained over 100 epochs with a batch size of 128. We use the Adam optimizer [] with an initial learning rate of 0.001, which is decayed by 0.9 every 20 epochs.

For the baseline methods Vanilla LSTM and Transformer, we adopt the same input processing as in our UniTraj. The hidden state size for LSTM and the agent embedding dimension are both set to 64. In the Transformer model, the number of heads is 8, which is the same in our UniTraj. For the MAT method [], we use the official code available at (^6^66[https://github.com/ezhan94/multiagent-programmatic-supervision](https://github.com/ezhan94/multiagent-programmatic-supervision)). For Naomi [], the code can be found at (^7^77[https://github.com/felixykliu/NAOMI?tab=readme-ov-file](https://github.com/felixykliu/NAOMI?tab=readme-ov-file)). For INAM [], we have tried our best to reproduce their methods as described in their paper, since the authors have not released the code. For SSSD [], the code is available at (^8^88[https://github.com/AI4HealthUOL/SSSD](https://github.com/AI4HealthUOL/SSSD)). For GC-VRNN [], we obtained the code directly from the authors, as mentioned at (^9^99[https://github.com/colorfulfuture/GC-VRNN](https://github.com/colorfulfuture/GC-VRNN)).

**Table 6: Results on Football-U and Soccer-U with different depths.**
| Depth | Football-U (In Yards) | Soccer-U (In Pixels) |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D | Params | minADE20 $\downarrow$ | OOB $\downarrow$ | Step | Path-L | Path-D | Params |  |
| L = 1 | 3.68 | 1.99e-04 | 0.34 | 25.33 | 281.83 | 0.55M | 105.33 | 2.91e-04 | 7.28 | 531.20 | 18784.14 | 0.55M |
| L = 2 | 3.57 | 9.73e-05 | 0.23 | 19.26 | 124.01 | 0.96M | 101.16 | 8.28e-06 | 4.21 | 328.51 | 2100.98 | 0.96M |
| L = 3 | 3.59 | 7.70e-05 | 0.25 | 20.30 | 156.98 | 1.37M | 95.36 | 3.58e-05 | 4.42 | 343.45 | 2091.21 | 1.37M |
| L = 4 | 3.55 | 1.12e-04 | 0.23 | 19.26 | 114.58 | 1.77M | 94.59 | 3.31e-06 | 4.52 | 349.73 | 2805.79 | 1.77M |
| L = 5 | 3.59 | 1.76e-04 | 0.25 | 20.27 | 144.20 | 2.18M | 99.77 | 3.78e-05 | 4.51 | 345.13 | 2070.30 | 2.18M |
| GT | 0 | 0 | 0.03 | 12.56 | 76.68 | $-$ | 0 | 0 | 0.52 | 112.92 | 951.00 | $-$ |

## Appendix D Additional Experiments

#### Mamba Block Depth.

We provide complete results from our study on the impact of Mamba block depths in the Football-U and Soccer-U datasets. The results are presented in Table 6. A similar trend is observed in these datasets as with Basketball-U. Based on these findings, we have set $L=4$ across all three datasets in our work.

**Table 7: Study on depth $l$.**
| Depth | Basketball-U (In Feet) |  |
| --- | --- | --- |
| minADE20 $\downarrow$ | Params |  |
| l = 1 | 4.77 | 1.77M |
| l = 2 | 4.77 | 2.06M |
| l = 3 | 4.82 | 2.35M |
| l = 4 | 4.89 | 2.75M |

#### Transformer Depth.

We also study the impact of the number of stacked Transformer layers $l$. Table 7 presents the results on Basketball-U dataset. We observe that a single Transformer layer achieves the best results in minADE20, while also having the fewest model parameters. One possible reason is that our Transformer encoder is applied along the agent dimension, which is smaller than the sequence length, making one layer sufficient to extract spatial features effectively. Consequently, we set $l=1$ for all three datasets to maintain simplicity.

**Table 8: Results with different temporal architecture.**
| Variants | Basketball-U (In Feet) |
| --- | --- |
| minADE20 $\downarrow$ |  |
| w/ LSTM | 5.32 |
| w/ VRNN | 5.29 |
| w/ Transformer | 4.99 |
| w/ Mamba w/o BTS | 4.86 |
| w/ Mamba | 4.77 |

#### Different Temporal Architecture.

To further validate the effectiveness of the Mamba encoder, we replaced it with LSTM, VRNN, and Transformer models to determine if comparable results could be achieved. The results on the Basketball-U dataset are presented in Table 8. Since these architectures are not specifically designed for missing patterns, we also included a variant of ours without the BTS module. It is observed that the Mamba encoder, even without the BTS module, can achieve the lowest minADE20. This proves the effectiveness of the Mamba encoder in modeling temporal dependencies.

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: My questions to be answered and my concerns to be addressed have been discussed in the `weakness` section.
soundness: 2
strengths: - the proposed method is well designed for the sport scenes, such as soccer or basketball. With also tracking and forecasting the ball motion, the proposed method can be useful for the related sport activities..
- The proposed ghost masking embedding used to replace the usual head token can provide the order-invariant properties to the agent features, which can be extended to many related applications without losing generalization.
- Built upon the usual Mamba blocks, the proposed Bidirectional Temporal Mamba provides an improved fashion of processing spatial-temporal features with good adaptation to handle features on missing time steps.
- On the sports datasets, Basketball, Soccer and Football videos, the proposed method shows good quantitative results when compared to other related works.
- Overall, the paper is well written and the technical section can be easily followed.
summary: The authors focus on the trajectory prediction in sport scenes. They propose a trajectory generation model. They extend the Mamba model into a bidirectional temporal Mamba for the purpose to enhance the temporal dependencies with a transformer encoder for feature extractor. The proposed method aims to. solve the trajectory prediction, imputation and spatial-temporal recovery tasks in a unified paradigm. The applied methods are designed specified to the sports scenarios but some proposed modules can be appliable to more general tasks. The authors construct several sport scenario focused datasets with existing datasets. On the proposed benchmarking platform, the proposed method achieves good experimental results.
weaknesses: 1. My main concern about the proposed method is its generalizability. To be precise, the proposed method is evaluated on the three datasets Basketball-U, Soccer-U and Football-U, which are built by the authors themselves thus lacking a well established benchmarking. Therefore, it is hard to estimate the significance of the experimental performance by the provided benchmarking results. I would suggest the authors to add the experiments on the existing benchmarks, such as SDD, ETH/UCY or HM3.6M and include the recently published trajectory prediction methods into the comparison for a more convincing and well-established benchmarking.
2. The proposed methods model the ball trajectory and offensive/defensive player position explicitly. It is not clear whether the other baselines also follow this convention. For many previous works on NBA benchmark, based on which Basketball-U dataset is constructed, only the players position is considered. Such details of implementation alignment between the proposed method and baseline methods included in the benchmark results is critical to conduct a fair experiment and provide reliable experimental evidence.
3. There are many more recent related works, though they are mostly published on the benchmarking of ETH/UCY and SDD, should have been included in the experimental comparison, to provide a up-to-date evaluation of the quantitative significance of the proposed method. To name some: Eqmotion[1], MemoiNet[2], Flowchain[3].

Reference:

[1] “**EqMotion: Equivariant Multi-Agent Motion Prediction with Invariant Interaction Reasoning”, CVPR 2023**

[2] “**Remember Intentions: Retrospective-Memory-based Trajectory Prediction”, CVPR 2022**

[3 “**Fast Inference and Update of Probabilistic Density Estimation on Trajectory Prediction”, ICCV 2023**

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1.  Why have all-in-one methods for the three tasks, trajectory prediction, imputation, and spatial-temporal recovery, not been proposed.?
2. What are the challenges? 
3. Comparisons with other methods should be given.
soundness: 3
strengths: originality: This paper proposes a novel approach for handling multiple tasks, including trajectory prediction, imputation, and spatial-temporal recovery for multi-agent movement analysis. It introduces the innovative Ghost Spatial Masking module and extends the Mamba model with a new Bidirectional Temporal Scaled module to enhance the extraction of comprehensive spatial-temporal features from various incomplete trajectory inputs.

quality: The quality of this is generelly good. The method is well explained.

clarity: The paper is well-written and organized logically. The use of figures, especially the architectural diagrams and flowcharts, effectively aids in understanding the model's components and their interactions. Each section of the paper builds upon the previous one, leading to a cohesive narrative from problem formulation to experimental validation.

significance: The significance of this research lies in its potential impact on sports analytics and related fields requiring accurate multi-agent trajectory analysis.
summary: This paper proposed a Unified Trajectory Generation model, UniTraj, that processes arbitrary trajectories as masked inputs, adaptable to diverse scenarios in the domain of sports games, integrating trajectory prediction, imputation, and spatial-temporal recovery into a single framework. Key contributions include the development of a Ghost Spatial Masking module for spatial feature extraction, a Bidirectional Temporal Mamba encoder for enhanced temporal modeling, and the curation of three new sports datasets for robust evaluation.
weaknesses: The research problem is not well explained. The paper does not explain why all-in-one methods for the three tasks, trajectory prediction, imputation, and spatial-temporal recovery, have not been proposed. What are the challenges? The proposed methods should be compared separately with relevant methods for each task. Although the paper tests the model on three sports datasets, sports differ significantly in their dynamics and player interactions. More varied tests are needed.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 4
questions: See weakness above.
soundness: 2
strengths: This paper introduces a new problem (a unified trajectory generation task) along with several new datasets, with relatively comprehensive experiments and a substantial amount of work. They propose a Unifed lrajectoryenyironments.Generation model, UniTraj, that processes arbitrary trajectories as masked inputs.adaptable to diverse scenarios in the domain of sports games. They further extend recent State Space models (SSMs), known as the Mamba model, into a Bidirectional Temporal Mamba (BTM) to better capture temporal dependencies.
summary: They focus on the domain of sports and address the problem of modeling multi-agent trajectories by considering various situations in real practice, emphasizing the need for a general approach. To accommodate diverse real-world scenarios, they introduce a unified trajectory generation task that simultaneously handles multiple input situations.
weaknesses: 1.Could you please try LSTM/CNN or any other backbones instead of MLP to achieve better performance? 

2.Some equations are very similar, so you can combine them together (such as Eq.7). It's unnecessary to write them again.

3.You can also compare the FLOPs and total parameters with state-of-the-art methods to demonstrate your models’ efficiency.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: (1) At line 474, should it read "The 'w/o BTS' variant excludes the Bidirectional Temporal Scaled (BTS) module" instead of "w/o GSM"?

(2) At line 413, why is a total of K=20 trajectories generated? What is the variability among these 20 trajectories? I understand that generating multiple trajectories is necessary due to the model being generative, but I would like to know if selecting different values for K affects the experimental results (such as minADE). Additionally, were the baseline models evaluated under similar conditions, such as using K=20 trajectories?

(3) In Table 2, the minADE for UniTraj is reported as 94.59 pixels. What is the size of the soccer field in pixels? I want to understand how significant this error is in real-world measurements. Also, will you provide visual examples to demonstrate the quality of the generated trajectories, particularly for average cases?
soundness: 2
strengths: The paper presents an original idea by unifying three tasks—trajectory prediction, imputation, and spatial-temporal recovery—into a single framework. The selection of network components, such as the Ghost Spatial Masking (GSM) module and the Bidirectional Temporal Scaled (BTS) module, is well justified, and their effectiveness is thoroughly evaluated through extensive experiments. The model's performance is further validated using three distinct sports datasets, demonstrating its robustness and applicability across different scenarios.
summary: The contributions of the paper are as follows:
(1) The authors unified trajectory prediction, imputation, and spatial-temporal recovery into a single framework.
(2) They introduced the UniTraj model, capable of processing arbitrary trajectories as masked inputs, making it adaptable to diverse and incomplete datasets, particularly useful in sports scenarios.
(3) The paper shows how the Ghost Spatial Masking (GSM) module and the Bidirectional Temporal Scaled (BTS) module help achieve state-of-the-art performance by improving spatial feature extraction and preserving temporal relationships in trajectory data.
(4) The authors curated and benchmarked three practical sports datasets, namely Basketball-U, Football-U, and Soccer-U, which will serve as valuable resources for other researchers working in the field of sports analytics.
weaknesses: In real-world scenarios, trajectory masking isn't limited to binary values (0 or 1); detection errors often lead to incorrect trajectories. For instance, a referee might be mistakenly tracked as a player, or an incorrect ball-like object could be detected as the ball instead of the actual one. These errors highlight the need for models to handle not only missing but also erroneous data in trajectory prediction and recovery tasks.

Meta-review: The authors designed a novel approach for handling multiple tasks, which include trajectory prediction, imputation, and spatial-temporal recovery, for multi-agent motion analysis. All the four reviewers pointed out that the method is good and well designed, and thus all recommended acceptance. In the camera ready version, authors need to carefully improve the paper following reviewers' comments.

Decision: Accept (Poster)