{'fraction_non_alphanumeric': 0.033068001984080116, 'fraction_numerical': 0.01091244065474644, 'mean_word_length': 4.687533584094573, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Less than Few: Self-Shot Video Instance Segmentation

The goal of this paper is to bypass the need for labelled examples in few-shot video understanding at run time. While proven effective, in many practical video settings even labelling a few examples appears unrealistic. This is especially true as the level of details in spatio-temporal video understanding and with it, the complexity of annotations continues to increase. Rather than performing few-shot learning with a human oracle to provide a few densely labelled support videos, we propose to automatically learn to find appropriate support videos given a query. We call this self-shot learning and we outline a simple self-supervised learning method to generate an embedding space well-suited for unsupervised retrieval of relevant samples. To showcase this novel setting, we tackle, for the first time, video instance segmentation in a self-shot (and few-shot) setting, where the goal is to segment instances at the pixel-level across the spatial and temporal domains. We provide strong baseline performances that utilize a novel transformer-based model and show that self-shot learning can even surpass few-shot and can be positively combined for further performance gains. Experiments on new benchmarks show that our approach achieves strong performance, is competitive to oracle support in some settings, scales to large unlabelled video collections, and can be combined in a semi-supervised setting.


Introduction
The goal of this paper is to decrease the reliance on humans to provide labelled examples in few-shot video understanding. While impressive few-shot video classification [39, 11,58], localization [26, 75,73] and detection [25,74] results have been reported, in many practical video settings even labelling a few examples may appear unrealistic. This is especially true as the level of spatio-temporal video understanding and with it, the complexity of annotations continues to increase. Consider for example the problem of video instance segmentation [72,9,67], where datasets for example contain around 1.6K annotated frames for just a single object class. We deem it unlikely that an interacting user, that is looking to segment a "query" video with unknown instances, is willing to provide pixelprecise annotations masks for all objects in a frame for each video in the support set, despite this being a setting which is typical for more classical, image-based few-shot learning scenarios. Thus, rather than relying on a human oracle to provide a few densely labeled support videos, we propose to automatically learn to find appropriate support videos given a query.
For this, we introduce the notion of self-shot learning, in which the need for labelled video clips at test-time is abolished. Instead, one is provided with a large unlabelled pool of videos from which samples potentially relevant to the query video can be retrieved and utilized in a strictly unsupervised fashion. We address this by adapting a simple self-supervised learning method [64] to generate an embedding space well-suited for unsupervised retrieval of relevant samples. To showcase this novel setting, we go beyond just bounding box detection and temporal localization and instead tackle, for the first time, video instance segmentation in a self-shot (and few-shot) setting, where the goal is to segment instances at the pixel-level across the spatial and temporal domains.
Overall, we make three contributions in this paper: 1. We propose the setting of self-shot learning. While annotations are used during training (similar to few-shot), at test-time, new classes are evaluated without any annotations, but with access to an unlabelled dataset. 2. We investigate this new setting for a particularly annotation-heavy scenario, that of video instance segmentation, for which we propose new splits to establish a self-shot (and few-shot) benchmark. 3. Finally, we provide strong baseline performances that utilize a novel transformerbased model and show that self-shot learning can even surpass few-shot and can be positively combined for further performance gains.

Related work
Video few-shot learning. There is limited related work on the few-shot learning setup for videos. Initial works have explored few-shot learning for the task of video classification [39,77]. For example, OSS-Metric Learning [39] measures similarity of pairs of video to enable few-shot video classification. Yang et al . [71] introduce few-shot action localization in time, where a few positive labelled and several negative labelled support videos steer the localization via an end-to-end meta-learning strategy. Xu et al . [70] and Zhang et al . [75] also perform few-shot temporal action localization with the assistance of video-level class annotations. To further free the need for labels, a new research line is emerging, called few-shot common action localization, where the common action in a long untrimmed query video is localized in time [26,73] or both in time and in space [25,74] based on a few support videos containing the same action. Closest to our work is few-shot spatio-temporal action localization by Yang et al . [74], who adopt a transformer-based action detection architecture and extend to localizing actions at pixel level. They propose a mask head upon the action detection boxes to perform the binary classification for the pixels inside each detected box. In this paper, we propose the new task of self-shot video instance segmentation that operates on objects instead of actions, predicts the segmentation directly, removes the need for having predefined (labelled) support videos, and encapsulates the few-shot setting as a special case.
Video zero-shot learning. Various video tasks have been investigated from a zero-shot perspective. Zhang et al . [76] can localize the unseen activities in time in a long untrimmed video based on the label embeddings. Spatio-temporal action localization is also explored in zero-shot setting by linking actions to relevant objects [35, 46,47], or by leveraging trimmed videos used for action classification [36]. Wang et al . [66] achieve zero-shot video object segmentation by proposing a novel attentive graph neural network which can iteratively fuse information over video graphs. Dave et al . [22] can segment the moving objects in videos, even ones unseen in training. Just like the zero-shot setting, we also aim to segment unseen object instances in videos, without any labelled support videos. But we try to leverage self-retrieved (free) support videos to boost the performance.
Note that this use of support samples is fundamentally different to how it has been used in other self-supervised works such as [23] or [57], where they are only used as random subsets to aid contrastive learning. Instead, support samples are the goal of our self-shot method. To this end, we compare the use of noise contrastive methods [69] and the differentiable ranking loss [64] extended to the video domain.
Video instance segmentation (VIS). VIS [72,9] requires classifying, segmenting, and tracking instances over all frames in a given video. With the introduction of the YouTube-VIS dataset, which contains dense pixel-level annotations across consecutive frames [72], considerable progress has been made in tackling this challenging task. State-of-the-art methods typically develop sophisticated pipelines and rely on heavy supervision and complex heuristic rules to associate the instances across frames. As two representative methods, MaskTrack R-CNN [72] extends the Mask R-CNN model [33] with a pair-wise identity branch to solve the instance association problem in VIS, while MaskProp [9] introduces a multi-stage framework [16] for propagating instance masks in time. In contrast, VisTR [67] builds a DETR-based pipeline [12] for the VIS task in a query-based end-to-end fashion, which can supervise and segment the instances across frames as sequences.
In this paper we adopt the spirit of VisTR to treat instance segmentation in a query video as a sequence prediction problem. Different from the usual VIS task, our self-support video instance segmentation task focuses on recognizing, segmenting, and tracking the instances in a query video containing novel classesfrom just a few retrieved support videos and without knowing any annotations.

Task definition
Our goal is video instance segmentation in a query video without having access to any labelled training examples with the same instances as in the query. Instead, we consider a self-shot scenario where we have an unlabelled pool of videos that we can use to help guide the instance segmentation. To that end, we denote a set of seen classes as S and a disjoint set of unseen classes as U, where S ∩ U = ∅. Let D S = {(x, y)|x ∈ X , y ∈ Y S } represent the set of labelled training data on seen classes, where x is the pixel-wise feature embeddings from the visual space X , y is the corresponding pixel-wise label in the label space Y S of seen classes. D U denotes the set of unlabelled videos on unseen classes. Our self-shot learning shares with few-shot and zero-shot learning the same goal to learn a model from D S and predict the label of each pixel for videos in D U . However, they differ in their objective and expected data availability: Few-shot learning. For each unseen class c ∈ U, a handful of predefined support videos V k c are provided, where k is small. Then for each query video Q c ∈ D U , the small set of support videos containing exactly the same class V k c function as guidance videos to predict a segmentation for the unseen object class c.
Zero-shot learning. In the most conventional zero-shot strategy [76,35,47,42], all class labels C=S ∪ U are provided and mapped through semantic embeddings to vector representations {v c |c ∈ C}. Then a joint visual-text perspective helps the model learned on the seen classes generalize to the unseen classes.
Self-shot learning. Instead of predefined supports or semantic class labels, self-shot learning relies on an unsupervised manner to retrieve support videos {V Qc |V Qc ∈ S} for each query video Q c , c ∈ U from a collection of unlabelled videos S. It leverages the discovered support videos as guidance for predicting an instance segmentation. Self-shot learning can be viewed as a framework to obtain noisy few-shot examples without the need for human annotations.

Datasets
Since self-shot video instance segmentation is a new task, we set up two benchmarks through the reorganization of two existing (many-shot) video instance segmentation datasets, namely YouTube-VIS [72] (2021 version) and OVIS [59].
Self-VIS. YouTube-VIS contains 2,985 videos in the training set where the instance mask annotations are publicly available. The annotated instances cover 40 instance categories and a minority of the videos have instances of more than one classes. To build a setting with videos containing one singe instance class, we discard videos with multiple instance classes and obtain a total of 2,123 videos. We randomly select 30 classes for training and 10 classes for validation and testing.
Self-OVIS. Occluded VIS (OVIS) provides 607 videos with annotated instance masks. Among the 25 instance categories in OVIS, 17 are for training and 8 for validation and testing. With more instances of multiple classes per video, and more frequent occlusions, the setting of OVIS is much harder than the one of YouTue-VIS. More details are provided in Table 6 in the Appendix. During training, the query video and support videos are randomly paired according to the common instances present, while the pairs are fixed for validation and testing for reproducibility. All dataset construction details will be released for researchers to reproduce and build upon this work.
YouTube-8M Segments. The YouTube-8M Segments dataset is a subset of the YouTube-8M dataset proposed in the same paper [1]. It contains about 237K 5-second videos extracted from around 50K source videos and while it contains annotations, we do not use any of the labels. Instead, we adopt YouTube-8M Segments as our unlabelled video database S for self-shot retrieval and call the self-shot benchmarks 4 Finding support videos through self-shot learning The purpose of self-shot learning is to retrieve videos from a large, unlabelled video dataset that will aid in performing inference on the query video, specifically for the task of instance segmentation in this paper. To this end, we train an encoder that will yield an embedding space well suited for video retrieval by adopting components of self-supervised representation learning methods MoCo v1 to v3 [32, 18,20], multiple-instance NCE [49] and self-supervised ranking [64].
For self-shot learning, we are given an unlabelled video collection S. Each clip is encoded by two visual encoders, Φ andΦ, whereΦ is updated as the exponential moving-average of Φ as in [32,20]. With this setup we evaluate self-shot retrieval with two different losses: noise-contrastive instance discrimination and ranking.
The contrastive loss L NCE in our case is given by setting positive pairs to be different temporal crops of a single video, while negative pairs are constructed from other instances of the dataset. Let V i ∈ S denote a single unlabelled video and let v ∈ V i denote one of its temporal crops. Then we naturally arrive at the following multiple-instance NCE [49] formulation: where ⟨·, ·⟩ τ , is a temperature-scaled dot-product, and v + is the positive set defined as V i \ v and v − is the negative set, corresponding to crops from other videos in S. We further experiment with transplanting a differentiable ranking loss from [64], to the setting of using two encoders. The ranking loss is a less aggressive form of enforcing self-invariance than the NCE loss, and is given by learning an embedding space in which a set of positive videos is ranked above a set of negative videos, when comparing distances in feature space. More precisely, where R a (b, c) is a differentiable function to rank video b among all videos in the set {c} with respect to the query video a [10,64].
Once the feature spaces are learned, the final step is retrieving relevant support videos using only the query itself. For query video q, we use the self-supervised trained encoder Φ and a simple k-nearest neighbor (kNN) approach. The self-shot support videos for query q is obtained as: Note that this simple kNN approach allows us to use self-shot learning as a plug-and-play component, which can be used to replace supervised support videos or to extend these in a semi-supervised manner. This setup is generally applicable, we focus on video instance segmentation as testbed in this paper, due to the hefty annotation demand for supervised settings. Implementation details. We follow the uniform frame sampling method in [3] for mapping a video to a sequence of tokens of a Vision Transformer of size B (ViT-B). In each mini-batch, we use 160 5×224×224 video segments from 32 videos. The patch-size of ViT-B is 16×16. We keep the memory queue [32] and the length is 1280. We train for 40 epochs with the AdamW optimizer [45], with an initial learning rating of 10 −4 , which we decay by 10 at epoch 25. Further details are provided in the Appendix.

A Self-Shot and Few-Shot VIS Transformer
Equipped with self-shot learning, we examine a research problem with a high annotation cost: video instance segmentation. Hence our goal is to segment and track the object instances of interest in a query video. We do however not assume access to training videos labelled with the same instance classes, temporal boundaries, or mask annotations as support for the query video at test-time. In essence, the query video is on its own and we are instead given a collection of unlabelled videos. We seek to find a few unlabelled support videos from this collection through self-shot learning. While we aim for self-shot learning, fewshot video instance segmentation using a few support videos has not yet been investigated either. Hence, we first introduce a baseline sequence-to-sequence transformer approach to solve video instance segmentation given semantically similar (support) videos. At the core of our approach is a common instance segmentation transformer, which contains three stages with three functions: (i ) encoding and extracting of features for query and support videos, (ii ) learning of pixel-level similarities for the query features by leveraging cross-attention, and (iii ) prediction of instance mask sequences across space and time through decoding. Each step is detailed below.  In the feature extraction stage, given a query video and a handful of (self-shot) support videos, the backbone extracts features of individual image frames, then the image features are concatenated in the frame order to form clip-level features for the query and support videos. In the common transformer, the encoder models the pixel-level similarity for the query and support features respectively, the fuser leverages the similarity between the query feature and the support feature, and the decoder learns the similarity between instances along the time dimension. In the prediction stage, the instance sequences are inferred in the query video Feature extraction. We adopt a modified ResNet-50 [34] with a bigger receptive field for feature extraction, with the complete architecture given in the Appendix. We let a single query video and a few support videos go through the backbone to extract the pixel-level image frame feature sequences. Assume that the query video contains T frames and the support videos contain T ′ frames in total. The backbone generates a lower-resolution activation map for each frame in the query video and support videos, then the frame features are concatenated to form video clip level features for the query and support videos. The query video feature is denoted as f q ∈ R T ×d×W ×H and the support feature is f s ∈ R T ′ ×d×W ×H . The weights of the backbone are shared between the query and support videos.
Stage 1: Spatio-temporal transformer encoder. We first feed the extracted video features into the transformer encoder structure and flatten the spatial and temporal dimensions of f q and f s in 2D feature maps of size d×(T ·W ·H) and d×(T ′ ·W ·H). Since the image-encoder based backbone is permutation-invariant, we append spatio-temporal positional encodings [7,53] to the inputs as the instance segmentation task requires precise spatial and temporal information. Specially, for all spatio-temporal coordinates of each dimension, we independently use d/3 sine and cosine functions with different frequencies. We then concatenate them to get the final d channel encoding. The spatio-temporal positional encodings are added to both the query feature and support feature in each encoder layer. The output of this transformer encoder structure for the query branch is E q ∈ R d×(T ·W ·H) , and the output for the support branch is E s ∈ R d×(T ′ ·W ·H) . The encoder weights are also shared.
Stage 2: Query-support fuser. Given encoded query and support videos, we seek to discover similarities in space and time by integrating the support branch into the query branch, by utilizing the attention mechanism. Let MA denote the multi-headed attention with linear projection function Q(·), K(·), V (·) as described in [65]. We first cross-enhance the fuser inputs E q and E s through multi-head attention, as shown in Figure 4 in the Appendix: , and similarly for f s←q . Here, LN denotes the layer normalization operation [6]. Next, the support branch is fused into the query branch to get the fused feature F : In addition, a feed-forward network (2-layer MLP) is applied to F in a residual fashion for increased modelling ability, yielding output of the fuser: Stage 3: Decoding and predicting. The spatio-temporal decoder aims to decode the most discriminative pixel features that can represent the instances of each frame. We introduce a fixed number of input embeddings to represent the instance features across time and space, which we call instance sequences. Assuming that the model decodes n instances per frame, the number of instances for the T frames in the query video is N =n·T . The instance sequences are learned by the spatio-temporal decoder and take the output of the query-support fuser F and instance sequences as input, to outputs N instance features, denoted as D, as shown in Figure 1. Finally, the instance segmenter predicts the mask sequence for each instance. For each frame in the query video, we feed the instance features D and the fused feature F into an attention module to obtain the attention maps. The attention maps are then concatenated with the encoded query feature E q and the fused feature F, followed by a deformable convolution layer [21]. In this way, we obtain the mask features for each instance of the different frames in the query video. We denote the mask feature for instance i of frame t is g i,t ∈ R 1×a×W0×H0 , where a is the channel number, W 0 and H 0 are the feature width and height. Finally, the instance segmenter uses the accumulated features to output the mask sequence for each instance (see Appendix for details). and outputs the mask sequence m i ∈ R 1×1×T ×W0×H0 for the instance i directly.
Training loss. To score predicted instances with respect to the ground truth, we introduce an optimal bipartite matching between predicted and ground truth instances, in the spirit of [12,67] (see Appendix for details). Given the optimal assignment, the next step is to compute the training loss L train , which is a linear combination of a negative log-likelihood for foreground/background prediction, a box loss and mask loss for the instance sequences: here c i =foreground, andσ is the optimal assignment,p σ(i) (c i ) denotes the probability of c i with index σ(i), b i denotes the ground truth box sequences. This training loss is used to train the whole video instance segmentation framework end-to-end. For the bounding box loss we employ the generalize IoU loss as prescribed in [61], while we use a linear combination of the dice loss [50] and focal loss [43] for the mask loss. The full loss equations are provided in the Appendix. As a result we obtain an end-to-end framework that is guided by support videos and able to segment instances in a query video. Implementation details. As the largest video length in Self-VIS is 32, we take 32 as the query video clip length T . The support video clip length is set to 24. If the original video is too short or too long, we pad it with the last frame or cut it at a random position. All videos are resized to a 320×280 resolution before they are fed into the backbone. The model predicts 10 instances for each query frame, thus the total instance number is 320. In the common transformer structure, we use 6 encoder, 3 fuser, 6 decoder layers of width 288 with 8 attention heads. The model is trained with AdamW [45], setting the initial common transformer's learning rate to 10 −4 , the backbone's learning rate to 10 −5 . The model is trained for 20 epochs, with the learning rate decay by 10 at 14 epochs. We initialize our backbone with the weights pretrained on the COCO dataset [44]. Further details are provided in the Appendix.
The evaluation metric is average precision, with the video Intersection over Union (IoU) of the mask sequences as threshold. The IoU threshold is set to 0.5 unless specified otherwise. All code and scripts for reproducing experiments will be released.

Results
Self-shot evaluation. We first evaluate the potential of self-shot learning on the introduced video instance segmentation benchmarks. We use the introduced transformer and compare to both oracle upper bounds and self-supervised baselines for obtaining support videos as input to the transformer.
In Table 1, we compare a broad range of feature spaces for providing relevant support videos given a query video. We first find that utilizing random videos from the unlabelled dataset as support already provides a non-trivial instance segmentation performance (row a), but still with a considerable gap to the oracle baseline where each support video is manually curated to have matching instance classes with the query video. Self-shot learning brings large benefits over randomly picking support videos (rows (c)-(f )). We first establish a baseline of using ImageNet-pretrained features for obtaining relevant support samples Table 1: Self-shot evaluation. The unsupervised support videos come from the Youtube-8M Segments dataset and video instance segmentation performance is evaluated on the test set of Self-VIS. For comparability, we include baselines using random videos or fully supervised oracle videos as support. Inference-time support-increase is evaluated in the 5 + (n) columns where extra n support videos are used at inference. The strongest self-support is competitive with a 1-shot oracle-support in row (c), as well as finetuning these features using a non-parametric instance retrieval loss [69] using MoCo [32] in row (d), which adds around 2.5-3.5% in performance. Next, we utilize a more sophisticated MIL-NCE loss [49] and a rank-based retrieval loss [64] to learn video-clip embeddings (see Appendix for details). With this we find that row (f ) in Table 1 achieves strong gains of 6-10% in absolute performance compared to the random baseline and more than 3-7% compared to frozen ImageNet features and use this for subsequent experiments.
Besides the finding that all features obtained in a self-supervised fashion improve over the supervised frame-based features ones we also establish that the selfsupervised task does matter too, as we find the ranking loss well-suited for retrieving relevant support videos. We conclude that the strongest self-support can almost close the gap with the oracle-support baseline, even though self-shot support videos are not guaranteed to have matching classes. Self-shot versus zero-shot learning. To further quantify the effectiveness of self-shot learning for finding support videos, we compare to zero-shot learning on two different tasks: video instance segmentation and temporal action localization. For video instance segmentation, all experiments run on the Self-VIS dataset and as a zero-shot baseline we utilize the method from Dave et al . [22] that can segment moving objects in videos, even the ones unseen in training. For temporal action localization, we follow the setup of Yang et al . [73], which also provides the temporal action localization pipeline and the reorganized dataset derived from Thumos14. Zhang et al . [76] provide the zero-shot method for temporal action localization. They can localize the unseen activities in a long untrimmed video based on the label embeddings, which means class labels are needed during inference. In Table 2, we report the video instance segmentation and temporal action localization results. We find that on both settings our self-shot approach improves over the zero-shot alternatives, indicating that automatically obtaining Table 2: Self-shot versus zero-shot learning for video instance segmentation and temporal action localization. For Temporal action localization, we follow the setup of Yang et al . [73] on the Thumos14 dataset. The metric is video-mAP with an overlap threshold of 0.5. We find that our self-shot perspective is better suited for segmentation and localization in videos than zero-shot baselines  support videos in an unsupervised manner and using them for their respective video task obtains favorable results over a semantic transfer of information from seen to unseen visual classes. In the Appendix, we also provide results where we use zero-shot learning to help find support videos, which is also not as effective as self-shot learning. Transformer ablation. In Table 3, we show the effect of the three components in our video instance segmentation transformer when using both one and five self-shot support videos. We find that all three components matter for maximizing segmentation performance. Especially the introduced fuser module is important and adds 8.4% 1-shot performance compared to the baseline, while the encoder adds 1.7%. When combined, the encoder yields an additional 2.3% gain on top of the fuser-only baseline, showing that having sufficient encoding capacity before fusing leads to better performance. In the appendix we also establish that the proposed baseline is competitive both against previous works adapted for the novel video instance segmentation setting, as well as against established methods for an image segmentation setting. Overall, we conclude that the proposed transformer is effective for video instance segmentation using a few support videos.
Video difficulty ablation. Next, we ablate the effect of the number of instances and number of classes in the query video on the segmentation per-    Table 4. As each video in the Self-VIS dataset contains instances from just a single class, we use this to analyze the stability of our model with regard to the number of instances. The result is shown in Table 4a, and we find performance only mildly declines for a moderate increase, up to 3, in number of instances in the query video. Next, we use the more difficult Self-OVIS dataset to study the robustness against more diverse videos that contain more instances from multiple classes. As shown in Table 4b, the method still works well with more than one instance per video, though performance naturally declines with this added difficulty for the task. Scaling unsupervised support. The quality of the self-shot learning is bounded by the quality of the videos in the unlabelled video collection. In Figure 2 we show how self-shot video instance segmentation scales with unlabelled dataset size. We find that at around 75K videos, our self-shot approach with 5 videos already outperforms the 1-shot oracle-support baseline. While we cannot perform experiments using even larger dataset sizes, we can see that even at 237K videos, the performance is still rising steeply on a typical log-datasize scale. Based on this result, oracle-support from a labelled dataset of limited size might not even present a top-line for the same number of support videos and as we have shown in Table 1 can be further boosted with inference-time increase in number of supports. Thus, this shows that using larger unlabelled video datasets and conducting retrieval presents an effective method for scalable video instance segmentation. In Figure 3 we provide qualitative examples of self-shot learning.
Semi-shot learning. In the final experiment, we show results for combining self-shot and oracle support videos. In this setting, we are given a few oracle support videos and use these to help find more support videos in a self-shot Table 5: Semi-shot learning. We show that the performance increases when adding additional self-shot videos to the oracle-support videos, arriving at a semi-shot alternative. We find that such a hybrid setting can quickly close the gap to few-shot learning with ground truth support videos, further highlighting the potential of self-shot learning for video instance segmentation manner, arriving at a semi-shot alternative. In Table 5, we show using a single oracle video and 4 self-shot videos boosts performance by 1.9% and achieves 55.1% mAP, thus almost reaching the performance when using 5 oracle-support videos, all without any further annotation requirements.

Discussion
Limitations. While we have proposed and explored the task of self-shot video instance segmentation, we have done so in a sequential fashion: The support set generation is detached from the segmentation pipeline. While this allows for better analysis of the method, performance can likely be further improved by training in an end-to-end fashion. We are also limited by the unlabelled video dataset size because of our computational resources. As shown in Figure 2, larger dataset sizes will likely further highlight the benefit of utilizing self-shot learning.
Conclusions. This paper proposed the task of self-shot learning. We have analysed and proposed this in the most annotation intense setting, that of video instance segmentation where existence of oracle support can be considered unrealistic. For this we develop a novel transformer based instance segmentation baseline and outline how to obtain support videos automatically from an unlabelled pool through self-supervision. Experiments show that our approach achieves strong performance, can already outperform oracle support in some settings, is scalable, and can be combined in a semi-supervised setting.

A.1 Datasets
Dataset statistics. We report the statistics of the self-shot video instance segmentation datasets in Table 6. We list the class names for the train, validation and test sets in Table 7.  [64].
With this approximation we are able to design the differentiable ranking loss L Rank of Equation 2.
A. Query-support fuser. The query-support fuser can effectively leverage the similarity between the query and support videos, the detailed structure of which is shown in Figure 4. First, the query and support representations are enhanced by each other simultaneously through multi-head attention. Then, the support branch is fused into the query branch by the multi-head cross-attention mechanism. Finally, a feed-forward neural network (FFN) module in the form of a residual is performed to augment the fitting ability. To better understand the effectiveness of the fuser module, we visualize the attention heatmaps before and after the fuser module in Figure 5. The figure shows that the proposed fuser module is able to better highlight the instances of interest in the query video with the aid of supports.
Instance segmenter. The instance segmenter predicts the mask sequence for each instance. To predict mask sequences that are informed across time, we predict the masks based on the accumulation of mask features per instance. For each frame in the query video, we feed the instance features D and the fused feature F into an attention module to obtain the attention maps. Then the attention maps are concatenated with the encoded query feature E q and the fused feature F, followed by a deformable convolution layer [21]. In this way, we obtain the mask features for each instance of different frames in the query video. Assume that the mask feature for instance i of frame t is g i,t ∈ R 1×a×W0×H0 , where a is the channel number, W 0 and H 0 are the feature width and height. Then we concatenate the mask features of T frames in the query video to form the G i ∈ R 1×a×T ×W0×H0 . The instance segmenter takes the instance mask features G i as input, and outputs the mask sequence m i ∈ R 1×1×T ×W0×H0 for the instance i directly. The instance segmenter consists of three 3D convolutional layers and  Fig. 4: Structure of query-support fuser. First, the query and support representations are enhanced by each other simultaneously through message passing. Then, the support branch is fused into the query branch by the multi-head cross-attention mechanism. Finally, a feed-forward neural network (FFN) module in the form of a residual is performed to augment the fitting ability. Q, K, V denote different roles in the multi-head attention mechanism group normalization layers [68] with ReLU activation function, yielding T mask predictions for each instance i.
Optimal bipartite matching. Letŷ={ŷ} n i=1 denote the predicted instance sequences, and y the ground truth set of instance sequences. Assuming n is larger than the number of instances in the query video, we consider y also a set of size n by padding with ∅ (background). To find a bipartite matching between the two sets we search for a permutation of n elements σ with the lowest cost. As computing the instance mask sequence similarity directly is computationally intensive, we replace the mask sequence with the box sequence to perform the matching. Following the same practice of [12,74], we get the normalized center coordinates, height and width of the boxes and the binary foreground/background labels. The matching function is defined as [12]: where c i =foreground,p σ(i) (c i ) denotes the probability of c i with index σ(i), b i denotes the ground truth box sequences, andb σ(i) denotes the predicted box sequences with index σ(i). Based on the above criterion, a one-to-one matching of the sequences is found by the Hungarian algorithm [41], following prior work [63,12].
Components of training loss. For the bounding box loss L box , we use a linear combination of the sequence level L1 loss and the generalized IoU loss [61]: Before fuser After fuser The mask loss is defined as a combination of the dice loss [50] and focal loss [43]: B Further results

B.1 Few-shot experiments with oracle supports
Ablation of transformer depth. We ablate the effect of the layer depth of the encoder, fuser and decoder modules in Table 8 under the one-and five-shot setting on Self-VIS. We find the increase in performance is steady across all three modules when adding further capacity and use the setting of 6 encoder layers, 3 fuser layers and 6 decoder layers for all other experiments. Benefit of positional encoding. We report results in Table 9. Including the spatio-temporal positional encoding is always beneficial, ideally in both the support and query encoder. Not passing any spatio-temporal positional encoding to the features leads to an mAP drop of 3.8 under the one-shot and an mAP drop of 4.3 under the five-shot setting. Transformer ablation. In the Table 3 of the paper, we show the effect of the three components in our proposed transformer under self-shot supports. Here we show in Table 10 the results of the transformer ablation under few-shot setting with oracle supports and observe that the proposed transformer is also effective for video instance segmentation with few-shot oracle supports.
Comparison against related methods. As the task of few-shot VIS is novel, we cannot compare with existing methods that are not designed for this setting. We nevertheless try and thus adapt existing methods intended for other tasks. Michaelis et al . [48] provides a strong baseline for few-shot image instance segmentation based on Mask R-CNN [33] (FMRCNN). They generate many segmentation proposals for the query image and match the proposals with the support image to find the fitting ones. To build a baseline for few-shot VIS, we first extract the frame features for the support and query videos by our backbone. Then we compute the average of the support frame features as in prototypical networks [62]. Finally, with the averaged support feature, the instance segmenter Table 10: VIS transformer ablation with few-shot oracle supports. Besides the transformer ablation under the self-shot setting reported in the paper (Table 3), we also report the effectiveness of the three modules in the proposed transformer under the few-shot setting with oracle supports Encoder Fuser Decoder Self-VIS Self-OVIS 1-shot 5-shot 1-shot 5 can predict the instance masks for each query frame. We also compare against Yang et al . [74], which is a transformer-based approach for few-shot common action detection (FST). They propose a dedicated encoder-decoder structure to learn the commonality and predict a spatio-temporal localization. We transplant their transformer structure in our pipeline by replacing our common transformer. We compare to both baselines under one-and five-shot settings on Self-VIS and Self-OVIS in Table 11. Our approach achieves the best results with large margins on both datasets and settings. Table 11: Video instance segmentation on Self-VIS and Self-OVIS. We constructed two baselines [48,74] from author-provided code. Our common transformer obtains favourable results under one-and five-shot settings on both datasets Self-VIS Self-OVIS one-shot five-shot one-shot five-shot SMRCNN [48] 43 Video instance segmentation from images. Besides using videos, we can also perform few-shot video instance segmentation using only images as support. This is a novel and more challenging setting, as the model cannot exploit temporal information from the support videos. In Table 12, (img→vid), we perform few-shot video instance segmentation task with support images that are only a single middle frame for each support video using the Self-VIS dataset. We again compare against other methods and find that our approach performs better under both the one-and five-shot setting on this new task. Extending this task even further, we also consider the problem of few-shot image instance segmentation: Given a few support images containing the same object instances, find and segment the common object instances in a query image. As shown Table 12: Generalisation to images. We report common instance segmentation performance on the video and images when only image support input is provided. For video evaluation we use Self-VIS and for image evaluation MS-COCO from [48]. For MS-COCO we evaluate mAP at IoU level of 0.5 as in [48] img→vid img→img one-shot five-shot one-shot five-shot SMRCNN [48] 41. in Table 12, (img→img), our method can even generalize to this task on the challenging COCO dataset [48,44] where the backbone network is pretrained on ImageNet dataset, outperforming the other methods.

B.2 Self-shot experiments
Self-shot versus zero-shot learning. As a supplement to the experiments in Table 2 in the paper, we construct another two zero-shot baselines by randomly cropping segments in time or in space from the query video as supports. Results in Table 13 show that self-shot supports from a unlabelled pool of videos are more effective than the supports from the query video itself. This demonstrates that sample diversity in the support helps improve performance. Table 13: Self-shot versus zero-shot learning for video instance segmentation and temporal action localization. The experiment setups follow Table 2 in the paper. We build two simple zero-shot baselines by adapting the temporal or spatial segments of the query video as supports. We find that self-shot supports are more effective than segments from the query video itself