U NSUPERVISED O BJECT L EARNING VIA C OMMON F ATE
Anonymous authors
Paper under double-blind review
A BSTRACT
Learning generative object models from unlabelled videos is a long standing problem and required for causal scene modeling.
We decompose this problem into three easier subtasks, and provide candidate solutions for each of them.
Inspired by the Common Fate Principle of Gestalt Psychology, we ﬁrst extract (noisy) masks of moving objects via unsupervised motion segmentation.
Second, generative models are trained on the masks of the background and the moving objects, respectively.
Third, background and foreground models are combined in a conditional “dead leaves” scene model to sample novel scene conﬁgurations where occlusions and depth layering arise naturally.
To evaluate the individual stages, we introduce the F ISHBOWL dataset positioned between complex real-world scenes and common object-centric benchmarks of simplistic objects.
We show that our approach allows learning generative models that generalize beyond the occlusions present in the input videos, and represent scenes in a modular fashion that allows sampling plausible scenes outside the training distribution by permitting, for instance, object numbers or densities not observed in the training set.
I NTRODUCTION
Machine learning excels if sufﬁcient training data is available that is representative of the task at hand.
In recent years, this i.i.d.
data paradigm has been shown not only to apply for pattern recognition problems, but also for generative modeling (Goodfellow et al., 2014).
In practice, the amount of data required to reach a given level of performance will depend on the dimensionality of the data.
The generation of high-dimensional images thus either requires huge amounts of data (Karras et al., 2020) or clever methods that exploit prior information, for instance on multi-scale structure or compositionality (Razavi et al., 2019).
Imagine we would like to automatically generate realistic images of yearbook group photos.
A “brute force” approach would be to collect a massive dataset and train a large GAN (Goodfellow et al., 2014), hoping that the model will not only learn typical backgrounds, but also the shape of individual humans (or human faces), and arrange them into a group.
A more modular approach, in contrast, would be to learn object models (e.g., for faces, or humans), and learn in which positions and arrangements they appear, as well as typical backgrounds.
This approach would be more dataefﬁcient: each training image would contain multiple humans, and we would thus effectively have more data for the object learning task.
In addition, the sub-task would be lower-dimensional than the original task.
Finally, if we leave the i.i.d.
setting (by, say, having a second task with different group sizes), the modular approach would lend itself more readily to knowledge transfer.
Object-centric approaches aim to capture this compositionality and have been considerably improved over the past few years (e.g., Locatello et al. 2020; Engelcke et al. 2021).
However, these models tend to be difﬁcult to train and do not yet scale well to visually more complex scenes.
In addition, the commonly employed end-to-end learning approaches make it difﬁcult to dissect the causes of these difﬁculties and what principles may be crucial to facilitate unsupervised object learning.
In human vision, the Principle of Common Fate of Gestalt Psychology (Wertheimer, 2012) has been shown to play an important role for object learning (Spelke, 1990).
It posits that elements that are moving together tend to be perceived as one—a perceptual bias that may have evolved to be able to recognize camouﬂaged predators (Troscianko et al., 2009).
In our work, we show that this principle can be successfully used also for machine vision by using it in a multi-stage object learning approach (Fig. 1):
First, we use unsupervised motion segmentation to obtain a candidate segmentation of a video frame.
Second, we train generative object and background models on this segmentation.
While the regions obtained by the motion segmentation are caused by objects moving in 3D, only visible parts can be segmented.
To learn the actual objects (i.e., the causes), a crucial task for the object model is learning to generalize beyond the occlusions present in its input data.
To measure success, we provide a dataset including object ground truth.
As the last stage, we show that the learned object and background models can be combined into a ﬂexible scene model that allows sampling manipulated novel scenes.
Thus, in contrast to existing object-centric models trained end-to-end, our work aims at decomposing object learning into evaluable subproblems and testing the potential of exploiting object motions for building scalable object-centric models that allow for causally meaningful interventions in generation.
Summing up, the present work makes the following contributions:
• We provide the novel F ISHBOWL dataset, positioned between simplistic toy scenarios and real world data, providing ground truth information for evaluating causal scene models.
• We show that the Common Fate Principle can be succesfully used for object learning by proposing a multi-stage object learning approach based on this principle.
• We demonstrate that the generative object and background models learned in this way can be combined into ﬂexible scene models allowing for controlled out-of-distribution sampling.
The dataset with rendering code and models including training code will be made publicly available.
R ELATED W ORK
Modular scene modeling.
The idea to individually represent objects in a scene is not new.
One approach, motivated by the analysis-by-synthesis paradigm from cognitive science (Bever & Poeppel, 2010), assumes a detailed speciﬁcation of the generative process and infers a scene representation by trying to invert this process (Kulkarni et al., 2015;
Wu et al., 2017; Jampani et al., 2015).
Many methods instead aim to also learn the generative process in an unsupervised way, see Greff et al.
(2020) for a recent survey.
Several models use a recurrent approach to sequentially decompose a given scene into objects (Eslami et al., 2016; Stelzner et al., 2019;
Kosiorek et al., 2018; Gregor et al., 2015; Mnih et al., 2014; Yuan et al., 2019; Engelcke et al., 2020; Weis et al., 2020; von Kügelgen et al., 2020; Burgess et al., 2019), or directly learn a partial ordering (Heess et al., 2011; Le Roux et al., 2011).
This sequential approach has also been extended with spatially-parallel components in (Dittadi & Winther, 2019; Jiang et al., 2019; Lin et al., 2020b;
Chen et al., 2020).
Other methods infer all object representations in parallel (Greff et al., 2017; van Steenkiste et al., 2018), with subsequent iterative reﬁnement (Greff et al., 2019; Veerapaneni et al., 2019; Locatello et al., 2020; Nanbo et al., 2020).
Whereas most of the above models are trained using a reconstruction objective—usually in a variational framework (Kingma & Welling, 2014; Rezende et al., 2014)—several works have also extended GANs (Goodfellow et al., 2014) to generate scenes in a modular way (Yang et al., 2017; Turkoglu et al., 2019; Nguyen-Phuoc et al., 2020; Ehrhardt et al., 2020; Niemeyer & Geiger, 2021).
Those approaches typically use additional supervision such as ground-truth segmentation or additional views, with Ehrhardt et al.
Niemeyer & Geiger (2021) being notable exceptions.
While most methods can decompose a given scene into its constituent objects, only few are fully-generative in the sense that they can generate novel scenes (Lin et al., 2020a;
Ehrhardt et al., 2020; Engelcke et al., 2020; von Kügelgen et al., 2020; Engelcke et al., 2021; Niemeyer & Geiger, 2021; Dittadi & Winther, 2019).
Our approach differs from previous works in the following three key aspects.
First, previous approaches typically train a full scene model in an end-to-end fashion and include architectural biases that lead to the models decomposing scenes into objects.
While elegant in principle, those methods have not be shown to scale to more realistic datasets yet.
Using a multi-stage approach, as in the present work, enables re-use of existing computer vision methods (such as unsupervised motion segmentation) for well-studied sub-tasks and therefore scales more easily to visually complex scenes.
Second, while some existing methods make use of temporal information from videos (Lin et al., 2020a; Crawford & Pineau, 2020; Kosiorek et al., 2018; Weis et al., 2020), they do not explicitely use motion signals to discover (i.e., segment) objects.
Inspired by the development of the human visual system (Spelke, 1990), we instead explicitly include this segmentation cue in our approach.
Third, most existing fully-generative approaches use a spatial mixture model to compose objects into a scene (Ehrhardt et al., 2020; Engelcke et al., 2020; 2021).
While this simpliﬁes training, it clearly does not match the true, underlying scene generation process.
In this work, we instead follow the dead leaves model-approach of von Kügelgen et al.
and scale it to more complex scenes.
Motion Segmentation.
We require an unsupervised motion segmentation method that is able to segment multiple object instances.
For this, we build on a line of work that tracks points with optical ﬂow, and then performs clustering in the space of the resulting point trajectories (Brox &
Malik, 2010; Ochs et al., 2014; Ochs & Brox, 2012; Keuper et al., 2015).
Motion segmentation methods that require supervision (Dave et al., 2019; Xie et al., 2019;
Tokmakov et al., 2017a;b) or only perform binary motion segmentation
(Yang et al., 2021; 2019; Ranjan et al., 2019) are not applicable in our unsupervised setting.
Learning from motion.
In the present work, we propose exploiting motion information to decompose a scene into objects, and to learn generative object and scene models.
Motion information is believed to be an important cue for the development of the human visual system (Spelke, 1990) and has also been used as a training signal for computer vision (Pathak et al., 2017; Dorfman et al., 2013;
Mahendran et al., 2018a;b).
While similar in spirit, these works however do not address learning of generative object and scene models.
T HE F ISHBOWL D ATASET
Several video datasets have been used for object-centric represention learning before (Weis et al., 2020;
Yi et al., 2019; Ehrhardt et al., 2020; Kosiorek et al., 2018).
The ground truth object masks and appearances provided by those datasets, however, only cover the visible parts of the scene.
In order to evaluate the capabilities of the object model to infer and represent the full objects even in the presence of occlusions, we propose the novel F ISHBOWL dataset positioned between complex real world data and simplistic toy datasets.
This dataset consist of 20 , 000 training and 1 ,validation and test videos recorded from a publicly available WebGL demo of an aquarium, 1 each with a resolution of 480 × 320px and 128 frames.
We adapted the rendering to obtain ground truth segmentations of the scene and the ground truth unoccluded background and objects (Fig. 2).
More details regarding the recording setup can be found in the supplement.
A MULTI - STAGE APPROACH FOR UNSUPERVISED SCENE MODELLING
We model an image x as a composition of a background ( m
= 1 , x 0 ) and an ordered list of objects ( m i , x i ) , each represented as a binary mask
m i and appearance x i .
The background and objects are composed into a scene using a simple “dead leaves” model, i.e., the value of each pixel ( u , v ) is determined by the foremost object covering that pixel.
We propose a multi-stage approach (Fig. 1) for learning generative models representing objects, backgrounds and scenes in this fashion.
S TAGE 1: MOTION SEGMENTATION — OBTAINING CANDIDATE OBJECTS FROM VIDEOS
As a ﬁrst step, we use unsupervised motion segmentation to obtain candidate segmentations of the input videos.
We build on the minimum cost multicut method by Keuper et al.
(2015), which tracks a subset of the pixels through the video using optical ﬂow and then, inspired by the Common
Fate Principle mentioned earlier, clusters the trajectories based on pairwise motion afﬁnities.
We use the original implementation of the authors, but replace the postprocessing required to obtain a dense segmentation with a simpler but faster non-parametric watershed algorithm (Beucher &
Meyer, 1993) followed by computing spatiotemporal connected components (Silversmith, 2021).
The quality of the motion segmentation critically depends on the quality on the optical ﬂow estimation, so we explore different models for that step.
ARFlow (Liu et al., 2020) is the current state of the art self-supervised optical ﬂow method that combines a common warping based objective with self-supervision using various augmentations.
We use the published pretrained models as well as a variant trained on the Fishbowl dataset (see supplement for details).
Similar augmentations as used by ARFlow can alternatively be used to synthesize training data for supervised methods, as done for generating the FlyingChairs and FlyingThings datasets (Dosovitskiy et al., 2015; Mayer et al., 2016).
We experiment with FlowNet 2.0 (Ilg et al., 2017) and the more recent RAFT (Teed & Deng, 2020) trained on those two datasets.
To obtain background masks for training the background model, it is not necessary to differentiate between multiple object instances.
We aim for a low rate of foreground pixels being mistaken for background pixels, while background pixels mistaken for foreground are of less concern.
Hence, we use an ensemble of different background-foreground segmentation models from the bgslibrary (Sobral, 2013).
Based on early experiments, we used the PAWKS (St-Charles et al., 2016), LOBSTER (St-Charles & Bilodeau, 2014), Σ − ∆ estimation (Manzanera & Richefeu, 2007) and static frame differences and label every pixel detected as foreground by either of the methods as a foreground pixel.
We found that this rather simple model can faithfully remove the foreground objects in most of the cases.
We provide additional details in the appendix.
S TAGE 2A: OBJECT MODEL — LEARNING TO GENERATE UNOCCLUDED , MASKED OBJECTS
Object extraction.
We use the bounding boxes of the candidate segmentation to extract object crops from the original videos and rescale them to a common size of 128 × 64px.
We ﬁlter out degenerate masks by ignoring all masks with an area smaller than 64 pixels and only considering bounding boxes with a minimum distance of 16px to the frame boundary.
Accordingly, we extract the candidate segmentation masks m 0 ,..., m K for each crop.
For notational convenience, we take mand m 1 to correspond to the background and the object of interest (i.e., that whose bounding box was used to create the crop), respectively, so that m k with k ≥ 2 correspond to the masks of other objects.
Task.
We use the segmented object crops for training a β -VAE-based generative object model (Higgins et al., 2017).
Input to the model is the object crop without the segmentation, output is the reconstructed object appearance including the binary object mask.
We train the model with the standard β -VAE loss with an adapted reconstruction term including both the appearance and the mask.
For an input batch, let c and m 0: K be the ground truth crops with candidate segmentations, and ˆ c and ˆ m the reconstructed object appearances (RGB values for each pixel) and shapes (foreground probabiliy for each each pixel).
The reconstruction loss L R for these objects is then the weighted sum of the pixel-wise MSE for the appearance and the pixel-wise binary cross entropy for the mask:
[Equation]
As the task for the object model is to only represent the central object in each crop, we restrict the appearance loss to the candidate mask of the object ( m 1 ) and the mask loss to the union of the candidates masks of the object and the background ( m 0 + m 1 ).
Importantly, the reconstruction loss is not evaluated for pixels belonging to other objects according to the candidate masks.
Therefore, the object model is not penalized for completing object parts that are occluded by another object.
[Table]
[Figure]
[Table]
[Figure]
[Table] [Table]
Learning object completion via artiﬁcial occlusions.
To encourage the model to correctly complete partial objects, we use artiﬁcial occlusions as an augmentation during training.
Similar to a denoising autoencoder (Vincent et al., 2008), we compute the reconstruction loss using the unaugmented object crop.
We consider two types of artiﬁcial occlusions: ﬁrst, we use a cutout augmentation (DeVries & Taylor, 2017) placing a variable number of grey rectangles on the input image.
As an alternative, we use the candidate segmentation to place another, randomly shifted object from the same input batch onto each crop.
Model.
We use a β -VAE with 128 latent dimensions.
The encoder is a ten layer CNN, the appearance decoder is a corresponding CNN using transposed convolutions (Dumoulin & Visin, 2018) and one additional convolutional decoding layer.
We use a second decoder with the same architecture but only a single output channel do decode the object masks.
During each epoch, we use crops from two random frames from every object.
We train our model for 60 epochs using
Adam (Kingma & Ba, 2015) with a learning rate of 10 − 4 , which we decrease by a factor of 10 after 40 epochs.
We chose the optimal hyperparameters for this architecture using grid searches.
More details regarding the model architecture and the hyperparameters are provided in the supplement.
S TAGE 2B: BACKGROUND MODEL — LEARNING TO GENERATE UNOCCLUDED BACKGROUNDS
Task.
We use an ensemble of background extraction techniques outlined above to estimate background scenes for each frame.
We train a β -VAE on these backgrounds using the appearance loss L
R , appear.
with the inferred background mask, without any additional cutout or object augmentation.
Architecture.
The β -VAE has the same architecture as the object model, but only uses a single decoder for the background appearance.
We do not focus on a detailed reconstruction of background samples and limit the resolution to 96 × 64px.
When sampling scenes, the outputs are upsampled to the original resolution of 480 × 320px using bilinear interpolation.
S TAGE 3: SCENE MODEL — LEARNING TO GENERATE COHERENT SCENES
In the ﬁnal stage, we combine the object and background model into a scene model that allows sampling novel scenes.
As the scene model can reuse the decoders from the previous stages, its main task is to model the parameters deﬁning the scene composition such as object counts, locations and dependencies between the background and the object latents.
Compared to an end-to-end approach, the complexity of the learning problem is greatly reduced in this setting.
It is straightforward to generalize the scene model beyond the training distribution: E.g., it is easy to sample more objects than observed in the input scenes.
We use a scene model following the causal graph depicted in Fig.
3: First, we sample a background latent z bg which describes global properties of the scene such as its composition and illumination; z bg is then decoded by the background model into a background image x 0 .
Conditioned on the background latent, we sequentially sample K tuples ( z app k , z pos k , z scale k ) of latents encoding appearance, position, and scale of object k , respectively; the number of objects K is sampled conditional on z bg as well.
Each appearance latent z app k is decoded by the object model into a masked object
o k
=
( m i , x i ) , which is subsequently re-scaled by z scale k and placed in the scene at position z pos k according to a dead-leaves model (i.e., occluding previously visible pixels at the same location).
Due to the formulation of the model, we are ﬂexible in specifying the conditional and prior distributions needed to generate samples.
A particular simple special case is to sample all latents (indicated as circles in Fig.
independently.
This can be done by informed prior distributions, or by leveraging the training dataset.
In the former case, we sample z bg and all z app k from the standard normal prior of the β -VAE, but reject objects for which the binary entropy of the mask (averaged across all pixels) exceeds a threshold (for ﬁgures in the main paper, 100 bits).
We found that empirically, this entropy threshold can be used to trade diversity of samples for higher-quality samples (cf. supplement).
For the coordinates, a uniform prior within the image yields reasonable samples, and scales can be sampled from a uniform distribution between 64 × 32px and 192 × 96px and at ﬁxed 2 :ratio.
Alternatively, all distributions can be ﬁt based on values obtained from the motion segmentation (object and background latents, distribution of sizes, distribution of coordinates).
We provide a detailed analysis in the supplement.
E XPERIMENTS
Motion Segmentation.
We quantify the quality of the motion segmentation approach to understand which and how many errors are propagated to later stages.
Motion segmentation was scored as follows:
For every frame, we matched the predicted and ground truth masks using the Hungarian algorithm (Kuhn, 1955) with the pairwise IoU (Intersection over Union) as matching cost.
The frame-wise IoU scores were then aggregated as in the DAVIS-2017 benchmark (Pont-Tuset et al., 2017) by ﬁrst averaging IoUs over frames for each ground truth object, and then averaging over objects.
In Tab. 1 we report the segmentation performance separately for the background and the foreground objects.
The best performance is reached when using optical ﬂow predicted by the FlowNet 2 model, thus we’re using this model for all subsequent experiments.
Our setting seems to be especially difﬁcult for the ARFlow model.
Different from the other networks, this model does not easily transfer from unrelated training settings and doesn’t improve much when training on the Fishbowl data directly using the default hyperparameters.
It might however be possible to improve the model by adapting the training setup to our dataset more closely.
Overall, the evaluation reveals two types of errors: (1) even the best model variant only detected 67 .
4% of all objects, i.e., one third of the objects are missed and get included in the background masks.
The recall decreases when increasing the IoU threshold to 0 .
5, i.e., the predicted masks are often not precise.
While the motion segmentation therefore induces a sort of label noise, it has to be considered that not all errors are problematic for the motion segmentation.
In particular, this holds for all objects that have not been detected at all and unsystematic errors.
Object model.
To evaluate the capability of the object model to reconstruct unoccluded objects from occluded inputs, we extract object crops from the validation set using the bounding boxes of the ground truth unoccluded masks.
For those crops, we compare the masks and appearances reconstructed by the model to the unoccluded ground truth (Fig. 2) using IoU and mean average error (MAE), respectively.
As we are only interested in the reconstruction error within the object masks, we evaluate the MAE only on the intersection of the predicted and ground truth mask.
We consider the ground truth unoccluded segmentation masks as our baseline: they correspond to a model that perfectly segments all visible object parts, but does not complete partial objects.
We train variants of the object model using all augmentation strategies described above.
For comparison, we also train each model variant using the ground truth occluded segmentation masks so that errors propagated from the motion segmentation can be differentiated from errors inherent to the object model.
As the results in Tab. 2 show, using another object from the input batch as artiﬁcial occlusions results in the best IoU of 0.827.
When considering only those objects that are occluded at least by 50%, the
IoU drops to 0.705.
This performance is substantially greater than the baseline (0.27), which indicates that the model learns to complete partial objects even for those hard cases.
In terms of the appearance error, using the cutout augmentation performs best.
Interestingly though, for both the mask and appearance error, training without any augmentation at all reduces the performance only slightly.
When training on the ground truth segmentation instead of the motion segmentation, the error in terms of the IoU reduces by roughly one third.
Performance gains can therefore be expected from improving the generative object model and, to a lesser extent, the motion segmentation.
Overall, the object model seems to be quite robust to the label noise induced by the motion segmentation.
We visualize reconstructions and samples from the object model in Fig.
In agreement with the quantitative results before, there is a visible quality difference between the model trained on motion segmentation and ground truth segmentation, respectively.
In some cases, parts of the ﬁsh such as the tail ﬁn is missing and in other cases, the mask covers areas not properly covered by the appearance.
In particular this holds for the hard cases with substantial occlusions.
Moreover, the samples from the model trained on motion segmentation masks seems to contain fewer sharks (a rare class).
The
[Table]
majority of the reconstructions and samples however looks convincing, with the model capturing the relevant properties of the object masks and appearances.
Background model.
We train two variants of the background model using the foreground/background segmentation and the ground truth segmentation masks, respectively.
We show samples from the former variants as part of the scene model in Fig.
5, and provide additional samples in the supplement.
We deliberately chose to not exhaustively tune the background model and defer improvements (which are conceivable given the recent advances in high resolution image modeling with VAEs) to future work.
Within the scope of this work, we limit ourselves to the constrained resolution resulting in blurry samples.
They still reﬂect the main variations in the dataset, like the overall illumination and background color.
Scene model.
In Fig.
5 we visualize samples from the scene model following the scene statistics from the training dataset.
As before, we consider two variants of the scene model using the background and object models trained on the motion segmentation and ground truth segmentation, respectively.
The samples from both models nicely resemble the scenes from the training dataset.
However, in both cases the errors from the object and the background model, as discussed before, are also observable in the generated scenes.
A particular strength of our modular approach is that it allows to separately intervene on causally independent mechanisms (Pearl, 2009; Schölkopf et al., 2021) of the scene generation.
In Fig.
6 we show such interventions on a sample from the unsupervised scene model.
The number of objects, their positions and sizes are all represented explicitly by the scene model so that we can manipulate those scene properties separately.
Moreover, the background and the objects are represented separately by their respective latent codes so that we can exchange and manipulate each of those scene components individually.
Modularity.
A downside of end-to-end models are non-trivial dependencies between individual components, making it harder to train and debug such models.
In contrast, our modular approach allows to exchange individual components in the object learning pipeline.
In Figure 7, we show a proof-of-concept for using a GAN (Mescheder et al., 2018) as part of a hybrid object model (image modeling: GAN, mask modeling: VAE) within our framework.
Comparison to prior work.
In the appendix, we further compare our approach with two recent end-to-end object-centric models (Lin et al., 2020b; Engelcke et al., 2021).
Both models struggle to scale to the F ISHBOWL dataset, highlighting the advantage of our multi-stage approach compared to end-to-end scene models.
Moreover, we apply our method to the RealTrafﬁc dataset of real world videos captured by a trafﬁc camera, showing that our approach transfers well to other datasets.
D ISCUSSION
The ﬁelds of machine learning and causal modeling have recently begun to cross-pollinate.
Causality offers a principled framework to think about classes of distributions related to each other by domain shifts and interventions, and independent/modular components (e.g., objects) that are invariant across such changes.
Vice versa, machine learning has something to offer to causality when it comes to learning causal variables and representations—traditionally, research in causal discovery and inference built on the assumption that those variables be given a priori.
Much like the shift from classic AI towards machine learning included a shift from processing human-deﬁned symbols towards automatically learning features and statistical representations, causal representation learning aims to learn interventional representations from raw data (Schölkopf et al., 2021).
It is in this sense that we like to think of our scene model as a causal generative model, even though it is fairly straightforward from the causal point of view.
We propose a multi-stage approach for learning generative object models from unlabelled videos.
Inspired by the Gestalt Principle of Common Fate , we use candidate segmentations obtained from unsupervised optic ﬂow to weakly supervise generative object and background models, and combine them into a scene model.
The scene model is causal/mechanistic in the sense that it (1) learns complete objects (although occlusions are abundant in the training data) 2 and (2) properly handles partial depth orderings in the scene, the latter through the dead leaves approach—as opposed to the computationally simpler additive mixture approach which is common place in end-to-end scene models, but contradicts the physics of scene generation.
Moreover, while many existing models only decompose and represent scenes, (3) our model can generate plausible novel and out-of-distribution scenes (e.g., higher ﬁsh density, different sizes).
This showcases the challenges faced by end-to-end learning when not endowed with sufﬁcient prior structure and inductive biases.
While learning object models as part of an end-to-end trainable object centric scene model might be more elegant in principle, it has not been shown to scale to more realistic data yet.
We instead chose a multi-stage approach that allows developing and analyzing the modeling stages individually.
This approach allowed us to conclude that exploiting motion information for object discovery, as done in the motion segmentation stage, is a valuable cue that greatly simpliﬁes object learning.
Also, since the scene model uses the component models as modelling “atoms”, this naturally permits intervening on the parameters deﬁning the scene composition without side-effects, as stipulated by the principle of Independent Causal Mechanisms (Parascandolo et al., 2018; Peters et al., 2017).
We evaluated the modelling stages on the novel F ISHBOWL dataset, consisting of short videos recorded from a synthetic 3D aquarium.
Notably, we found that the generative object model proves to be fairly robust to errors in the motion segmentation.
We expect further performance gains to be achievable by improving the visual ﬁdelity of the generative object and background models (Razavi et al., 2019; Vahdat & Kautz, 2020); however, this was not the motivation for the present work.
We see several ways to extend our model in the future, beyond improving the implementations of the individual stages by taking advantage of progress in computer vision.
One limitation of using motion segmentation is that we can only decompose scenes of moving objects.
This could be addressed by integrating object models trained using our approach into an end-to-end scene model, e.g., the work of Eslami et al.
(2016) and its successors.
When using a learning based motion segmentation approach, there could be a feedback circle with both models improving each other as training progresses and this way closing the observed gap to using ground truth segmentations.
Finally, our object model does currently not capture object motions.
Given that the motion segmentation yields temporally consistent segmentation masks, this could, in principle, well be included in our approach.
Ethics statement.
While there is some way to go when it comes to the generation of photorealistic scenes, we note that being able to automatically generate coherent scenes, including the interventional control that our approach pioneers, could be misused to synthesize or modify scenes, reinforcing the need to develop methods that allow to reliably detect manipulated content.
On the other hand, the interpretability that comes with the modularity of our method can yield insights into scene perception, and could therefore facilitate better explanations for model decisions.
Reproducibility statement.
We took several steps to make our work reproducible:
For the dataset generation, we modiﬁed the Aquarium simulation on which our dataset is based, in order to make the rendering fully deterministic.
The conﬁguration ﬁles describing the recording settings for all samples will be published with the generation code along the dataset, which allows re-recording all videos.
Moreover, the code for training our models is deterministic and will be made publicly available.
A A DDITIONAL DETAILS ABOUT THE METHOD A. T RAINING ARF LOW ON F ISHBOWL
We build on the ofﬁcial implementation of ARFlow provided in https://github.com/lliuz/ARFlow.
To train the model on the Fishbowl dataset, we make the following adaptations to the original conﬁguration used for training on Sintel:
• The internal resolution of the model is set to 320x448 pixels.
• For training, we use the ﬁrst 200 videos of the Fishbowl dataset.
This amounts to 25.4K frame pairs which is substantially more than the Sintel dataset (pretraining: 14,570, main training: 1041), which is the largest dataset on which ARFlow was originally trained.
Initial experiments using the ﬁrst 1000 videos did not lead to an improvement in the training objective compared to only using 200 videos.
• We train the model using a batch size of 24 and use 300 random batches per epoch.
We perform both the pretraining and main training stage, but using the same data for both stages.
The pretraining stage is shortened to 100 epochs, after which the training loss did not improve further.
We selected above parameters by pilot experiments using the ﬁnal training loss as criterion.
All other hyperparameters, in particular regarding the losses, the augmentations and the model architecture, are used unchanged.
We remark that the hyperparameters are chosen differently for the two datasets used in the original paper, so we conjecture that the performance on this model most likely improves when closely adapting the training scheme to our setting.
A. O BJECT MODEL
We loosely build on the β -VAE implementation by Subramanian (2020).
We reimplemented the training script and modiﬁed architecture details like the latent dimensionality due to differences in the image size.
We use a CNN with 10 layers as an encoder.
Each layer consists of a 3 × 3 convolution, followed by layer normalization (Ba et al., 2016) and a leaky ReLU nonlinarity with a negative slope of 0 .
The decoders are built symmetrically by using the reversed list of layer parameters and transposed convolutions.
The decoders both use an additional convolutional decoding layer, without normalization and nonlinearity.
The detailed speciﬁcation of the default hyperparameters used by the object model is given in the following table:
[Table]
We chose the parameters regarding the architecture based on early experiments by qualitatively evaluating the sample quality.
The learning rate and mask loss weight γ where determined using grid searches with the IoU of the mask as selection criterion.
However, we noticed a high degree of consistency between the rankings in terms of the mask IoU and appearance MAE.
The best reconstruction quality was obtained when not regularizing the prior (i.e., β = 0).
We chose the ﬁnal value of β = 0 .
0001 as a compromise between reconsutruction and sampling capabilites based on visual inspection of the results.
For the mask and appearance losses deﬁned in the main paper, we use an implementation based on the following PyTorch-like pseudo code:
3latents =
encode(image) mask_pred, img_pred = mask_decoder(latents), img_decoder(latents)
L_img =
(mask_fg * mse(img_pred, image)).sum()
L_mask =
((mask_fg + mask_bg) * bce(mask_pred, mask_fg)).sum()
L_reg = kl_divergence(latents)
Z_img, Z_mask =
mask_fg.sum(), (mask_fg + mask_bg).sum() 11return
L_img / Z_img + gamma * L_mask / Z_mask
+ beta * L_reg
A. B ACKGROUND MODEL
Training details We use a similar β -VAE and training objective for the background model as for the object model.
Different to the object model, we do not predict the mask and instead only reconstruct a non-occluded background sample.
We sweep over learning rates in { 1 · 10 − 3 , 5 · 10 − 4 , 1 · 10 − 4 } and β in { 10 − 2 , 10 − 3 , 10 − 4 , 10 − 3 } and select the model with β = 10 −and learning rate 10 − 4 which obtained lowest reconstruction and prior loss.
A higher value for β caused the training to collapse (low prior loss, but high reconstruction loss).
As noted in the main text, the background model performance (and resolution) can be very likely improved by using larger models, more hyperparameter tuning and better decoders suited to the high resolution.
As noted in the main paper, we omit these optimizations within the scope of this work and rather focus on the object and scene models.
Implementation The background model loss is similar to the reconstruction loss of the foreground model.
We omit reconstructing the mask.
In the input image for the background model, all foreground pixels are replaced by the average background RGB value to avoid distorting the input color distribution, refer to the example images in Fig.
The loss can be implemented as follows:
A. S CENE MODEL
Mask temperature By default, the mask is computed by passing the logits obtained from the object mask decoder through a sigmoid non-linearity for obtaining probabilities.
During scene generation, we added sharpness to the samples by varying the temperature τ , yielding an object mask
[Equation]
where x is the logit output by the mask decoder and the exponential is applied element-wise.
“Cooling” the model to values around τ = 0 .
1 yields sharper masks and better perceived sample quality.
Note that the entropy threshold introduced in the next section depends on the value of τ .
Entropy ﬁltering When sampling objects during scene generation, we ﬁlter the samples according to the model “conﬁdence”.
A simple form of rejection sampling is used by computing the mask for a given object latent, and then computing the entropy of that mask.
Given a mask m ( τ ) , we adapt the sampling process considering the average entropy across all pixels in the mask,
[Equation]
and reject samples where H 2 ( m ) exceeds a threshold.
Reasonable values for a mask temperature of τ = 0 .
1 are around 100 to 200 bits.
It is possible to trade sample quality and sharpness for an increased variability in the samples by increasing the threshold.
B A DDITIONAL DETAILS ABOUT THE DATASET GENERATION
A demo of the original aquarium WebGL demo used for our experiments is available at webglsamples.org/aquarium/aquarium.html.
The original source code is released under a BSD 3-clause license (Google Inc.) and available at github.com/WebGLSamples/WebGLSamples.github.io.
We apply the following modiﬁcations to the original demo for our recording setup:
• We implemented a client-server recording setup: The client pulls recording parameters from the server and sends back the recorded frames with ground truth segmentation to the server.
The server maintains the overall list of randomly sampled aquarium conﬁgurations and post-processes the recordings into their ﬁnal form.
We run this setup in parallel on multiple nodes, using the headless Chrome browser 3 .
• All samples are recorded for 128 frames at 30Hz.
We modiﬁed the aquarium to only advance to the next frame once the current frame is captured and sent to the server.
• For recording the masks, we modiﬁed the texture shaders to use a unique color for rendering every object.
Furthermore, we disabled all rendering steps modifying those colors (anti-aliasing, alpha compositing).
• To make the recording fully deterministic, we disabled the bubbles in the aquarium.
• To increase the diversity of the ﬁsh in the aquarium, we applied random color shifts to all ﬁsh textures except sharks, for which those color shifts look very unnatural.
We shifted each color by rotating each color value in the IQ plane of the YIQ color space.
For each ﬁsh, we independently and uniformly sampled one of 8 discrete color shifts regularly spaced in [ 0° , 360° ] .
• During post-processing, we used ffmpeg 4 to rescale and centrally crop 480 × 320px from every frame and encode all frames as a video.
We cropped and rescaled the masks same way, but exported them as json using the run length encoding provided by the COCO API 5 .
• For recording the unoccluded ground truth, we used above setup to record and post-process frames and masks of the validation and test samples, but only render the respective ﬁsh of
interest.
The code used to generate the dataset including all parameters will be made publicly available.
C A DDITIONAL RESULTS C. O BJECTS EXTRACTED BY THE MOTION SEGMENTATION
The following ﬁgure shows examples of objects extracted from the original videos using motion segmentation and the ground truth occluded masks, respectively.
The ﬁgure reveals typical failure modes, such as multiple ﬁsh that are segmented jointly, and parts of the background contained in the object mask.
Most of the ﬁsh however, are segmented very accurately.
C. O BJECT MODEL : ADDITIONAL RECONSTRUCTIONS
In Fig.
9 we show additional reconstruction from the object model trained on motion segmentation and ground truth occluded masks, respectively.
Moderate occlusion levels up to 30% are handled well by both variants.
At higher noise levels however, only the variant of the object model trained on the ground truth masks is able to correctly complete the partial objects.
[Figure]
The following ﬁgure shows additional samples from the object models trained using another object as artiﬁcial occlusion (the same models as used for Fig.
4 in the main paper).
[Figure]
The background model is trained on images pre-processed by an ensembling of foregroundbackground algorithms from Sobral (2013).
We use Σ − ∆ (Manzanera & Richefeu, 2007), static frame differences, LOBSTER (St-Charles & Bilodeau, 2014) and PAWKS (St-Charles et al., 2016) with standard hyperparameters set in Sobral (2013).
The goal behind this choice is to detect as many objects as possible and remove the amount of erroneously included foreground pixels — it might be possible to even further improve this pre-processing step with different algorithms and hyperparameter tuning.
We give a qualitative impression of the background input samples in Fig.
Note that all foreground pixels were replaced by the average color value obtained by averaging over background pixels to avoid inputting unrealistic colors into the β -VAE.
C. A DDITIONAL SAMPLES FROM THE SCENE MODEL
[Figure]
C ONDITIONAL SAMPLING FROM THE SCENE MODEL
We present conditional samples from the scene model.
As a simple baseline, we use a k-nearest neighbour approach for conditionally sampling object latents based on background latents.
First, we extract a paired dataset of background and foreground latents from the training dataset.
Second, we sample background latents from the standard Normal distribution (prior of the background model).
Third, we compute the 2% nearest neighbouring videos based on the L 2 distance from the background latent.
Fourth, we randomly sample a subset of foreground latents extracted by the motion segmentation.
Finally, we reconstruct the scene using the background latents along with the chosen subset of foreground latents.
We reject foreground latents with an entropy larger than 150 bit.
Samples (non-cherrypicked) are depicted in Fig.
Similarly, we can constrain other latents like the x and y positions to a particular background.
In
Fig.
15 we show examples of constraining object locations based on a reference sample for both the ground truth and motion segmentation object model.
[Figure]
D C OMPARISON TO RELATED METHODS D. GAN B ASELINE
As a baseline method for generating novel scenes for the F ISHBOWL dataset, we consider the GAN used by Mescheder et al.
(2018) for the CelebA-HQ dataset (Karras et al., 2018).
We used the ofﬁcial implementation available at https://github.com/LMescheder/GAN_stability, and only changed the resolution of the generated images to 192 × 128px.
For training, we used every 16th frame from each input video in the training set rescaled to the resolution of the GAN, resulting in 160k training images.
We trained the model for 90 epochs.
Fig.
17 shows samples from the model in comparison to training frames.
Overall, the GAN is able to generate images of convincing quality resembling the training images well.
A particular strength of the GAN in comparison to our method, is it’s ability to generate backgrounds with many details— which we explicitly left for future work.
Several ﬁsh generated by the GAN however look distorted, in agreement with previous works concluding that GANs are good at generating “stuff”, but have difﬁculties generating objects Bau et al.
This becomes especially apparent when visualizing interpolations in the latent space between samples, as done in Fig.
Many differences between the samples generated by the GAN and our method, respectively, stem from the GAN being able to learn the overall statistics of the scenes well, but not learning a notion of objects.
Compared to the GAN baseline, our object-centric approach offers several conceptual advantages: (1) The background and the objects in each scene are represented individually by our method, which makes it straightforward to intervene on the generated samples in a meaningful way (Fig. 6).
While directions in the latent space of the GAN that correspond to semantically meaningful changes in the image might well exist, the GAN framework does not offer a principled way to ﬁnd those directions without supervision.
(2) While the GAN is able to generate novel scenes, it cannot be used to infer the composition of input scenes.
(3) An optimally trained GAN perfectly captures the statistics of the input scene—making it impossible to generate samples beyond the training distribution.
As our model explicitly represents scene parameters such as the number and position of ﬁsh, our model can be used for controlled out-of-distribution sampling (Fig. 6).
D. SPACE (L IN ET AL ., 2020 B )
SPACE (Lin et al., 2020b) is an object-centric representation learning method following the AttendInfer-Repeat (AIR) framework (Eslami et al., 2016; Crawford & Pineau, 2019).
Different from the
AIR model, the detection of objects and inference of their latent representation is fully parallelized to make the approach faster and more scalable.
We trained SPACE on the Fishbowl dataset using the implementation provided by the authors (https://github.com/zhixuan-lin/SPACE).
We used the default hyperparameters and trained two variants using a 4x4 and 8x8 grid of object detectors, respectively.
As for the GAN baseline in appendix D, we used every 16th frame for training this model to keep the training time reasonable (160k frames in total).
Despite the subsampling, this is still substantially more data than the model was trained on in the original paper (60k images).
SPACE expects the input images to have equal width and height, therefore we used a central square crop from every frame.
Training the model on a single Nvidia RTX 2080ti GPU is relatively fast (14h for the 4x4 grid and 18h for the 8x8 grid), conﬁrming the performance advantage of the parallel object detectors.
As the results in the Fig.
19 show, the object reconstructions from the model overall look reasonable.
Most structure in the background is missed by the model, however we conjecture that this might be solvable by adapting the capacity of the background network.
The visualization of the object detections however reveals a more fundamental failure mode due to the grid structure used by the object detector in SPACE:
Larger ﬁsh are split across several cells, even when using only 4x4 cells.
As each cell can only handle at most one object, decreasing the cell count further is not expected to yield sensible results, as this limits the number of objects too much.
Lin et al.
(2020b) mentioned this problem and introduced a boundary loss to address it, however on the Fishbowl dataset this does not resolve the problem.
We hypothesize that an approach based on a ﬁxed grid, while adequate in some cases and having substantial performance advantages, doesn’t work well with objects showing large scale variations as present in our newly proposed dataset.
We believe this is a limitation of
SPACE that cannot be resolved with further model tuning.
We performed an additional experiment that integrates our approach with SPACE:
As a ﬁrst step, we trained a variant of our object model that uses the glimpse encoder and decoder from SPACE.
We increased the learning rate to 0.0005 following an initial grid search, but otherwise left all hyperparameters unchanged.
As the second step, we included the pretrained glimpse encoder and decoder into the SPACE model and trained the full model end-to-end as described above (using a grid size of 4x4). When we continued to train the glimpse encoder and decoder in the end-to-end setting, we noticed similar failures as described above. Therefore we froze the respective weights after the pretraining step. Figure 20 shows results from this model variant.
Early during the training, the model is in many cases able to detect the objects in the input scenes.
This especially holds for larger objects that have been shown to be problematic for the end-to-end model before.
Later during training SPACE however increasingly uses the background model to also explain foreground objects.
Overall those results show that our motion segmentation based approach for object-centric modeling can also be used for scaling existing architectures to more complex settings.
The off-the-shelf
SPACE model however still falls short of our scene model when trained this way.
In the future we see great potential in combining our object learning approach with state-of-the-art object-centric scene models.
D. GENESIS- V 2 (E NGELCKE ET AL ., 2021)
We trained GENESIS-v2 on the Fishbowl dataset using the ofﬁcial implementation by the authors (https://github.com/applied-ai-lab/genesis) with default hyperparameters except for the image resolution, number of object slots and batch size.
We modiﬁed the model code to work for rectangular images and used a resolution of 128x192 pixels.
We trained GENESIS-v2 having 5 object slots on 4 Nvidia RTX 2080Ti GPUs using a batch size of 64.
Initial experiments with 10 object slots lead to the background being split up into multiple slots.
As for the GAN baseline before, we used every 16th frame for training this model (160k frames in total).
In Fig.
21 we show qualitative results from GENESIS-v2 on the Fishbowl dataset.
The reconstructions of the model look somewhat blurry but capture the major structure in the input images well.
Importantly, the visualization of the segmentation map and the individual slots reveal that the model succeeds in learning to decompose the scenes into background and objects.
Sampling objects and scenes however fails with this model conﬁguration.
Most likely this happens due to the GECO objective (Rezende & Viola, 2018), that decreases the weight of the KL term in the loss function as long as the log likelihood of the input sample is below the target value.
Training GENESIS-v2 with the original VAE objective instead of GECO leads to better scene samples, the decomposition of the scene however fails with this objective Fig.
As a comparison to the end-to-end training within GENESIS-v2, we trained a variant of our object model using the architecture of the GENESIS-v2 component decoder.
As encoder, we use a CNN constructed symmetrically to the decoder, using regular convolutions instead of the transposed con- volutions.
We trained the model with the Cutout augmentation and using the same loss and training schedule as for the object model described in the main paper.
The results in Tab. 4 and Fig.
23 show that the model generally performs well, but worse than our original object model.
This can most likely be explained by the larger capacity of our object model (10 vs 5 layers, 128 vs 64 latent dimensions) which seems to be necessary to model the visually more complex objects in our setting.
Also when trained separately, the object model has difﬁculties with sampling novel ﬁsh, which can be addressed at the cost of worse reconstructions 24.
Overall we conclude that our modular object learning approach scales much better to visually more complex scenes than end-to-end training as done by GENESIS-v2.
Even when using the GENESISv2 component decoder within our framework, the necessary trade-off between reconstruction and generation capabilities seems to be more favorable when using our modular approach as opposed to the end-to-end training.
We remark that this comparison comes with a grain of salt: We neither adapted the hyperparameters of GENESIS-v2 nor of our method and the same decoder is used within
GENESIS-v2 for the background, too.
The strong qualitative difference in sample quality however makes it unlikely that this explains all of the difference.
Moreover, our approach only addresses learning generative object models whereas GENESIS-v2 is also capable to infer the decomposition of static input scenes.
For the future, we therefore see much potential in combining the respective strengths of both methods.
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
D. C OMPARISON ON THE R EAL T RAFFIC DATASET
To evaluate how well our method transfers to other settings, we trained our model on the RealTrafﬁc dataset (Ehrhardt et al., 2020).
As the resolution of the images is smaller in the RealTrafﬁc dataset, we reduced the object size threshold to 64px and the minimal distance to the boundary to 8px for the object extraction.
We trained the object model with the same architecture as used for the
Fishbowl dataset.
Due to the smaller dataset size, we trained the model for 600 epochs and reduced the learning rate only after 400 epochs.
As the videos in the dataset were all recorded from the same stationary trafﬁc camera, we did not train a background model but used the mean-ﬁltered background directly.
In contrast to the aquarium dataset, the object positions and sizes are not distributed uniformly for this dataset.
For the scene model, we therefore sample directly from the empirical joint distribution of object positions and sizes (extracted from the object masks obtained by the motion segmentation).
In Fig.
25, we compare samples from our model to other models for which results on the RealTrafﬁc dataset have been reported in (Ehrhardt et al., 2020).
Overall, our model transfers well to this real world setting, given that our model is used largely unchanged.
In comparison to the GAN-based
RELATE and BlockGAN, the samples from our model look slightly more blurry.
However the results from our method clearly improve over the VAE-based GENESIS model.
The adaptation of the scene statistics as described above works well for the object position, as the cars are correctly positioned on the street only.
We consider the possibility of this straight-forward adaptation to novel scene statistics to be a nice advantage of our object-centric modeling approach.
In the future, this could be improved further by, e.g., learning to sample latent variables conditioned on the object positions.