---
abstract: 'In this work we contribute a novel pipeline to automatically generate training data, and to improve over state-of-the-art multi-object tracking and segmentation (MOTS) methods. Our proposed tracklet mining algorithm turns raw street-level videos into high-fidelity MOTS training data, is scalable and overcomes the need of expensive and time-consuming manual annotation approaches. We leverage state-of-the-art instance segmentation results in combination with optical flow obtained from models also trained on automatically harvested training data. Our second major contribution is [MOTSNet]{}– a deep learning, tracking-by-detection architecture for MOTS – deploying a novel mask-pooling layer for improved object association over time. Training [MOTSNet]{}with our automatically extracted data leads to significantly improved sMOTSA scores on the novel [KITTI MOTS]{}dataset (+1.9%/+7.5% on cars/pedestrians). Even without learning from a single, manually annotated MOTS training example we still improve over prior state-of-the-art, confirming the compelling properties of our pipeline. On the MOTSChallenge dataset we improve by +4.1%, further confirming the efficacy of our proposed [MOTSNet]{}.'
author:
- |
    Lorenzo Porzi$^\dagger$, Markus Hofinger$^\ddagger$, Idoia Ruiz$^\ast$, Joan Serrat$^\ast$, Samuel Rota Bulò$^\dagger$, Peter Kontschieder$^\dagger$\
    Mapillary Research$^\dagger$, Graz University of Technology$^\ddagger$, Computer Vision Center$^\ast$\
    [research@mapillary.com$^\dagger$, markus.hofinger@icg.tugraz.at$^\ddagger$, {iruiz,joans}@cvc.uab.es$^\ast$]{}
bibliography:
- 'arxiv.bib'
title: 'Learning Multi-Object Tracking and Segmentation from Automatic Annotations'
---

Introduction and Motivation {#sec:intro}
===========================

We focus on the challenging task of multi-object tracking and segmentation (MOTS) [@Voigtlaender_2019_CVPR], which was recently introduced as an extension of bounding-box based multi-object tracking. Joining instance segmentation with tracking was shown to noticeably improve tracking performance, as unlike bounding boxes, instance segmentation masks do not suffer from overlapping issues but provide fine-grained, pixel-level information about the objects to be tracked.

While this finding is encouraging, it comes with the downside of requiring pixel-level (typically polygon-based) annotations, which are known to be time-consuming in generation and thus expensive to obtain. The works in [@Cordts2016; @MVD2017] report annotation times of $\approx$90 minutes per image, to manually produce high-quality panoptic segmentation masks. Analogously, it is highly demanding to produce datasets for the MOTS task where instance segmentation masks need to also contain tracking information across frames.

To avoid generating MOTS labels completely from scratch and in a purely manual way, [@Voigtlaender_2019_CVPR] has followed the semi-automatic annotation procedure from [@Caelles_2017_CVPR], and extended the existing multi-object tracking datasets *KITTI tracking* [@Geiger2012CVPR] (21 sequences from the raw KITTI dataset) and MOTChallenge [@MilanL0RS16] (4/7 sequences). These datasets already provide bounding box-based tracklets for cars and pedestrians. Instance segmentation masks were generated as follows. First, two segmentation masks per object were generated by human annotators (which also had to chose the objects based on diversity in the first place). Then, DeepLabV3+ [@Chen2018ECCV], a state-of-the-art semantic segmentation network, was trained on the initially generated masks in a way to overfit these objects in a sequence-specific way, thus yielding reasonable segmentation masks for the remaining objects in each track. The resulting segmentation masks then underwent another manual correction step to fix remaining errors. Finally, these automatic and manual steps were iterated until convergence.

Including an automated segmentation algorithm is clearly speeding up the MOTS dataset generation process, but still has significant shortcomings. Most importantly, the approach in [@Voigtlaender_2019_CVPR] still depends on the availability of bounding-box based, multi-object tracking information as provided by datasets like [@Geiger2012CVPR; @MilanL0RS16]. Also, their remaining human annotation effort for generating initial instance masks was considerable,  [@Voigtlaender_2019_CVPR] reports that $\approx$8k masks (or $12.3\%$ of all masks in [KITTI MOTS]{}) had been manually labeled before fine-tuning a (modified) DeepLabV3+ segmentation network, pre-trained on COCO [@LinMSCOCO2014] and Mapillary Vistas [@MVD2017]. Finally, such an approach cannot be expected to generalize well for generating orders of magnitude more training data.

In this paper we introduce a novel approach for automatically generating high-quality training data (see Fig. \[fig:sequence\] for an example) from generic street-level videos for the task of joint multi-object tracking and segmentation. Our methods are conceptually simple and leverage state-of-the-art instance [@He2017] (or Panoptic [@Por+19_cvpr; @cheng2019panopticdeeplab]) segmentation models trained on *existing* image datasets like Mapillary Vistas [@MVD2017] for the task of object instance segmentation. We further describe how to automatically mine tracking labels for all detected object instances, building upon state-of-the-art optical flow models [@Yin_2019_CVPR], that in turn have been trained on automatically harvested flow supervision obtained from image-based 3d modeling (structure-from-motion).

Another important contribution of our paper is [MOTSNet]{}, a deep learning, tracking-by-detection approach for MOTS. [MOTSNet]{}takes advantage of a novel mask-pooling layer, which allows it to exploit instance segmentation masks to compute a representative embedding vector for each detected object. The tracking process can then be formulated as a series of Linear Assignment Problems, optimizing a payoff function which compares detections in the learned embedding space.

We demonstrate the superior quality for each step of our proposed MOTS training data extraction pipeline, as well as the efficacy of our novel mask-pooling layer. The key contributions and findings of our approach are:

-   Automated MOTS training data generation – instance detection, segmentation and actual tracking – is possible at scale and with very high fidelity, approximating the quality of previous state-of-the-art results [@Voigtlaender_2019_CVPR] without even directly training for it.

-   Deep-learning based, supervised optical flow [@Yin_2019_CVPR] can be effectively trained on pixel-based correspondences obtained from Structure-from-Motion and furthermore used for tracklet extraction.

-   Direct exploitation of instance segmentation masks through our proposed mask-pooling layer yields to significant improvements of sMOTSA scores

-   The combination of our general-purpose MOTS data generation pipeline with our proposed [MOTSNet]{}improves by up to 1.2% for cars and 7.5% for pedestrians over the previously best method on [KITTI MOTS]{}in absolute terms, while using $13.7\%$ fewer parameters. Similarly we can gain $4.1\%$ over the previously best-performing work on the MOTSChallenge dataset.

We provide extensive ablation studies on the [KITTI MOTS]{}, MOTSChallenge, and Berkeley Deep Drive BDD100k [@Yu2018] datasets and obtain results consistently improving with a large margin over the prior state-of-the-art [@Voigtlaender_2019_CVPR].

Related Works
=============

Since the MOTS task was only very recently introduced in [@Voigtlaender_2019_CVPR], directly related works are scarce. Instead, the bulk of related works in a broader sense comes from the MOT (multi-object tracking) and VOS (video object segmentation) literature. This is true in terms of both, datasets (see  [@Geiger2012CVPR; @MOTChallenge2015; @MilanL0RS16] for MOT and [@Perazzi_2016_CVPR; @Prest_2012_CVPR; @Li_2013_ICCV] for VOS/VOT, respectively), and methods tackling the problems ([@sharma2018beyond] for MOT and [@yang2019video; @Luiten_2019_ICCV; @Osep18ICRA; @wang2019fast] for VOS).

#### Combining motion and semantics.

The work in [@NIPS2017_7267] uses semantic segmentation results from [@Long2015] for video frames together with optical flow predictions from EpicFlow [@RevaudWHS15] to serve as *ground truth*, for training a joint model on future scene parsing, the task of anticipating future motion of scene semantics. In [@Luc_2018] this task is extended to deal with future instance segmentation prediction, based on convolutional features from a Mask R-CNN [@He2017] instance segmentation branch. In [@HurR16] a method for jointly estimating optical flow and temporally consistent semantic segmentation from monocular video is introduced. Their approach is based on a piece-wise flow model, enriched with semantic information through label consistency of superpixels.

#### Semi-automated dataset generation.

Current MOT [@wen2015ua; @MilanL0RS16; @Geiger2012CVPR] and VOS [@xu2018youtube; @Pont-Tuset_arXiv_2017] benchmarks are annotated based on human efforts. Some of them, however, use some kind of automation. In [@xu2018youtube], they exploit the temporal correlation between consecutive frames in a skip-frame strategy, although the segmentation masks are manually annotated. A semi-automatic approach is proposed in [@berg2019semi] for annotating multi-modal benchmarks. It uses a pre-trained VOS model [@johnander2019generative] but still requires additional manual annotations and supervision on the target dataset. The MOTS training data from [@Voigtlaender_2019_CVPR] is generated by augmenting an existing MOT dataset [@MilanL0RS16; @Geiger2012CVPR] with segmentation masks, using the iterative, human-in-the-loop procedure we briefly described in Sec. \[sec:intro\]. The tracking labels on [@MilanL0RS16; @Geiger2012CVPR] were manually annotated and, in the case of [@MilanL0RS16], refined by adding high-confidence detections from a pedestrian detector.

The procedures used in these semi-automatic annotation approaches often resemble those of VOS systems which require user input to select objects of interest in a video. Some proposed techniques in this field [@chen2018blazingly; @caelles20182018; @maninis2018deep] are extensible to multiple object scenarios. A pixel-level embedding is built in [@chen2018blazingly] to solve segmentation and achieve state-of-the-art accuracy with low annotation and computational cost. To the best of our knowledge, the only work that generates tracking data from unlabeled large-scale videos is found in [@OsepVoigtlaender18ECCVW]. By using an adaptation of the approach in [@Osep18ICRA], Osep perform object discovery on unlabeled videos from the KITTI Raw [@Gei+13] and Oxford RobotCar [@maddern20171] datasets. Their approach however cannot provide joint annotations for instance segmentation and tracking.

#### Deep Learning methods for MOT and MOTS.

Many deep learning methods for MOTS/VOS are based on “tracking by detection”, candidate objects are first detected in each frame, and then joined into tracklets as a post-processing step ( [@Voigtlaender_2019_CVPR]). A similar architecture, a Mask R-CNN augmented with a tracking head, is used in [@yang2019video] to tackle Video Instance Segmentation. A later work [@Luiten_2019_ICCV] improved over [@yang2019video] by adapting the UnOVOST [@ZulfikarLuitenUnOVOST] model that, first in an unsupervised setting, uses optical flow to build short tracklets later merged by a learned embedding. For the plain MOT task, Sharma  [@sharma2018beyond] incorporated shape and geometry priors into the tracklet generation process.

Other works instead, perform detection-free tracking. CAMOT [@Osep18ICRA] tracks category-agnostic mask proposals across frames, exploiting both appearance and geometry cues from scene flow and visual odometry. Finally, the VOS work in [@wang2019fast], follows a correlation-based approach, extending popular tracking models [@bertinetto2016fully; @li2018high]. Their SiamMask model only requires bounding box initialization but is pre-trained on multiple, human-annotated datasets [@LinMSCOCO2014; @xu2018youtube; @Rus+15].

Dataset Generation Pipeline {#sec:datagen}
===========================

Our proposed data generation approach is rather generic its data source, and here we focus on the [KITTI Raw]{} [@Gei+13] dataset. [KITTI Raw]{}contains 142 sequences (we excluded the 9 sequences overlapping with the validation set of [KITTI MOTS]{}), for a total of $\sim 44$k images, captured with a professional rig including stereo cameras, LIDAR, GPS and IMU. Next we describe our pipeline which, relying only on monocular images and GPS data is able to generate accurate MOTS annotations for the dataset.

Generation of Instance Segmentation Results {#sec:instance-seg}
-------------------------------------------

We begin with segmenting object instances in each frame per video and consider a predefined set ${\ensuremath{\mathcal{Y}}}$ of $37$ object classes that belong to the Mapillary Vistas dataset [@MVD2017]. To extract the instance segments, we run the Seamless Scene Segmentation method [@Por+19_cvpr], augmented with a ResNeXt-101-32$\times$8d [@Xie2016] backbone and trained on Mapillary Vistas. By doing so, we obtain a set of object segments ${\ensuremath{\mathcal{S}}}$ per video sequence. For each segment $s\in{\ensuremath{\mathcal{S}}}$, we denote by $t_s\geq 0$ the frame where the segment was extracted, by $y_s\in{\ensuremath{\mathcal{Y}}}$ the class it belongs to and by $\phi_s:\mathbb R^2\to\{0,1\}$ a pixel indicator function representing the segmentation mask, $\phi_s(i,j)=1$ if and only if pixel $(i,j)$ belongs to the segment. For convenience, we also introduce the notation ${\ensuremath{\mathcal{S}}}_t$ to denote the set of all segments extracted from frame $t$ of a given video. For [KITTI Raw]{}we roughly extracted 1.25M of segments.

Generation of Tracklets using Optical Flow {#sec:tracklets}
------------------------------------------

After having automatically extracted the instance segments from a given video in the dataset, our goal is to leverage on optical flow to extract tracklets, consecutive sequences of frames where a given object instance appears.

#### Flow training data generation.

We automatically generate ground-truth data for training an optical flow network by running a Structure-from-Motion (SfM) pipeline, namely OpenSfM[^1], on the [KITTI Raw]{}video sequences and densify the result using PatchMatch [@shen2013accurate]. To further improve the quality of the 3d reconstruction, we exploit the semantic information that has been already extracted per frame to remove spurious correspondences generated by moving objects. Consistency checks are also performed in order to retain correspondences that are supported by at least $3$ images. Finally, we derive optical flow vectors between pairs of consecutive video frames in terms of the relative position of correspondences that are visible in both frames. This process produces a sparse optical flow, which will be densified in the next step.

#### Flow network.

We train a modified version of the HD$^3$ flow network [@Yin_2019_CVPR] on the dataset that we generated from [KITTI Raw]{}, without any form of pre-training. The main differences with respect to the original implementation are the use of In-Place Activated Batch Norm (iABN) [@RotPorKon18a], which provides memory savings that enable the second difference, namely the joint training of forward and backward flow. We then run our trained flow network on pairs of consecutive frames in [KITTI Raw]{}in order to determine a *dense* pixel-to-pixel mapping between them. In more detail, for each frame $t$ we compute the backward mapping $\overleftarrow f_{t}:\mathbb R^2\to\mathbb R^2$, which provides for each pixel of frame $t$ the corresponding pixel in frame $t-1$.

![image](architecture.pdf){width="\textwidth"}

#### Tracklets generation.

In order to represent the tracklets that we have collected up to frame $t$, we use a graph ${\ensuremath{\mathcal{G}}}_t=({\ensuremath{\mathcal{V}}}_t, {\ensuremath{\mathcal{T}}}_t)$, where vertices are all segments that have been extracted until the $t$th frame, ${\ensuremath{\mathcal{V}}}_t=\bigcup_{j\geq 1}^t\mathcal S_j$, and edges ${\ensuremath{\mathcal{T}}}_t\subseteq {\ensuremath{\mathcal{V}}}_t^2$ provide the matching segments across consecutive frames. We start by initializing the graph in the first frame as ${\ensuremath{\mathcal{G}}}_1=({\ensuremath{\mathcal{S}}}_1, \emptyset)$. We construct ${\ensuremath{\mathcal{G}}}_{t}$ for $t>1$ inductively from ${\ensuremath{\mathcal{G}}}_{t-1}$ using the segments ${\ensuremath{\mathcal{S}}}_t$ extracted at time $t$ and the mapping $\overleftarrow f_{t}$ according to the following procedure. The vertex set ${\ensuremath{\mathcal{V}}}_t$ of graph ${\ensuremath{\mathcal{G}}}_t$ is given by the union of the vertex set ${\ensuremath{\mathcal{V}}}_{t-1}$ of ${\ensuremath{\mathcal{G}}}_{t-1}$ and ${\ensuremath{\mathcal{S}}}_t$, ${\ensuremath{\mathcal{V}}}_{t}={\ensuremath{\mathcal{V}}}_{t-1}\cup {\ensuremath{\mathcal{S}}}_t$. The edge set is computed by solving a linear assignment problem between ${\ensuremath{\mathcal{S}}}_{t-1}$ and ${\ensuremath{\mathcal{S}}}_t$, where the payoff function is constructed by comparing segments in ${\ensuremath{\mathcal{S}}}_t$ against segments in ${\ensuremath{\mathcal{S}}}_{t-1}$ warped to frame $t$ via the mapping $\overleftarrow f_{t}$. We design the payoff function $\pi(\hat s, s)$ between a segment $\hat s\in{\ensuremath{\mathcal{S}}}_{t-1}$ in frame $t-1$ and a segment $s\in{\ensuremath{\mathcal{S}}}_t$ in frame $t$ as follows: $$\pi(\hat s, s)=\text{IoU}(\phi_{s},\phi_{\hat s}\circ\overleftarrow f_{t})+\eta(\hat s, s)\,,$$ where $\text{IoU}(\cdot,\cdot)$ computes the Intersection-over-Union of the two masks given as input, and $\eta(\hat s, s)\in\{-\infty,0\}$ is a characteristic function imposing constraints regarding valid mappings. Specifically, $\eta(\hat s, s)$ returns $0$ if and only if the two segments belong to the same category, $y_{\hat s}=y_s$, and none of the following conditions on $s$ hold:

-   $b_1(s)-b_2(s)<\tau_0$

-   $b_1(s)<\tau_1$, and

-   $b_1(s)/r(s)<\tau_2$,

where $b_1(s)$ and $b_2(s)$ denote the largest and second-largest areas of intersection with $s$ obtained by segments warped from frame $t-1$ and having class $y_s$, and $r(s)$ denotes the area of $s$ that is not covered by segments of class $y_s$ warped from frame $t-1$. We solve the linear assignment problem by maximizing the total payoff under a relaxed assignment constraint, which allows segments to remain unassigned. In other terms, we solve the following optimization problem: $$\begin{aligned}
  \label{eq:optim}
    \text{maximize}&\int\int \pi(\hat s, s) \alpha(\hat s, s)\, d\hat s\,ds\\
  \label{eq:constr1}
    \text{s.t.}& \int\alpha(\hat s,s)ds\leq 1\qquad \forall \hat s\in{\ensuremath{\mathcal{S}}}_{t-1}\\
  \label{eq:constr2}
    & \int\alpha(\hat s,s)d\hat s\leq 1\qquad \forall s\in{\ensuremath{\mathcal{S}}}_{t}\\
  \label{eq:constr3}
    &\alpha(\hat s, s)\in\{0,1\}\quad\forall (\hat s, s)\in{\ensuremath{\mathcal{S}}}_{t-1}\times{\ensuremath{\mathcal{S}}}_t\,.\end{aligned}$$ Finally, the solution $\alpha$ of the assignment problem can be used to update the set of edges ${\ensuremath{\mathcal{T}}}_t$, ${\ensuremath{\mathcal{T}}}_t={\ensuremath{\mathcal{T}}}_{t-1}\cup \alpha^{-1}(1)$, where $\alpha^{-1}(1)$ is the set of matching segments, the pre-image of $1$ under $\alpha$.

Note that this algorithm can’t track objects across full occlusions, since optical flow can’t be used to infer the trajectories of invisible objects. When training [MOTSNet]{}however, we easily overcome this limitation with a simple heuristic, described in Sec. \[sec:training\]. As will be shown in Sec. \[sec:experiments-ks\], [MOTSNet]{}predictions actually *outperform* the ground truth data it was trained on.

[MOTSNet]{} {#sec:main}
===========

Here we describe our multi-object tracking and segmentation approach. Its main component is [MOTSNet]{}(see Sec. \[sec:architecture\]), a deep net based on the Mask R-CNN [@He2017] framework. Given an RGB image, [MOTSNet]{}outputs a set of instance segments, each augmented with a learned embedding vector which represents the object’s identity in the sequence (see Sec. \[sec:training\]). The object tracks are then reconstructed by applying a LAP-based algorithm, described in Sec. \[sec:inference\].

Architecture {#sec:architecture}
------------

[MOTSNet]{}’s architecture follows closely the implementation of Mask R-CNN described in [@Por+19_cvpr], and depicted in Figure \[fig:architecture\], with the addition of a Tracking Head (TH) which runs parallel to the Region Segmentation Head (RSH). The “backbone” of the network is composed of an FPN [@Lin2016] component on top of a ResNet-50 body [@He2015b], producing multi-scale features at five different resolutions. These features are fed to a Region Proposal Head (RPH), which predicts candidate bounding boxes where object instances could be located in the image. Instance specific features are then extracted from the FPN levels using ROI Align [@He2017] in the areas defined by the candidate boxes, and fed to the RSH and the TH. Finally, for each region, the RSH predicts a vector of class probabilities, a refined bounding box and an instance segmentation mask. Synchronized InPlace-ABN [@RotPorKon18a] is employed throughout the network after each layer with learnable parameters, except for those producing output predictions. For an in-depth description of these components we refer the reader to [@Por+19_cvpr].

#### Tracking Head (TH).

Instance segments, together with the corresponding ROI Align features from the FPN, are fed to the TH to produce a set of $N_e$-dimensional embedding vectors. As a first step, the TH applies “mask-pooling” (described in the section below) to the input spatial features, obtaining 256-dimensional vector features. This operation is followed by a fully connected layer with 128 channels and synchronized InPlace-ABN. Similarly to masks and bounding boxes in the RSH, embedding vectors are predicted in a class-specific manner by a final fully connected layer with $N_e\times C$ outputs, where $C$ is the number of classes, followed by L2-normalization to constrain the vectors on the unit hyper-sphere. The output vectors are learned such that instances of the same object in a sequence are mapped close to each other in the embedding space, while instances of other objects are mapped far away. This is achieved by minimizing a batch hard triplet loss, described in Sec. \[sec:training\].

#### Mask-pooling.

ROI Align features include both foreground and background information, but, in general, only the foreground is actually useful for recognizing an object across frames. In our setting, by doing instance segmentation together with tracking, we have a source of information readily available to discriminate between the object and its background. This can be exploited in a straightforward attention mechanism: pooling under the segmentation mask. Formally, given the pixel indicator function $\phi_s(i,j)$ for a segment $s$ (see Sec. \[sec:instance-seg\]), and the corresponding input $N$-dimensional ROI-pooled feature map $\mathrm{X}_s:\mathbb{R}^2\to\mathbb{R}^N$, mask-pooling computes a feature vector $x_s\in\mathbb{R}^N$ as: $$x_s = \frac{\sum_i\sum_j\phi_s(i, j)\mathrm{X}_s(i, j)}{\sum_i\sum_j\phi_s(i, j)}\,.$$ During training we pool under the ground truth segmentation masks, while at inference time we switch to the masks predicted by the RSH.

Training Losses {#sec:training}
---------------

[MOTSNet]{}is trained by minimizing the following loss function: $$L = L_\text{TH} + \lambda (L_\text{RPH} + L_\text{RSH})\,,$$ where $L_\text{RPH}$ and $L_\text{RSH}$ represent the Region Proposal Head and Region Segmentation Head losses as defined in [@Por+19_cvpr], and $\lambda$ is a weighting parameter.

$L_\text{TH}$ is the loss component associated with the Tracking Head, the following batch hard triplet loss [@hermans2017defense]: $$\begin{gathered}
  L_\text{TH} = \frac{1}{|{\ensuremath{\mathcal{S}}}_B|} \sum_{s\in{\ensuremath{\mathcal{S}}}_B}
    \max(\max_{\hat{s} \in \mu_B(s)} \|a_s^{y_s} - a_{\hat{s}}^{y_{\hat{s}}}\| \\
    - \min_{\hat{s} \in \bar{\mu}_B(s)} \|a_s^{y_s} - a_{\hat{s}}^{y_{\hat{s}}}\| + \beta,0)\,,\end{gathered}$$ where ${\ensuremath{\mathcal{S}}}_B$ is the set of predicted, positive segments in the current batch, $a_s^{y_s}$ is the class-specific embedding vector predicted by the TH for a certain segment $s$ and ground truth class $y_s$, and $\beta$ is a margin parameter. The definition of a “positive” segment follows the same logic as in the RSH (see [@Por+19_cvpr]), a segment is positive if its bounding box has high IoU with a ground truth segment’s bounding box. The functions $\mu_B(s)$ and $\bar{\mu}_B(s)$ map $s$ to the sets of its “matching” and “non-matching” segments in ${\ensuremath{\mathcal{S}}}_B$, respectively. These are defined as: $$\begin{aligned}
  \mu_B(s) &= \left\{\hat{s}\in{\ensuremath{\mathcal{S}}}_B \mid y_s = y_{\hat{s}} \land M(s, \hat{s})\right\}\,,\\
  \bar{\mu}_B(s) &= \left\{\hat{s}\in{\ensuremath{\mathcal{S}}}_B \mid y_s = y_{\hat{s}} \land \neg M(s, \hat{s})\right\}\,,\end{aligned}$$ where $M(s, \hat{s})$ is true iff $s$ and $\hat{s}$ belong to the same tracklet in the sequence. Note that we are restricting the loss to only compare embedding vectors of segments belonging to the same class, effectively letting the network learn a set of class-specific embedding spaces.

In order to overcome the issue due to occlusions mentioned in Sec. \[sec:tracklets\], when training on [KITTI Synth]{}we also apply the following heuristic. Ground truth segments are only considered in the tracking loss if they are associated with a tracklet that appears in more than half of the frames in the current batch. This ensures that, when an occlusion in the scene causes a tracklet to split, the two pieces are never mistakenly treated by the network as two different objects.

Inference {#sec:inference}
---------

During inference, we feed frames $t$ through the network, obtaining a set of predicted segments ${\ensuremath{\mathcal{S}}}_t$, each with its predicted class $y_s$ and embedding vector $a_s^{y_s}$. Our objective is now to match the segments across frames in order to reconstruct a tracklet for each object in the sequence. To do this, we follow the same algorithmic framework described in Sec. \[sec:tracklets\], with a couple of modifications. First, we allow matching segments between the current frame and a sliding window of $N_w$ frames in the past. Second, we do not rely on optical flow anymore, instead measuring the similarity between segments in terms of their distance in the embedding space and temporal offset.

More formally, we redefine the payoff function in Eq.  as: $$\begin{aligned}
  \pi(\hat{s}, s) &= -\pi^*(\hat{s}, s) + \eta(s, \hat{s})\,,\\
  \pi^*(\hat{s}, s) &= \|a_s^{y_s} - a_{\hat{s}}^{y_{\hat{s}}}\| + \frac{|t_s - t_{\hat{s}}|}{N_w}\,,
  \label{eq:inference-po}\end{aligned}$$ where the characteristic function $\eta(s, \hat{s})$ is redefined as: $$\eta(s, \hat{s}) = \begin{cases}
    0 & \text{if}\,y_s = y_{\hat{s}} \land \pi^*(\hat{s}, s) \leq \tau\,, \\
    -\infty & \text{otherwise}\,,
  \end{cases}$$ and $\tau$ is a configurable threshold value. Furthermore, we replace ${\ensuremath{\mathcal{S}}}_{t-1}$ in Eq.  and Eq.  with the set: $${\ensuremath{\mathcal{U}}}_t = \left\{s\in \mathcal V_{t-1} \mid t_s \geq t-N_w \land (s,\hat s)\notin{\ensuremath{\mathcal{T}}}_{t-1} \forall \hat s\right\}\,,$$ which contains all terminal (most recent) segments of the tracklets seen in the past $N_w$ frames. As a final step after processing all frames in the sequence, we discard the tracklets with fewer than $N_t$ segments, as, empirically, very short tracks usually arise from spurious detections.

Experiments {#sec:experiments}
===========

We provide a broad experimental evaluation assessing i) the quality of our automatically harvested [KITTI Synth]{}dataset on the MOTS task by evaluating it against the [KITTI MOTS]{}dataset, ii) demonstrate the effectiveness of [MOTSNet]{}and our proposed mask-pooling layer against strong baselines on the [KITTI MOTS]{}and MOTSChallenge datasets, iii) demonstrate the generality of our MOTS label generation process by extending the BDD100k tracking dataset with segmentation masks to become a MOTS variant thereof and iv) provide an ablation about the contribution of association terms for the final tracklet extraction. While we can benchmark the full MOTS performance on [KITTI MOTS]{}and MOTSChallenge, we are able to infer the tracking performance based on the ground truth box-based tracking annotations available for BDD100k.

Evaluation Measures
-------------------

The CLEAR MOT [@bernardin2008evaluating] metrics, including Multi-Object Tracking Accuracy (MOTA) and Precision (MOTP), are well established as a standard set of measures for evaluating Multi-Object Tracking systems. These, however, only account for the bounding box of the tracked objects. Voigtlaender  [@Voigtlaender_2019_CVPR] describe an extension of MOTA and MOTP that measure segmentation as well as tracking accuracy, proposing the sMOTSA, MOTSA and MOTSP metrics. In particular, MOTSA and MOTSP are direct equivalents of MOTA and MOTP, respectively, where the prediction-to-ground-truth matching process is formulated in terms of mask IoU instead of bounding box IoU. Finally, sMOTSA can be regarded as a “soft” version of MOTSA where the contribution of each true positive segment is weighted by its mask IoU with the corresponding ground truth segment. Please refer to Appendix \[sec:metrics\] for a formal description of these metrics.

Experimental Setup {#sec:exp-setup}
------------------

All the results in the following sections are based on the same [MOTSNet]{}configuration, with a ResNet-50 backbone and embedding dimensionality fixed to $N_e=32$. Batches are formed by sampling a subset of $N_w$ full-resolution, contiguous frames at a random offset in one of the training sequences, for each GPU. During training we apply scale augmentation in the $[0.8,1.25]$ range and random flipping. Training by SGD follows the following linear schedule: $\text{lr}_i=\text{lr}_0(1-\frac{\#\text{steps}}{i})$, where $\text{lr}_0$ is the starting learning rate and $i$ is the training step (batch) index. Please refer to Appendix \[sec:params\] for a full specification of the training parameters. The network weights are initialized from an ImageNet-pretrained model (“I” in the tables), or from a Panoptic Segmentation model trained on the Mapillary Vistas dataset (“M” in the tables), depending on the experiment. Differently from [@Voigtlaender_2019_CVPR], we do not pre-train on MS COCO [@LinMSCOCO2014] (“C” in the tables).

The hyper-parameters of the inference algorithm are set as follows: threshold $\tau=1$; window size $N_w$ equal to the per-GPU batch size used during training; minimum tracklet length $N_t=5$. Note that, in contrast with [@Voigtlaender_2019_CVPR], we do not fine-tune these parameters, instead keeping them fixed in all experiments, and independent of class. All experiments are run on four V100 GPUs with 32GB of memory.

[KITTI MOTS]{} {#sec:experiments-ks}
--------------

The [KITTI MOTS]{}dataset was introduced in [@Voigtlaender_2019_CVPR], adding instance segmentation masks for cars and pedestrians to a subset of 21 sequences from KITTI raw [@Geiger2012CVPR]. It has a total of 8.008 images (5.027 for training and 2.981 for validation), containing approximately 18.8k/8.1k annotated masks for 431/99 tracklets of cars/pedestrians in training, and roughly 8.1k/3.3k masks for 151/68 tracklets on the validation split. Approximately $12.3\%$ of all masks were manually annotated and the rest are human-verified and -corrected instance masks. As the size of this dataset is considerably larger and presumably more informative than MOTSChallenge, we focused our ablations on it.

Table \[tab:results-ks\] summarizes the analyses and experiments we ran on our newly generated [KITTI Synth]{}dataset, by evaluating on the official [KITTI MOTS]{}validation set. We discuss three types of ablations in what follows.

#### [KITTI Synth]{}data quality analysis.

The two topmost rows of Tab. \[tab:results-ks\] show the results when generating the validation set results solely with our proposed dataset generation pipeline, described in Section \[sec:datagen\], no learned tracking component is involved. Using the optical flow model predictions from HD$^3$ [@Yin_2019_CVPR] and their best-performing model for KITTI[^2], we obtain reasonable baseline results. When fine-tuning HD$^3$ with the optical flow training data generation process from SfM described in Section \[sec:datagen\], our synthetically extracted validation data considerably outperforms the sMOTSA scores on pedestrians and almost obtains the performance on cars for CAMOT [@Osep18ICRA], as reported in [@Voigtlaender_2019_CVPR] While this validates our tracklet generation process and the way we harvest optical flow training data, we investigate further if learning from imperfect data (tracklets are prone to break when associated via optical flow) like [KITTI Synth]{}.

#### [MOTSNet]{}tracking head ablations.

The center block in Tab \[tab:results-ks\] compares different configurations for the Tracking Head described in \[sec:main\]. The first variant (<span style="font-variant:small-caps;">AveBox+TH</span>) replaces the mask-pooling operation in the Tracking Head with average pooling on the whole box. The second and third variants (<span style="font-variant:small-caps;">AveMsk-TH</span>, <span style="font-variant:small-caps;">AveBox-TH</span>) completely remove the Tracking Head and its associated loss, instead directly computing the embeddings by pooling features under the detected mask or box, respectively. All variants perform reasonably well and improve over [@Osep18ICRA; @osep2017combined] on the primary sMOTSA metric. Notably, <span style="font-variant:small-caps;">AveMsk-TH</span>, the variant using our mask-pooling layer and no tracking head, is about on par with TrackR-CNN on cars despite being pre-trained only on ImageNet, using a smaller, ResNet-50 backbone and not exploiting any tracking supervision. The last variant in this block shows the performance obtained when [MOTSNet]{}is trained only on images also in the [KITTI MOTS]{}training set, and with our full model. Interestingly, the scores only drop to an extent where the gap to [@Voigtlaender_2019_CVPR] might be attributed to their additional pre-training on MS COCO and Mapillary Vistas and a larger backbone (*cf.* Tab. \[tab:results-km\]). Finally, comparing the latter directly to our [MOTSNet]{}results from Tab. \[tab:results-km\] (ImageNet pre-trained only), where we directly trained on [KITTI MOTS]{}training data, our [KITTI Synth]{}-based results improve substantially on cars, again confirming the quality of our automatically extracted dataset.

The bottommost part of this table shows the performance when training on the full [KITTI Synth]{}dataset and evaluating on [KITTI MOTS]{}validation, using different pre-training settings. The first is pre-trained on ImageNet and the second on both, ImageNet and Mapillary Vistas. While there is only little gap between them on the car class, the performance on pedestrians rises by over 5% when pre-training on Vistas. The most encouraging finding is that using our solely automatically extracted [KITTI Synth]{}dataset we obtain significantly improved scores (+1.6% on cars, +7.4% on pedestrians) in comparison to the previous state-of-the-art method from [@Voigtlaender_2019_CVPR], trained on manually curated data.

#### [MOTSNet]{}on [KITTI MOTS]{}.

In Tab. \[tab:results-km\] we directly compare against previously top-performing works including TrackR-CNN [@Voigtlaender_2019_CVPR] and references from therein, CAMOT [@Osep18ICRA], CIWT [@osep2017combined], and BeyondPixels [@sharma2018beyond]. It is worth noting that the last three approaches were reported in [@Voigtlaender_2019_CVPR] and partially built on. We provide all relevant MOTS measures together with separate average AP numbers to estimate the quality of bounding box detections or instance segmentation approaches, respectively. For our [MOTSNet]{}we again show results under different pre-training settings (ImageNet, Mapillary Vistas and [KITTI Synth]{}). Different pre-trainings affect the classes cars and pedestrians in a different way, the ImageNet and Vistas pre-trained model performs better on pedestrians while the [KITTI Synth]{}pre-trained body is doing better on cars. This is most likely due to the imbalanced distribution of samples in [KITTI Synth]{}while our variant with pre-training on both, Vistas *and* [KITTI Synth]{}yields the overall best results. We obtain absolute improvements of **1.9%/7.5%** for cars/pedestrians over the previously best work in [@Voigtlaender_2019_CVPR] despite using a smaller backbone and no pre-training on MS COCO. Finally, also the recognition metrics for both, detection (box mAP) and instance segmentation (mask mAP) significantly benefit from pre-training on our [KITTI Synth]{}dataset, and in conjunction with Vistas rise by 7.2% and 6.4% over the ImageNet pre-trained variant, respectively.

  -------------------------------------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
                                                                                                                                     
  Method                                  Pre-training     Car        Ped        Car        Ped        Car        Ped        Box        Mask
  TrackR-CNN [@Voigtlaender_2019_CVPR]      I, C, M        76.2       47.1       87.8       65.5       87.2       75.7        –          –
  CAMOT [@Osep18ICRA]                       I, C, M        67.4       39.5       78.6       57.6       86.5       73.1        –          –
  CIWT [@osep2017combined]                  I, C, M        68.1       42.9       79.4       61.0       86.7       75.7        –          –
  BeyondPixels [@sharma2018beyond]          I, C, M        76.9        –       **89.7**      –         86.5        –          –          –
                                               I           69.0       45.4       78.7       61.8       88.0       76.5       55.2       49.3
                                              I, M         74.9       53.1       83.9       67.8       89.4       79.4       60.8       54.9
                                             I, KS         76.4       48.1       86.2       64.3       88.7       77.2       59.7       53.3
                                            I, M, KS     **78.1**   **54.6**     87.2     **69.3**   **89.6**   **79.7**   **62.4**   **55.7**
  -------------------------------------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

[MOTSNet]{}on BDD100k
---------------------

Since our MOTS training data generation pipeline can be directly ported to other datasets we also conducted experiments on the recently released BDD100k tracking dataset [@Yu2018]. It comprises 61 sequences, for a total of $\sim 11$k frames and comes with bounding box based tracking annotations for a total of 8 classes (in our evaluation we focus only on cars and pedestrians, for compatibility with [KITTI Synth]{}and [KITTI MOTS]{}). We split the available data into training and validation sets of, respectively, 50 and 11 sequences, and generate segmentation masks for each annotated bounding box, again by using [@Por+19_cvpr] augmented with a ResNeXt-101-32$\times$8d backbone. During data generation, the instance segmentation pipeline detected many object instances missing in the annotations, which is why we decided to provide *ignore* box annotations for detections with very high confidence but missing in the ground truth. Since there are only bounding-box based tracking annotations available, we present MOT rather than MOTS tracking scores. The results are listed in Tab. \[tab:results-bdd100k\], comparing pooling strategies <span style="font-variant:small-caps;">AveBox+Loss</span> and <span style="font-variant:small-caps;">AveMsk+Loss</span>, again as a function of different pre-training settings. We again find that our proposed mask-pooling results compare favorable against the vanilla box-based pooling. While the improvement is small compared to the ImageNet-only pre-trained backbone, the Vistas pre-trained model benefits noticeably.

[MOTSNet]{}on MOTSChallenge
---------------------------

In Tab. \[tab:results-mc\] we present our results on MOTSChallenge, the second dataset contributed in [@Voigtlaender_2019_CVPR] and again compare against all related works reported therein. This dataset comprises of 4 sequences, a total of 2.862 frames and 228 tracks with roughly 27k pedestrians, and is thus significantly smaller than [KITTI MOTS]{}. Due to the smaller size, the evaluation in [@Voigtlaender_2019_CVPR] runs leave-one-out cross validation on a per-sequence basis. We again report numbers for differently pre-trained versions of [MOTSNet]{}. The importance of segmentation pre-training on such small datasets is here quite evident: while [MOTSNet]{}(I) shows the overall worst performance, its COCO pre-trained version jumps ahead of all baselines.

Ablations on Tracklet Extraction {#sec:ablation}
--------------------------------

Here we analyze the importance of different cues in the payoff function used during inference (see Section \[sec:inference\]): distance in the embedding space (Embedding), distance in time (Time) and signed intersection over union [@simonelli2019disentangling] (sIoU) between bounding boxes. Please refer to Appendix \[sec:sIoU\] for more details on the use of sIoU. As a basis, we take the best performing [MOTSNet]{}model from our experiments on [KITTI MOTS]{}, listed at the bottom of Table \[tab:results-km\]. This result was obtained by combining Embedding and Time, as in Eq. . As can be seen from differently configured results in Tab. \[tab:results-TrackletGraph\], the embedding itself already serves as a good cue, and can be slightly improved on pedestrians when combined with information about proximity in time (with $0.1$ drop on cars), while outperforming sIoU. Figure \[fig:tSNE\] shows a visualization of the embedding vectors learned by this model.

![t-SNE visualization of the embedding vectors computed by the Tracking Head for sequence “0014” of [KITTI MOTS]{}. Points corresponding to detections of the same object have the same color.[]{data-label="fig:tSNE"}](tSNE-3D.pdf){width="\columnwidth"}

Conclusions
===========

In this work we addressed and provided two major contributions for the novel task of joint multi-object tracking and segmentation (MOTS). First, we introduced an automated pipeline for extracting high-quality training data from generic street-level videos in order to overcome the lack of MOTS training data, without time- and cost-intensive, manual annotation efforts. Data is generated by solving the linear assignment on a causal tracklet graph, where instance segmentations per frame define the nodes, and optical-flow based compatibilities represent edges as connections over time. Our second major contribution is a deep-learning based [MOTSNet]{}architecture to be trained on MOTS data, exploiting a novel mask-pooling layer that guides the association process for detections based on instance segmentation masks. We provide exhaustive ablations for both, our novel training data generation process and our proposed [MOTSNet]{}, yielding cumulated, absolute improvements of 1.9%/7.5% for cars/pedestrians over the previously best work in [@Voigtlaender_2019_CVPR] on the [KITTI MOTS]{}dataset.

CLEAR MOT and MOTS metrics {#sec:metrics}
==========================

The CLEAR MOT metrics (including MOTA and MOTP) are first defined in [@bernardin2008evaluating] to evaluate Multi-Object Tracking systems. In order to compute MOTA and MOTP, a matching between the ground truth and predicted tracklets needs to be computed at each frame by solving a linear assignment problem. We will not repeat the details of this process, instead focusing on the way its outputs are used to compute the metrics. In particular, for each frame $t$, the matching process gives:

-   the number of correctly matched boxes $\text{TP}_t$;

-   the number of mismatched boxes $\text{IDS}_t$, the boxes belonging to a predicted tracklet that was matched to a different ground truth tracklet in the previous frame;

-   the number of false positive boxes $\text{FP}_t$, the predicted boxes that are not matched to any ground truth;

-   the number of ground truth boxes $\text{GT}_t$;

-   the intersection over union $\text{IoU}_{t,i}$ between each correctly predicted box and its matching ground truth.

Given these, the metrics are defined as: $$\text{MOTA} = \frac{\sum_t (\text{TP}_t - \text{FP}_t - \text{IDS}_t)}{\sum_t \text{GT}_t}\,,$$ and $$\text{MOTP} = \frac{\sum_{t,i} \text{IoU}_{t,i}}{\sum_t \text{TP}_t}\,.$$

The MOTS metrics [@Voigtlaender_2019_CVPR] extend the CLEAR MOT metrics to the segmentation case. Their computation follows the overall procedure described above, with a couple of exceptions. First, box IoU is replaced with mask IoU. Second, the matching process is simplified by defining a ground truth and predicted segment to be matching if and only if their IoU is greater than 0.5. Different from the bounding box case, the segmentation masks are assumed to be non-overlapping, meaning that this criterion results in a unique matching without the need to solve a LAP. With these changes, and given the definitions above, the MOTS metrics are: $$\text{MOTSA} = \frac{\sum_t (\text{TP}_t - \text{FP}_t - \text{IDS}_t)}{\sum_t \text{GT}_t}\,,$$ $$\text{sMOTSA} = \frac{\sum_t (\sum_i \text{IoU}_{t,i} - \text{FP}_t - \text{IDS}_t)}{\sum_t \text{GT}_t}\,,$$ and $$\text{MOTSP} = \frac{\sum_{t,i} \text{IoU}_{t,i}}{\sum_t \text{TP}_t}\,.$$

Hyper-parameters {#sec:params}
================

Data Generation
---------------

In the data generation process, when constructing tracklets (see Sec. \[sec:tracklets\]) we use the following parameters: $\tau_0=10\text{pix}$, $\tau_1=10\text{pix}$, $\tau_2=2$.

Network training
----------------

As mentioned in Sec. \[sec:exp-setup\], all our trainings follow a linear learning rate schedule: $$\text{lr}_i = \text{lr}_0 \left(1 - \frac{i}{\#\text{steps}}\right)\,,$$ where the initial learning rate $\text{lr}_0$ and total number of steps depend on the dataset and pre-training setting. The actual values, together with the per-GPU batch sizes $N_w$ are reported in Tab. \[tab:hyper\]. The loss weight parameter $\lambda$ in the first equation of Sec. \[sec:training\] is fixed to $1$ in all experiments, except for the COCO pre-trained experiment on MOTSChallenge, where $\lambda=0.1$.

Signed Intersection over Union {#sec:sIoU}
==============================

Signed Intersection over Union, as defined in [@simonelli2019disentangling], extends standard intersection over union between bounding boxes, by providing meaningful values when the input boxes are not intersecting. Given two bounding boxes $\hat{{\ensuremath{\boldsymbol{b}}}}=(\hat{u}_1, \hat{v}_1, \hat{u}_2, \hat{v}_2)$ and ${\ensuremath{\boldsymbol{b}}}=(u_1, v_1, u_2, v_2)$, where $(u_1, v_1)$ and $(u_2, v_2)$ are the coordinates of a box’s top-left and bottom-right corners, respectively, the signed intersection over union $\text{sIoU}(\hat{{\ensuremath{\boldsymbol{b}}}}, {\ensuremath{\boldsymbol{b}}})$ is:

-   greater than 0 and equal to standard intersection over union when the boxes overlap;

-   less than 0 when the boxes don’t overlap, and monotonically decreasing as their distance increases.

This is obtained by defining: $$\text{sIoU}(\hat{{\ensuremath{\boldsymbol{b}}}}, {\ensuremath{\boldsymbol{b}}}) = \frac{|\hat{{\ensuremath{\boldsymbol{b}}}}\sqcap{\ensuremath{\boldsymbol{b}}}|_\pm}{|\hat{{\ensuremath{\boldsymbol{b}}}}|+|{\ensuremath{\boldsymbol{b}}}|-|\hat{{\ensuremath{\boldsymbol{b}}}}\sqcap{\ensuremath{\boldsymbol{b}}}|_\pm}\,,$$ where $$\hat{{\ensuremath{\boldsymbol{b}}}}\sqcap{\ensuremath{\boldsymbol{b}}} = \left(\begin{array}{l}
    \max(\hat{u}_1, u_1) \\
    \max(\hat{v}_1, v_1) \\
    \min(\hat{u}_2, u_2) \\
    \min(\hat{v}_2, v_2)
  \end{array}\right)$$ is an extended intersection operator, $|{\ensuremath{\boldsymbol{b}}}|$ denotes the area of ${\ensuremath{\boldsymbol{b}}}$, and $$|{\ensuremath{\boldsymbol{b}}}|_\pm = \begin{cases}
    +|{\ensuremath{\boldsymbol{b}}}| & \text{if}\ u_2 > u_1 \land v_2 > v_1, \\
    -|{\ensuremath{\boldsymbol{b}}}| & \text{otherwise},
  \end{cases}$$ is the “signed area” of ${\ensuremath{\boldsymbol{b}}}$.

Signed intersection over union is used in the ablation experiments of Sec. \[sec:ablation\] as an additional term in the payoff function $\pi(\hat{s}, s)$ as follows: $$\begin{aligned}
  \pi(\hat{s}, s) &= -\pi^*(\hat{s}, s) + \eta(s, \hat{s})\,,\\
  \pi^*(\hat{s}, s) &= \text{sIoU}({\ensuremath{\boldsymbol{b}}}_s, {\ensuremath{\boldsymbol{b}}}_{\hat{s}}) + \|a_s^{y_s} - a_{\hat{s}}^{y_{\hat{s}}}\| + \frac{|t_s - t_{\hat{s}}|}{N_w}\,,
  \label{eq:inference-po}\end{aligned}$$ where ${\ensuremath{\boldsymbol{b}}}_s$ denotes the bounding box of segment $s$.

[^1]: <https://github.com/mapillary/OpenSfM>

[^2]: Pre-trained models available at <https://github.com/ucbdrive/hd3>.
