Space-Time Correspondence as a Contrastive Random Walk

Allan Jabri, Andrew Owens, Alexei A. Efros

Introduction

There has been a flurry of advances in self-supervised representation learning from still images, yet this has not translated into commensurate advances in learning from video. Video is often treated as a simple extension of an image into time, modeled as a spatio-temporal XYTXYT volume . Yet, treating time as yet another dimension is limiting . One practical issue is the sampling rate mismatch between XX and YY vs. TT. But a more fundamental problem is that a physical point depicted at position (x,y)(x,y) in frame tt might not have any relation to what we find at that same (x,y)(x,y) in frame t+kt+k, as the object or the camera will have moved in arbitrary (albeit smooth) ways. This is why the notion of temporal correspondence — “what went where" — is so fundamental for learning about objects in dynamic scenes, and how they inevitably change.

Recent approaches for self-supervised representation learning, such as those based on pairwise similarity learning , are highly effective when pairs of matching views are assumed to be known, e.g. constructed via data augmentation. Temporal correspondences, however, are latent, leading to a chicken-and-egg problem: we need correspondences to train our model, yet we rely on our model to find these correspondences. An emerging line of work aims to address this problem by bootstrapping an initially random representation to infer which correspondences should be learned in a self-supervised manner e.g. via cycle-consistency of time . While this is a promising direction, current methods rely on complex and greedy tracking that may lead to local optima, especially when applied recurrently in time.

In this paper, we learn to associate features across space and time by formulating correspondence as pathfinding on a space-time graph. The graph is constructed from a video, where nodes are image patches and only nodes in neighboring frames share an edge. The strength of the edge is determined by similarity under a learned representation, whose aim is to place weight along paths linking visually corresponding patches (see Figure 1). Learning the representation amounts to fitting the transition probabilities of a walker stepping through time along the graph, reminiscent of the classic work of Meila and Shi on learning graph affinities with a local random walk. This learning problem requires supervision — namely, the target that the walker should reach. In lieu of ground truth labels, we use the idea of cycle-consistency , by turning training videos into palindromes, e.g. sequences where the first half is repeated backwards. This provides every walker with a target — returning to its starting point. Under this formulation, we can view each step of the walk as a contrastive learning problem , where the walker’s target provides supervision for entire chains of intermediate comparisons.

The central benefit of the proposed model is efficient consideration and supervision of many paths through the graph by computing the expected outcome of a random walk. This lets us obtain a learning signal from all views (patches) in the video simultaneously, and handling ambiguity in order to learn from harder examples encountered during training. Despite its simplicity, the method learns a representation that is effective for a variety of correspondence tasks. When used as a similarity metric without any adaptation, the representation outperforms state-of-the-art self-supervised methods on video object segmentation, pose keypoint propagation, and semantic part propagation. The model scales and improves in performance as the length of walks used for training increases. We also show several extensions of the model that further improve the quality of object segmentation, including an edge dropout technique that encourages the model to group “common-fate” nodes together, as well as test-time adaptation.

Contrastive Random Walks on Video

where the softmax is row-wise. Note that this describes only the local affinity between the patches of two video frames, qt\mathbf{q}_{t} and qt+1\mathbf{q}_{t+1}. The affinity matrix for the entire graph, which relates all nodes in the video as a Markov chain, is block-sparse and composed of local affinity matrices.

Given the spatio-temporal connectivity of the graph, a step of a random walker on this graph can be viewed as performing tracking by contrasting similarity of neighboring nodes (using encoder ϕ\phi). Let XtX_{t} be the state of the walker at time tt, with transition probabilities Att+1(i,j)=P(Xt+1=j∣Xt=i)A_{t}^{t+1}(i,j)=P(X_{t+1}=j|X_{t}=i), where P(Xt=i)P(X_{t}=i) is the probability of being at node ii at time tt. With this view, we can formulate long-range correspondence as walking multiple steps along the graph (Figure 3):

Our aim is to train the embedding to encourage the random walker to follow paths of corresponding patches as it steps through time. While ultimately we will train without labels, for motivation suppose that we did have ground-truth correspondence between nodes in two frames of a video, tt and t+kt+k (Figure 3a). We can use these labels to fit the embedding by maximizing the likelihood that a walker beginning at a query node at tt ends at the target node at time t+kt+k:

where LCE\mathcal{L}_{CE} is cross entropy loss and Ytt+kY_{t}^{t+k} are correspondence labels for matching time tt to t+kt+k. Given the way transition probabilities are computed, the walk can be viewed as a chain of contrastive learning problems. Providing supervision at every step amounts to maximizing similarity between query and target nodes adjacent in time, while minimizing similarity to all other neighbors.

The more interesting case is supervision of longer-range correspondence, i.e. k>1k>1. In this case, the labels of tt and t+kt+k provide implicit supervision for intermediate frames t+1,...,t+k−1t+1,...,t+k-1, assuming that latent correspondences exist to link tt and t+kt+k. Recall that in computing P(Xt+k∣Xt)P(X_{t+k}|X_{t}), we marginalize over all intermediate paths that link nodes in tt and t+kt+k. By minimizing Lsup\mathcal{L}_{sup}, we shift affinity to paths that link the query and target. In easier cases (e.g. smooth videos), the paths that the walker takes from each node will not overlap, and these paths will simply be reinforced. In more ambiguous cases – e.g. deformation, multi-modality, or one-to-many matches – transition probability may be split across latent correspondences, such that we consider distribution over paths with higher entropy. The embedding should capture similarity between nodes in a manner that hedges probability over paths to overcome ambiguity, while avoiding transitions to nodes that lead the walker astray.

1 Self-Supervision

How to obtain query-target pairs that are known to correspond, without human supervision? We can consider training on graphs in which correspondence between the first and last frames are known, by construction. One such class of sequences are palindromes, i.e. sequences that are identical when reversed, for which targets are known since the first and last frames are identical. Given a sequence of frames (It,...,It+k)(I_{t},...,I_{t+k}), we form training examples by simply concatenating the sequence with a temporally reversed version of itself: (It,...It+k,...It)(I_{t},...I_{t+k},...I_{t}). Treating each query node’s position as its own target (Figure 3b), we obtain the following cycle-consistency objective:

By leveraging structure in the graph, we can generate supervision for chains of contrastive learning problems that can be made arbitrarily long. As the model computes a soft attention distribution at every time step, we can backpropagate error across – and thus learn from – the many alternate paths of similarity that link query and target nodes.

This task becomes more challenging with multiple hops, as avoiding spurious features that lead to undesirable diffusion of similarity across the graph becomes more important. While there are other ways of learning to align sets of features – e.g. by assuming soft bijection – it is unclear how they should extend to the multi-hop setting, where such heuristics may not always be desirable at each intermediate step. The proposed objective avoids the need to explicitly infer intermediate latent views, instead imposing a sequence-level constraint based on long-range correspondence known by construction.

2 Edge Dropout

Edge dropout affects the task by randomly obstructing paths, thus encouraging hedging of mass to paths correlated with the ideal path – i.e. paths of common fate – similar to the effect in spectral-based segmentation . In practice, we apply edge dropout before normalizing affinities, by setting values to a negative constant. We will see in Section 3.2 that edge dropout improves object-centric correspondence.

3 Implementation

We now describe how we construct the graph and parameterize the node embedding ϕ\phi. Algorithm 1 provides complete pseudocode for the method.

At training time, we follow , where patches of size 64×6464\times 64 are sampled on a 7×77\times 7 grid from a 256×256256\times 256 image (i.e. 49 nodes per frame). Patches are spatially jittered to prevent matching based on borders. At test time, we found that we could reuse the convolutional feature map between patches instead of processing the patches independently , making the features computable with only a single feed-forward pass of our network.Using a single convolutional feature map for training was susceptible to shortcut solutions; see Appendix C.

We create an embedding for each image patch using a convolutional network, namely ResNet-18 . We apply a linear projection and l2l_{2} normalization after average pooling, obtaining a 128-dimensional vector. We reduce the stride of last two residual blocks (res3 and res4) to be 1. Please see Appendix G for details.

During training, we consider paths of multiple lengths. For a sequence of length TT, we optimize all sub-cycles: Ltrain=∑i=1TLcyci\mathcal{L}_{train}=\sum_{i=1}^{T}\mathcal{L}^{i}_{cyc}. This loss encourages the sequence of nodes visited in the walk to be a palindrome, i.e. on a walk of length NN, the node visited at step tt should be the same node as N−tN-t. It induces a curriculum, as short walks are easier to learn than long ones. This can be computed efficiently, since the losses share affinity matrices.

We train ϕ\phi using the (unlabeled) videos from Kinetics400 , with Algorithm 1. We used the Adam optimizer for two million updates with a learning rate of 1×10−41\times 10^{-4}. We use a temperature of τ=0.07\tau=0.07 in Equation 1, following and resize frames to 256×256256\times 256 (before extracting nodes, as above). Except when indicated otherwise, we report results with edge dropout rate 0.1 and a videos of length 1010. Please find more details in Appendix E.

Experiments

We evaluate the learned representation on video label propagation tasks involving objects, keypoints, and semantic parts, by using it as a similarity metric. We also study the effects of edge dropout, training sequence length, and self-supervised adaptation at test-time. In addition to comparison with the state-of-the-art, we consider a baseline of label propagation with strong pre-trained features. Please find additional details, comparisons, ablations, and qualitative results in the Appendices.

We transfer the trained representation to label propagation tasks involving objects, semantic parts, and human pose. To isolate the effect of the representation, we use a simple inference algorithm based on kk-nearest neighbors. Qualitative results are shown in Figure 4.

All evaluation tasks considered are cast as video label propagation, where the task is to predict labels for each pixel in target frames of a video given only ground-truth for the first frame (i.e. the source). We use the representation as a similarity function for prediction by kk-nearest neighbors, which is natural under our model and follows prior work for fair comparison .

To provide temporal context, as done in prior work , we use a queue of the last mm frames. We also restrict the set of source nodes considered to a spatial neighborhood of the query node for efficiency (i.e. local attention). The source set includes nodes of the first labeled frame, as well as the nodes in previous mm frames, whose predicted labels are used for auto-regressive propagation. The softmax computed for KtsK_{t}^{s} is applied over all source nodes. See Appendix F for further discussion and hyper-parameters.

All baselines use ResNet-18 as the backbone, modified to increase spatial resolution of the feature map by reducing the stride of the last two residual blocks to be 1. For consistency across methods, we use the output of the penultimate residual block as node embeddings at test-time.

Pre-trained visual features: We evaluate pretrained features from strong image- and video-based representation learning methods. For a strongly supervised approach, we consider a model trained for classification on ImageNet . We also consider a strong self-supervised method, MoCo . Finally, we compare with a video-based contrastive learning method, VINCE , which extends MoCo to videos (Kinetics) with views from data augmentation and neighbors in time.

Task-specific approaches: Wang et al. uses cycle-consistency to train a spatial transformer network as a deterministic patch tracker. We also consider methods based on the Colorization approach of Vondrick et al. , including high-resolution methods: CorrFlow and MAST . CorrFlow combines cycle consistency with colorization. MAST uses a deterministic region localizer and memory bank for high-resolution colorization, and performs multi-stage training on . Notably, both use feature maps that are significantly higher resolution than other approaches (2×2\times) by removing max pooling from the network. Finally, UVC jointly optimizes losses for colorization, grouping, pixel-wise cycle-consistency, and patch tracking with a deterministic patch localizer.

1.1 Video Object Segmentation

We evaluate our model on DAVIS 2017 , a popular benchmark for video object segmentation, for the task of semi-supervised multi-object (i.e. 2-4) segmentation. Following common practice, we evaluate on 480p resolution images. We apply our label propagation algorithm for all comparisons, except CorrFlow and MAST , which require 4×\times more GPU memory. We report mean (m) and recall (r) of standard boundary alignment (F\mathcal{F}) and region similarity (J\mathcal{J}) metrics, detailed in .

As shown in Table 3.1.1, our approach outperforms other self-supervised methods, without relying on machinery such as localization modules or multi-stage training. We also outperform despite being more simple at train and test time, and using a lower-resolution feature map. We found that when combined with a properly tuned label propagation algorithm, the more generic pretrained feature baselines fare better than more specialized temporal correspondence approaches. Our approach outperformed approaches such as MoCo and VINCE , suggesting that it may not always be optimal to choose views for contrastive learning by random crop data augmentation of frames. Finally, our model compares favorably to many supervised approaches with architectures designed for dense tracking (see Appendix B).

We consider pose tracking on the JHMDB benchmark, which involves tracking 15 keypoints. We follow the evaluation protocol of , using 320×320320\times 320px images. As seen in Table 3.1.2, our model outperforms existing self-supervised approaches, including video colorization models that directly optimize for fine-grained matching with pixel-level objectives . We attribute this success to the fact that our model sees sufficiently hard negative samples drawn from the same image at training time to learn features that discriminate beyond color. Note that our inference procedure is naive in that we propagate keypoints independently, without leveraging relational structure between them.

We consider the semantic part segmentation task of the Video Instance Parsing (VIP) benchmark , which involves propagating labels of 20 parts — such as arm, leg, hair, shirt, hand — requiring more precise correspondence than DAVIS. The sequences are longer and sampled at a lower frame rate. We follow the evaluation protocol of , using 560×560560\times 560px images and m=1m=1. The model outperforms existing self-supervised methods, and when using more temporal context (i.e. m=4m=4), outperforms the baseline supervised approach of .

2 Variations of the Model

We test the hypothesis (Figure 5b) that edge dropout should improve performance on the object segmentation task, by training our model with different edge dropout rates: {0, 0.05, 0.1, 0.2, 0.3, 0.4}. Moderate edge dropout yields a significant improvement on the DAVIS benchmark. Edge dropout simulates partial occlusion, forcing the network to consider reliable context.

We also asked how important it is for the model to see longer sequences during training, by using clips of length 2, 4, 6, or 10 (resulting in paths of length 4, 8, 12, or 20). Longer sequences yield harder tasks due to compounding error. We find that longer training sequences accelerated convergence as well as improved performance on the DAVIS task (Figure 5c). This is in contrast to prior work ; we attribute this success to considering multiple paths at training time via soft-attention, which allows for learning from longer sequences, despite ambiguity.

We found that the model’s downstream performance on DAVIS improves as more data is seen during self-supervised training (Figure 5a). Compared to Wang et al , there is less indication of saturation of performance on the downstream task.

3 Self-supervised Adaptation at Test-time

A key benefit of not relying on labeled data is that training need not be limited to the training phase, but can continue during deployment . Our approach is especially suited for such adaptation, given the non-parametric inference procedure. We ask whether the model can be improved for object correspondence by fine-tuning the representation at test time on a novel video. Given an input video, we can perform a small number of iterations of gradient descent on the self-supervised loss (Algorithm 1) prior to label propagation. We argue it is most natural to consider an online setting, where the video is ingested as a stream and fine-tuning is performed continuously on the sliding window of kk frames around the current frame. Note that only the raw, unlabeled video is used for this adaptation; we do not use the provided label mask. As seen in Table 3.1.1, test-time training improves object propagation. Interestingly, we see most improvement in the recall of the region similarity metric Jrecall\mathcal{J}_{recall} (which measures how often more than 50% of the object is segmented). More experiment details can be found in Appendix E.

Related Work

Many early methods represented video as a spatio-temporal XYTXYT volume, where patterns, such as lines or statistics of spatio-temporal gradients, were computed for tasks like gait tracking and action recognition . Because the camera was usually static, this provided an implicit temporal correspondence via (x,y)(x,y) coordinates. For more complex videos, optical flow was used to obtain short-range explicit correspondences between patches of neighboring frames. However, optical flow proved too noisy to provide long-range composite correspondences across many frames. Object tracking was meant to offer robust long-range correspondences for a given tracked object. But after many years of effort (see for overview), that goal was largely abandoned as too difficult, giving rise to “tracking as repeated detection” paradigm , where trained object detectors are applied to each frame independently. In the case of multiple objects, the process of “data association” resolves detections into coherent object tracks. Data association is often cast as an optimization problem for finding paths through video that fulfill certain constraints, e.g. appearance, position overlap, etc. Approaches include dynamic programming, particle filtering, various graph-based combinatorial optimization, and more recently, graph neural networks . Our work can be seen as contrastive data association via soft-attention, as a means for learning representations directly from pixels.

Representing inputs as graphs has led to unified deep learning architectures. Graph neural networks – versatile and effective across domains – can be seen as learned message passing algorithms that iteratively update node representations, where propagation of information is dynamic, contingent on local and global relations, and often implemented as soft-attention. Iterative routing of information encodes structure of the graph for downstream tasks. Our work uses cross-attention between nodes of adjacent frames to learn to propagate node identity through a graph, where the task – in essence, instance discrimination across space and time – is designed to induce representation learning.

Graphs have been widely used in image and video segmentation as a data structure. Given a video, a graph is formed by connecting pixels in spatio-temporal neighborhoods, followed by spectral clustering or MRF/GraphCuts . Most relevant is the work of Meila and Shi , which poses Normalized Cuts as a Markov random walk, describing an algorithm for learning an affinity function for segmentation by fitting the transition probabilities to be uniform within segments and zero otherwise. More recently, there has been renewed interest in the problem of unsupervised grouping . Many of these approaches can be viewed as end-to-end neural architectures for graph partitioning, where entities are partitions of images or video inferred by learned clustering algorithms or latent variable models implemented with neural networks. While these approaches explicitly group without supervision, they have mainly considered simpler data. Our work similarly aims to model groups in dynamic scenes, but does so implicitly so as to scale to real, large-scale video data. Incorporating more explicit entity estimation is an exciting direction.

Graph representation learning approaches solve for distributed representations of nodes and vertices given connectivity in the graph . Most relevant are similarity learning approaches, which define neighborhoods of positives with fixed (i.e. kk-hop neighborhood) or stochastic (i.e. random walk) heuristics , while sampling negatives at random. Many of these approaches can thus be viewed as fitting shallow graph neural networks with tasks reminiscent of Mikolov et al. . Backstrom et al. learns to predict links by supervising a random walk on social network data. While the above consider learning representations given a single graph, others have explored learning node embeddings given multiple graphs. A key challenge is inferring correspondence between graphs, which has been approached in prior work with efficient optimal transport algorithms . We use graph matching as a means for representation learning, using cycle-consistency to supervise a chain of matches, without inferring correspondence between intermediate pairs of graphs. In a similar vein, cycle-consistency has also been shown to be a useful constraint for solving large-scale optimal transport problems .

Most work in self-supervised representation learning can be interpreted as data imputation: given an example, the task is to predict a part — or view — of its data given another view . Earlier work leveraged unlabeled visual datasets by constructing pretext prediction tasks . For video, temporal information makes for natural pretext tasks, including future prediction , arrow of time , motion estimation or audio . The use of off-the-shelf tools to provide supervisory signal for learning visual similarity has also been explored . Recent progress in self-supervised learning has focused on improving techniques for large-scale deep similarity learning, e.g. by combining the cross-entropy objective with negative sampling . Sets of corresponding views are constructed by composing combinations of augmentations of the same instance , with domain knowledge being crucial for picking the right data augmentations. Strong image-level visual representations can be learned by heuristically choosing views that are close in space , in time or both , even when relying on noisy negative samples. However, forcing random crops to be similar is not always desirable because they may not be in correspondence. In contrast, we implicitly determine which views to bring closer – a sort of automatic view selection.

Our approach builds on recent work that uses cycle-consistency in time as supervisory signal for learning visual representations from video . The key idea in is to use self-supervised tracking as a pretext task: given a patch, first track forward in time, then backward, with the aim of ending up where it started, forming a cycle. These methods rely on trackers with hard attention, which limits them to sampling, and learning from, one path at a time. In contrast, our approach computes soft-attention at every time step, considering many paths to obtain a dense learning signal and overcome ambiguity. Li et al. combines patch tracking with other losses including color label propagation , grouping, and cycle-consistency via an orthogonality constraint , considering pairs of frames at a time. Lai et al. refine architectural and training design decisions that yield impressive results on video object segmentation and tracking tasks. While colorization is a useful cue, the underlying assumption that corresponding pixels have the same color is often violated, e.g. due to lighting or deformation. In contrast, our loss is discriminative and permits association between regions that may have significant differences in their appearance.

Discussion

While data augmentation can be tuned to induce representation learning tasks involving invariance to color and local context, changes in other important factors of variation – such as physical transformations – are much harder to simulate. We presented a self-supervised approach for learning representations for space-time correspondence from unlabeled video data, based on learning to walk on a space-time graph. Under our formulation, a simple path-level constraint provides implicit supervision for a chain of contrastive learning problems. Our learning objective aims to leverage the natural data augmentation of dynamic scenes, i.e. how objects change and interact over time, and can be combined with other learning objectives. Moreover, it builds a connection between self-supervised representation learning and unsupervised grouping . As such, we hope this work is a step toward learning to discover and describe the structure and dynamics of natural scenes from large-scale unlabeled video.

Broader Impact

Research presented in the paper has a potential to positively contribute to a number of practical applications where establishing temporal correspondence in video is critical, among them pedestrian safely in automotive settings, patient monitoring in hospitals and elderly care homes, video-based animal monitoring and 3D reconstruction, etc. However, there is also a potential for the technology to be used for nefarious purposes, mainly in the area of unauthorized surveillance, especially by autocratic regimes. As partial mitigation, we commit to not entering into any contracts involving this technology with any government or quasi-governmental agencies of countries with an EIU Democracy Index score of 4.04.0 or below (“authoritarian regimes"), or authorizing them to use our software.

We thank Amir Zamir, Ashish Kumar, Yu Sun, Tim Brooks, Bill Peebles, Dave Epstein, Armand Joulin, and Jitendra Malik for helpful feedback and support. We are also grateful to the wonderful members of VGG for hosting us during a dreamy semester at Oxford. This work would not have been possible without the hospitality of Port Meadow and the swimming pool on Iffley Road. Research was supported, in part, by NSF grant IIS-1633310, the DARPA MCS program, and NSF IIS-1522904. We are grateful for compute resources donated by NVIDIA. AJ is supported by the PD Soros Fellowship.

References

Appendix A Label Noise: Effect of Identical Patches

Here, we show that false negatives that are identical to the positive – for example, patches of the sky – do not change the sign of gradient associated with the positive. Let qq be the query, uu be the positive, VV be the set of negatives. W.l.o.g, let the softmax temperature τ=1\tau=1. The loss and corresponding gradient can be expressed as follows, where ZZ is the partition function: L(q, u, V) = u^⊤q - log[ expu^⊤q + ∑_v ∈V expv^⊤q ] = u^⊤q - logZ ∇_q L(q, u, V)= u - expu⊤qZu - ∑_v∈V expv⊤qZv = (1 - expu⊤qZ)u - ∑_v∈V expv⊤qZv Let V−V^{-} be the set of false negatives, such that V−⊆VV^{-}\subseteq V and V+=V∖V−V^{+}=V\setminus V^{-}. Consider the worst case, whereby v−=u,∀v−∈V−v_{-}=u,\forall v_{-}\in V^{-}, so that false negatives are exactly identical to the positive:

We see that the contribution of the negatives that are identical to the positive do not flip the sign of the positive gradient, i.e. λu≥0\lambda_{u}\geq 0, so that in the worse case the gradient vanishes:

The proposed method outperforms many supervised methods for video object segmentation, despite relying on a simple label propagation algorithm, not being trained for object segmentation, and not training on the DAVIS dataset. We also show comparisons to pretrained feature baselines with larger networks.

We follow the simplest approach for extracting nodes from an image without supervision, which is to simply sample patches in a convolutional manner. The most efficient way of doing this would be to only encode the image once, and pool the features to obtain region-level features .

We began with that idea and found that the network could cheat to solve this dense correspondence task even across long sequences, by learning a shortcut. It is well-known that convolutional networks can learn to rely on boundary artifacts to encode position information, which is useful for the dense correspondence task. To control for this, we considered: 1) removing padding altogether; 2) reducing the receptive field of the network to the extent that entries in the center crop of the spatial feature map do not see the boundary; we then cropped the feature map to only see this region; 3) randomly blurring frames in each video to combat space-time compression artifacts; and 4) using random videos made of noise. Surprisingly, the network was able to learn a shortcut in each case. In the case of random videos, the shortcut solution was not nearly as successful, but we still found it surprising that the self-supervised loss could be optimized at all.

We ablate the effect of frame-rate (i.e. frames per second) used to generate sequences for training, on downstream object segmentation performance. The case of infinite frame-rate corresponds to the setting where the same image is used in each time step; this experiment is meant to disentangle the effect of data augmentation (spatial jittering of patches) from the natural “data augmentation" observed in video. We observe that spatio-temporal transformations is beneficial for learning of representations that transfer better for object segmentation.

Appendix E Hyper-parameters

We list the key hyper-parameters and ranges considered at training time. Due to computational constraints, we did not tune the patch extraction strategy, nor several other hyper-parameters. The hyper-parameters varied, namely edge dropout and video length, were ablated in Section 3 (shown in bold). Note that the effective training path length is twice that of the video sequence length.

We tuned test hyper-parameters with the ImageNet baseline. In general, we found performance to increase given more context. Here, we show hyper-parameters used in reported experiments; we largely follow prior work, but for the case of DAVIS, we used 20 frames of context.

We found that the performance of baselines can be improved by carefully implementing label propagation by kk-nearest neighbors. When compared to baseline results reported in and , the differences are:

Restricting the set of source nodes (context) considered for each target node, on the basis of spatial locality, i.e. local attention. This leads to a gain of +4%+4\% J&F for the ImageNet baseline.

Many of the task-specific approaches for temporal correspondence incorporate restricted attention, and we found this rudimentary form to be effective and reasonable.

Computing attention over all source nodes at once and selecting the top-kk, instead of independently selecting the top-kk from each frame. This leads to a gain of +3%+3\% J&F for the ImageNet baseline.

This is more natural than computing nearest neighbors in each frame individually, and can be done efficiently if combined with local attention. Note that the softmax over context can be performed after nearest neighbors retrieval, for further efficiency.

We study the effect of hyper-parameters of the label propagation algorithm, when applied with strong baselines and our method. The key hyper-parameters are the length of context mm, the number of neighbors kk, and the search radius rr. In the figures above, we see the benefit of adding context (see left, with k=10,r=12k=10,r=12), effect of considering more neighbors (middle, with r=12r=12), and effect of radius (right, with m=20m=20).

Appendix G Encoder Architecture

We use the ResNet-18 network architecture, modified to increase the resolution of the output convolutional feature map. Specifically, we modify the stride of convolutions in the last two residual blocks from 2 to 1. This increases the resolution by a factor of four, so that the downsampling factor is 1/81/8. Please refer to Table 4 for a detailed description.

For evaluation, when applying our label propagation algorithm, we report results using the output of res3 as node embeddings, for fair comparison to pretrained feature baselines ImageNet, MoCo, and VINCE, which were trained with stride 2 in res3 and res4. We also found that res3 features compared favorably to res4 features.

We adopt the same hyper-parameters for optimization as in training: we use the Adam optimizer with learning rate 0.0001. Given an input video II, we fine-tune the model parameters by applying Algorithm 1 with input frames {It−m,...,It,...,It+m}\{I_{t-m},...,I_{t},...,I_{t+m}\}, prior to propagating labels to ItI_{t}. For efficiency, we only finetune the model every 5 timesteps, applying Adam for 100100 updates. In practice, we use m=10m=10, which we did not tune.