Knowledge of the 3D environment structure and the motion of dynamic objects is essential for autonomous navigation [geiger20143d, shashua2004pedestrian]
. The 3D structure is valuable because it implicitly models the relative position of the agent, and it is also utilized to improve the performance of the high-level scene understanding such as detection and segmentation[lee2017vpgnet, shin2019roarnet, behley2019iccv, lee2019visuomotor]. Besides scene structure, the 3D motion of the agent and traffic participants such as pedestrians and vehicles is also required for safe driving. The relative direction and speed between them are taken as the primary inputs for determining the next direction of travel.
Recent advances in deep neural networks (DNNs) have led to a surge of interest in depth prediction using monocular images[eigen2014depth, garg2016unsupervised] and stereo images [mayer2016large, chang2018pyramid], as well as in optical flow estimation [dosovitskiy2015flownet, sun2018pwc, lv2018learning]
. These supervised methods require a large amount and broad variety of training data with ground-truth labels. Studies have shown significant progress in unsupervised learning of depth and ego-motion from unlabeled image sequences[zhou2017unsupervised, godard2017unsupervised, wang2018learning, mahjourian2018unsupervised, ranjan2019collaboration]. The joint optimization framework uses a network for predicting single-view depth and pose, and exploits view synthesis of images in the sequence as the supervisory signal. However, these works ignore or mask out regions of moving objects for pose and depth inference.
In this work, rather than consider moving object regions as a nuisance [zhou2017unsupervised, godard2017unsupervised, wang2018learning, mahjourian2018unsupervised, ranjan2019collaboration], we utilize them as an important clue for estimating 3D object motions. This problem can be formulated as motion factorization of object motion and ego-motion. Factorizing object motion in monocular sequences is challenging problem, especially in complex urban environments that contain many dynamic objects. Moreover, deformable dynamic objects such as humans make the problem more difficult because of the greater inaccuracy in their correspondence [russell2014video].
To address this problem, we propose a novel framework that explicitly models 3D motions of dynamic objects and ego-motion together with scene depth in a monocular camera setting. Our unsupervised method relies solely on monocular video for training (without any ground-truth labels) and imposes a photo-consistency loss on warped frames from one time step to the next in a sequence. Given two consecutive frames from a video, the proposed neural network produces depth, 6-DoF motion of each moving object, and the ego-motion between adjacent frames as shown in Fig. 1. In this process, we leverage the instance mask of each dynamic object, obtained from an off-the-shelf instance segmentation module.
Our main contributions are the following:
Forward image warping Differentiable depth-based rendering (which we call inverse warping) was introduced in [zhou2017unsupervised], where the target view is reconstructed by sampling pixels from a source view based on the target depth map and the relative pose . The warping procedure is effective in static scene areas, but the regions of moving objects cause warping artifacts because the 3D structure of the source image may become distorted after warping based on the target image’s depth [casser2019depth]. To build a geometrically plausible formulation, we introduce forward warping which maps the source image to the target viewpoint based on the source depth and the relative pose . There is a well-known remaining issue with forward warping that the output image may have holes. Thus, we propose the differentiable and hole-free forward warping module that works as a key component in our instance-wise depth and motion learning from monocular videos. The details are described in Sec. 3.2.
Instance-wise photometric and geometric consistency Existing works [cao2019learning, lee2019learning] have successfully estimated independent object motion with stereo cameras. Approaches based on stereo video can explicitly separate static and dynamic motion by using stereo offset and temporal information. On the other hand, estimation from monocular video captured in the dynamic real world, where both agents and objects are moving, suffers from motion ambiguity, as only temporal clues are available. To address this issue, we introduce instance-wise view synthesis and geometric consistency into the training loss. We first decompose the image into background and object (potentially moving) regions using a predicted instance mask. We then warp each component using the estimated single-view depth and camera poses to compute photometric consistency. We also impose a geometric consistency loss for each instance that constrains the estimated geometry from all input frames to be consistent. Sec. 3.3 presents our technical approach (our loss and network details) for inferring 3D object motion, ego-motion and depth.
Mini-batch arrangement Our work aims to recover instance-wise 6-DoF object motion regardless of how many instances the scene contains. To accomplish this efficiently, we propose an instance-wise mini-batch arrangement technique that organizes mini-batches with respect to the total number of instances to avoid iterative training.
KITTI video instance segmentation dataset We introduce an auto-annotation scheme to generate a video instance segmentation dataset, which is expected to contribute to various areas of self-driving research. The role is this method is similar to that of [yang2019video], but we design a new framework that tailored to driving scenarios. Details are described in Sec. 3.4.
Our unsupervised monocular depth and pose estimation is validated with a performance evaluation, presented in Sec.4, which shows that our jointly learned system outperforms earlier approaches.
Our codes, models, and video instance segmentation dataset will be made publicly available.
2 Related Works
Unsupervised depth and ego-motion learning Several works [zhou2017unsupervised, godard2017unsupervised, wang2018learning, mahjourian2018unsupervised, ranjan2019collaboration] have studied the inference of depth and ego-motion from monocular sequences. Zhou et al. [zhou2017unsupervised] introduce an unsupervised learning framework for depth and ego-motion by maximizing photometric consistency across monocular videos during training. Godard et al. [godard2017unsupervised] offer an approach replacing the use of explicit depth data during training with easier-to-obtain binocular stereo footage. It trains a network by searching for the correspondence in a rectified stereo pair that requires only a one-dimensional search. Wang et al. [wang2018learning] show that Direct Visual Odometry (DVO) can be used to estimate the camera pose between frames and the inverse depth normalization leads to a better local minimum. Mahjourian et al. [mahjourian2018unsupervised] combine 3D geometric constraints using Iterative Closest Point (ICP) with a photometric consistency loss. Ranjan et al. [ranjan2019collaboration] propose a competitive collaboration framework that facilitates the coordinated training of multiple specialized neural networks to solve joint problems. Recently, there have been two works [bian2019unsupervised, chen2019self] that achieve state-of-the-art performance on depth and ego-motion estimation using geometric constraints.
Learning motion of moving objects Recently, the joint optimization of dynamic object motion along with the depth and ego-motion [casser2019depth, cao2019learning] has gained interest as a new research topic. Casser et al. [casser2019depth] present an unsupervised image-to-depth framework that models the motion of moving objects and cameras. The main idea is to introduce geometric structure in the learning process, by modeling the scene and the individual objects; camera ego-motion and object motions are learned from monocular videos as input. Cao et al. [cao2019learning]
propose a self-supervised framework with a given 2D bounding box to learn scene structure and object 3D motion from stereo videos. They factor the scene representation into independently moving objects with geometric reasoning. However, this work is based on a stereo camera setup and computes the 3D motion vector of each instance using simple mean filtering.
Video instance segmentation The task of video instance segmentation (VIS) is to simultaneously conduct detection, segmentation and tracking of instances in videos. Yang et al. [yang2019video] first extend the image instance segmentation problem to the video domain. To facilitate research on this new task, they present a large-scale dataset and a new tracking branch to Mask R-CNN to jointly perform the detection, segmentation and tracking tasks simultaneously.
We introduce an end-to-end joint training framework for instance-wise depth and motion learning from monocular videos without supervision. Figure 2
illustrates an overview of the complete pipeline. The core of our method is a novel forward rigid projection module to align the depth map from adjacent frames and an instance-wise training loss. In this section, we introduce the forward projective geometry and the networks for each type of output: DepthNet, Ego-PoseNet, and Obj-PoseNet. Further, we describe our novel loss functions and how they are designed for back-propagation in decomposing the background and moving object regions.
3.1 Method Overview
Given two consecutive RGB images , sampled from an unlabeled video, we first predict their respective depth maps via our presented DepthNet with trainable parameters . By concatenating two sequential images as an input, our proposed Ego-PoseNet , with trainable parameters , estimates the six-dimensional SE(3) relative transformation vectors . With the predicted depth, relative ego-motion, and a given camera intrinsic matrix , we can synthesize an adjacent image in the sequence using an inverse warping operation , where is the reconstructed image by warping the reference frame [zhou2017unsupervised, jaderberg2015spatial]. As a supervisory signal, an image reconstruction loss, , is imposed to optimize the parameters, and .
The baseline method has a limitation that it cannot handle dynamic scenes containing moving objects. Our goal is to learn depth and ego-motion, as well as object motions, using monocular videos by constraining them with instance-wise geometric consistencies. We propose an Obj-PoseNet with trainable parameters and number of instances, which is specialized to estimating individual object motions. We annotate a novel video instance segmentation dataset to utilize it as an individual object mask while training the ego-motion and object motions. The details of the video instance segmentation dataset will be described in Sec. 3.4. Given two consecutive binary instance masks corresponding to , -instances are annotated and matched between the frames. First, in the case of camera ego-motion, potentially moving objects are masked out and only the background region is fed to Ego-PoseNet. Secondly, the -binary instance masks are multiplied to the input images and fed to Obj-PoseNet. For both networks, motions of the element are represented as , where means camera ego-motion from frame to . The details of the motion models will be described in the following subsections.
The previous works [mahjourian2018unsupervised, bian2019unsupervised, chen2019self]
imposed geometric constraints between frames, but they are limited to rigid projections. Regions containing moving objects cannot be constrained with this term and are treated as outlier regions with regard to geometric consistency. In this paper, we propose instance-wise geometric consistency. We leverage instance masks to impose geometric consistency region-by-region. Following instance-wise learning, our overall objective function can be defined as follows:
where are the reconstruction and geometric consistency losses applied on each instance region including the background, stands for the depth smoothness loss, and are the object translation and height constraint losses. is the set of loss weights. We train the models in both forward () and backward () directions to maximally use the self-supervisory signals. In the following subsections, we introduce how to constrain the instance-wise consistencies.
3.2 Forward Projective Geometry
A fully differentiable warping function enables learning of structure-from-motion tasks. This operation is first proposed by spatial transformer networks (STN) [jaderberg2015spatial]. Previous works for learning depth and ego-motion from unlabeled videos so far follow this grid sampling module to synthesize adjacent views. To synthesize from , the homogeneous coordinates, , of a pixel in the are projected to as follows:
As expressed in the equation, this operation computes by taking the value of the homogeneous coordinates from the inverse rigid projection using and . As a result, the coordinates are not valid if lies on an object that moves between and . Therefore, the inverse warping operation is not suitable for removing the effects of ego-motion in dynamic scenes. Figure 3 describes the point discrepancy while geometric warping with the rigid structure assumption. As shown in Figure 4, the inverse warping distorts the appearance of moving objects.
In order to synthesize the novel view (from to ) properly when there exist moving objects, we propose forward projective geometry as follows:
Unlike inverse projection in Eq. (2), this warping process cannot be sampled by the STN since the projection is in the forward direction (inverse of grid sampling
). In order to make this operation fully differentiable, we first use sparse tensor coding to index the homogeneous coordinates, of a pixel in the . Invalid coordinates (exiting the view where ) of the sparse tensor are masked out. We then convert this sparse tensor to be dense by taking the nearest neighbor value of the source pixel. However, this process has a limitation that there exist irregular holes due to the sparse tensor coding. Since we need to feed those forward projected images into the neural networks in the next step, the size of the holes should be minimized. To fill these holes as much as possible, we pre-upsample the depth map of the reference frame. If the depth map is upsampled by a factor of , the camera intrinsics matrix is also upsampled as follows:
where are focal lengths along the - and -axis. Figure 5 shows the effect of pre-upsampling reference depth while forward warping. With an upsampling factor of during forward projection, the holes in the warped valid masks are filled properly. In the following subsection, we describe the steps of how to synthesize novel views with inverse and forward projection in each instance region.
3.3 Instance-wise View Synthesis and Geometric Consistency
Each step of the instance-wise view synthesis is described in Figure 2. To synthesize a novel view in an instance-wise manner, we first decompose the image region into background and object (potentially moving) regions. With given instance masks , the background mask along frames is generated as
The background mask is element-wise multiplied (, Hadamard product) to the input frames , and then concatenated along the channel axis, which is an input to the Ego-PoseNet. The camera ego-motion is computed as
To learn the object motions, we first apply the forward warping, , to generate ego-motion-eliminated warped images and masks as follows:
where both equations are applied in the backward direction as well by changing the subscripts and . Now we can generate forward-projected instance images as and . For every object instance in the image, Obj-PoseNet predicts the object motion as
where both object motions are composed of six-dimensional SE(3) translation and rotation vectors. We merge all instance regions to synthesize the novel view. In this step, we utilize inverse warping, . First, the background region is reconstructed as
where the gradients are propagated with respect to and . Second, the inverse-warped instance region is represented as
where the gradients are propagated with respect to and . Finally, our instance-wise fully reconstructed novel view is formulated as
Note that the above three equations are applied in either the forward or backward directions by switching the subscripts and .
Instance-wise mini-batch re-arrangement
While training Obj-PoseNet, the number of instance images may change after each iteration. In order to avoid inefficient iterative training, we fix the maximum number of instances per image (sampled in order of instance size) and intermediately re-arrange the mini-batches with respect to the total number of instances in the mini-batch. For example, if the mini-batch has four frames and each frame has -number of instances, then the re-arranged mini-batch size is . The scale of the gradients while training Obj-PoseNet is normalized according to the total number of instances per mini-batch.
Instance mask propagation
Through the process of forward and inverse warping, the instance mask is also propagated to contain the information of instance position and pixel validity. In the case of the instance mask , the forward and inverse warped mask is expressed as follows:
Note that the forward warped mask
has holes due to the sparse tensor coding. To keep the binary format and avoid interpolation near the holes while inverse warping, we round up the fractional values after each warping operation. The final valid instance mask is expressed as follows:
Instance-wise geometric consistency
We impose the geometric consistency loss for each region of an instance. Following the work by Bian et al. [bian2019unsupervised], we constrain the geometric consistency during inverse warping. With the predicted depth map and warped instance mask, can be spatially aligned to the frame by inverse warping, represented as and respectively for background and instance regions. In addition, can be scale-consistently transformed to the frame , represented as and respectively for background and instance regions. Based on this instance-wise operation, we compute the unified depth inconsistency map as:
where each line is applied to either the background or an instance region, and both are applied in either the forward and backward directions by changing the subscripts and . Note that the above depth inconsistency maps are spatially aligned to the frame . Therefore, we can integrate the depth inconsistency maps from the background and instance regions as follows:
In order to handle occluded, view-exiting, and valid instance regions, we leverage Eq. (23) and Eq. (17). We generate a weight mask as and this is multiplied to the valid instance mask . Finally, our weighted valid mask is formulated as:
The reconstruction loss is expressed as follows:
where is the location of each pixel, is the structural similarity index [wang2004image], and is set to 0.8 based on cross-validation. The geometric consistency loss is expressed as follows:
To mitigate spatial fluctuation, we incorporate a smoothness term to regularize the predicted depth map. We apply the edge-aware smoothness loss proposed by Ranjan et al. [ranjan2019collaboration], which is described as:
Note that the above loss functions are imposed for both forward and backward directions by switching the subscripts and .
Since the dataset has low proportion of moving objects, the motions of objects tend to learn to converge to zero. The same issue has been raised in the previous study [casser2019depth]. To supervise the approximate amount of object’s movement, we constrain the motion of the object with a translation prior. We compute this translation prior, , by subtracting the mean estimation of the object’s 3D points in the forward warped frame into that of the target frame’s 3D object points. This represents the mean estimated 3D vector of the object’s motion. The object translation constraint loss is defined as follows:
where and are predicted object translation from Obj-PoseNet and the translation prior on the instance mask.
Although we have designed the instance-wise geometric consistency, there still exists a trivial case of the infinite depth of the moving object, which has the same motion as the camera motion, especially the vehicles in front. To mitigate this issue, we adopt the object height constraint loss proposed by the previous study [casser2019depth], which is described as:
where is the mean estimated depth, and (, ) are learnable height prior and pixel height of the instance. The final loss is a weighted summation of those five losses defined as Eq. (1).
3.4 Auto-annotation of Video Instance Segmentation Dataset
We introduce an auto-annotation scheme to generate a video instance segmentation dataset from the existing KITTI autonomous driving dataset [geiger2012we]. To this end, we adopt an off-the-shelf instance segmentation model, PANet [liu2018path], and an optical flow estimation model, PWC-Net [sun2018pwc]. Figure 6 shows an example case between two consecutive frames. We first compute the instance segmentation for every image frame, and calculate the Intersection over Union (IoU) score table among instances in each frame. The occluded and disoccluded regions are handled by bidirectional flow consensus proposed in UnFlow [meister2017unflow]. If the maximal IoU in the adjacent frame is above a threshold, then the instance is assumed as matched. Our KITTI video instance segmentation dataset (KITTI-VIS) will be publicly available.
We evaluate the performance of our frameworks and compare with previous unsupervised methods on single view depth and visual odometry tasks. We train and test our method on KITTI [geiger2012we] for benchmarking.
4.1 Implementation Details
For DepthNet, we use DispResNet [ranjan2019collaboration] based on ResNet-50 with an encoder-decoder structure. The network can generate multi-scale outputs (six different scales), but the single-scale training converges faster and produces better performance (based on the Abs Rel error metrics). The structures of Ego-PoseNet and Obj-PoseNet are the same, but the weights are not shared. They consist of seven convolutional layers and regress the relative pose as three Euler angles and three translation vectors.
Our system is implemented in PyTorch[paszke2017automatic]. We train our neural networks using the ADAM optimizer [kingma2015adam] with and on Nvidia RTX 2080 GPUs. The training image resolution is set to
and the video data is augmented with random scaling, cropping, and horizontal flipping. We set the mini-batch size to 4 and train the networks over 200 epochs with 1,000 randomly sampled batches in each epoch. The initial learning rate is set toand is decreased by half every 50 epochs. The loss weights are set to , , , , and .
While training, we take three consecutive frames as input to train our joint networks. Our three-frame cyclic training is described in Figure 7. Dynamic scenes are hard to handle with rigid projective geometry in a one-shot manner. We utilize an intermediate frame which enables decomposition of ego-motion-driven global view synthesis and residual view synthesis by object motions. From this, several warping directions can be proposed. The arrows in Figure 7 represent the warping direction of RGB images and depth maps. We tried to optimize Obj-PoseNet by warping to the intermediate views (dashed arrows); however, the network did not converge. One important point here is that we need to feed the supervisory signals generated at the original timestamps , not in the intermediate frames . Although we generate the photometric and geometric supervisions only in the reference or target frames, we utilize the object motions while warping to the intermediate frames. We regularize the object motions by averaging two motions in the same direction (e.g., “intermediate target” and “reference intermediate”, shown as red and green arrows).
4.2 Ablation Study
To validate the effect of our forward projective geometry and instance-wise geometric consistency term, we conduct an ablation study that compares to the baseline method. As shown in Table 1, our forward projection works effectively and leads to convergence of DepthNet. It shows that each proposed module improves the quality of depth maps and the best performance is achieved with all proposed components. We observe that Obj-PoseNet did not converge without forward projection with the instance-wise geometric loss, so the performance of DepthNet was not improved. In other words, optimized Obj-PoseNet helps to boost the performance of DepthNet. DepthNet and Obj-PoseNet complement each other. We note that the significant performance improvement comes from the instance-wise geometric loss incorporated with forward projection.
4.3 Monocular Depth Estimation
Following the test setup proposed for SfM-Learner [zhou2017unsupervised], we train and test our models with the Eigen split [eigen2014depth] of the KITTI dataset. We compare the performance of the proposed method with recent state-of-the-art works [chen2019self, casser2019depth, bian2019unsupervised, ranjan2019collaboration] for unsupervised single-view depth estimation.
We show qualitative results on single-view depth estimation in Figure 8. The compared methods are CC [ranjan2019collaboration] and SC-SfM [bian2019unsupervised]
, which have the same network structure (ResNet-based) for depth map prediction. Ours produces better depth representations on moving objects than the previous methods. As the previous studies do not consider dynamics of objects when finding pixel correspondences, their results of training on object distance could be either farther or closer than the actual distance. This is a traditional limitation for the task of self-supervised learning of depth from monocular videos, however our networks self-disentangle moving and static object regions by our instance-wise losses.
Table 2 shows the results on the KITTI Eigen split test, where the proposed method achieves state-of-the-art performance in the single view depth prediction task with unsupervised training. The advantage is evident of using instance masks and constraining the instance-wise photometric and geometric consistencies. Note that we do not need instance masks in the test phase for DepthNet.
4.4 Visual Odometry Estimation
We evaluate the performance of our Ego-PoseNet on the KITTI visual odometry dataset. Following the evaluation setup of SfM-Learner [zhou2017unsupervised], we use the sequences 00-08 for training, and sequences 09 and 10 for tests. In our case, since the potentially moving object masks are fed together with the image sequences while training Ego-PoseNet, we test the performance of visual odometry under two conditions: with and without instance masks.
Table 3 shows the results on the KITTI visual odometry test. We measure the Absolute Trajectory Error (ATE) and achieve state-of-the-art performance. Although we do not use the instance mask, the result of sequence 10 produces favorable performance. This is because the scene does not have many potentially moving objects, e.g., vehicles and pedestrians, so the result is not affected much by using or not using instance masks.
In this work, we proposed a novel framework that predicts 6-DoF motion of multiple dynamic objects, ego-motion and depth with monocular image sequences. Leveraging video instance segmentation, we design an end-to-end joint training pipeline in an unsupervised manner. There are four main contribution of our work: (1) an auto-annotation scheme for video instance segmentation, (2) differentiable forward image warping, (3) instance-wise view-synthesis and geometric consistency loss, (4) mini-batch re-arrangement. We show that our method outperforms the existing methods that estimates object motion, ego-motion and depth. We also show that each proposed module plays a role in improving the performance of our framework.
In the future, we plan to investigate joint optimization of the instance mask together with the depth and motion. Another future direction is to consider longer input sequences as in bundle adjustment [triggs1999bundle].