{'fraction_non_alphanumeric': 0.037470384545288865, 'fraction_numerical': 0.010825587752870422, 'mean_word_length': 4.789407047900401, 'pattern_counts': {'":': 0, '<': 2, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Self-Supervised Adaptation for Video Super-Resolution

Recent single-image super-resolution (SISR) networks, which can adapt their network parameters to specific input images, have shown promising results by exploiting the information available within the input data as well as large external datasets. However, the extension of these self-supervised SISR approaches to video handling has yet to be studied. Thus, we present a new learning algorithm that allows conventional video super-resolution (VSR) networks to adapt their parameters to test video frames without using the ground-truth datasets. By utilizing many self-similar patches across space and time, we improve the performance of fully pre-trained VSR networks and produce temporally consistent video frames. Moreover, we present a test-time knowledge distillation technique that accelerates the adaptation speed with less hardware resources. In our experiments, we demonstrate that our novel learning algorithm can fine-tune state-of-the-art VSR networks and substantially elevate performance on numerous benchmark datasets.


Introduction
Super-resolution (SR) aims to recover high-resolution (HR) images or videos given their low-resolution (LR) counterparts. Moreover, many techniques have been widely used in various areas, including medical imaging, satellite imaging, and electronics (e.g., smartphones, TV). However, recovering high-quality HR images from LR images is illposed and challenging. To solve this problem, early researchers have investigated reconstruction-based [25,35] and exemplar-based [3,8] methods. Dong et al. [7] proposed the use of convolutional neural networks (CNNs) to solve single-image super-resolution (SISR) for the first time. Kappeler et al. [16] extended this neural approach to the video super-resolution (VSR) task. Since then, many deep learning-based approaches have been introduced [17,18,20,36,37,39]. To benefit from the generalization ability of deep learning, most of these SR networks are trained with large external datasets. Meanwhile, some researchers have studied "zero-shot" SR approaches, which exploit similar patches across different scales within the input image and video [9,13,33,32]. However, searching for LR-HR pairs of patches within LR images is also difficult. Moreover, the number of self-similar patches critically decreases as the scale factor increases [41], and the searching problem becomes more challenging. To improve the performance by easing the searching phase, a coarse-to-fine approach is widely used [13,33]. Recently, several neural approaches that utilize external and internal datasets have been introduced and have produced satisfactory results [28,34,21]. However, these methods remain bounded to the smaller scaling factor possibly because of a conventional approach to self-supervised data pair generation during the test phase.
Therefore, we aim to develop a new learning algorithm that allows to explore the information available within given input video frames without using clean ground-truth frames at test time. Specifically, we utilize the space-time patchrecurrence over consecutive video frames and adapt the network parameters of a pre-trained VSR network for the test video during the test phase.
To train the network without relying on ground-truth datasets, we present a new dataset acquisition technique for self-supervised adaptation. Conventional self-supervised approaches are limited to handling a relatively small scaling factor (e.g., ×2), whereas our proposed technique allows a large upscaling factor (e.g., ×4). Specifically, we utilize initially restored video frames from the fully pretrained VSR networks to generate training targets for the test-time adaptation. In this manner, we can naturally combine external and internal data-based methods and elevate the performance of the pre-trained VSR networks. We summarize our contributions as follows: • We propose a self-supervised adaptation algorithm that can exploit the internal statistics of input videos, and provide theoretical analysis.
• Our pseudo datasets allow a large scaling factor for the VSR task without gradual manner.
• We introduce a simple yet efficient test-time knowledge distillation strategy.
• We conduct extensive experiments with state-of-theart VSR networks and achieve consistent improvement on public benchmark datasets by a large margin.

Related works
External-data-based SR. As three-layered deep CNNs are known to perform better than traditional model-based methods for the SISR task, several deep learning-based SR networks have been proposed. Kim et al. introduced a deeper network with residual learning [17] and also proposed an efficient learning scheme with the recursive parameter reuse technique [18]. By removing unnecessary modules, such as batch normalization, and by stabilizing the learning procedure with residual learning, Lim et al. [23] presented an even deeper network. Zhang et al. [39] brought channel attention to the network to make feature learning concise and proposed a residual-in-residual concept for stable learning. Recently, Dai et al. [6] further enhanced the attention module with second-order statistics. Starting from the neural approach for VSR tasks by Kappeler et al. [16], researchers have focused on utilizing redundant information among neighboring frames. To do so, Sajjadi et al. [31] proposed a frame-recurrent network by adding a flow estimation network to convey temporal information. Instead of adding a motion compensation module, Jo et al. [15] directly upscaled input videos by using estimated dynamic filters. Xue et al. [38] trained the flow estimation module to make it task oriented by jointly training the flow estimation and image-enhancing networks for various video restoration tasks (e.g., denoising and VSR). Instead of stacking neighboring frames, Haris et al. [10] proposed an iterative restoration framework by using recurrent back-projection architecture. Tian et al. [36] devised a deformable layer to align frames in a feature space as an alternative to optical flow estimation; this layer is further enhanced in the work of Wang et al. [37].
Although the existing methods have considerably improved network performance through training with large external datasets, they have limited capacity to exploit useful information within test input data. Our proposed method is embedded on top of pre-trained networks in a supervised manner to maximize the generalization ability of deep networks and also utilize the internal information within input test videos.
Internal-data-based SR. Among pioneering works on the internal data-based SR, Glasner et al. [9] generated HR images solely from a single LR image by utilizing recurring patches within same and across scales. Zontak et al. [41] deeply analyzed the patch-recurrence property within a single image. Huang et al. [13] further handled geometrically transformed similar patches to enlarge the searching space of patch-recurrence. Shahar et al. [32] extended the internal SISR method to the VSR task by observing that similar patches tend to repeat across space and time among neighboring video frames.
Recently, Shocher et al. [33] trained an SR network given a test input LR image by using the internal data statistics for the first time. To solve "zero-shot" video frame interpolation (temporal SR), Zuckerman et al. [29] exploited patch-recurrence not only within a single image but also across the temporal space.
More recently, Park et al. [28] and Soh et al. [34] exploited the advantages of external and internal datasets by using meta-learning and Lee et al. [21] further applied the technique to the VSR task. Through meta-training, network parameters can be adapted to the given test image quickly, and the proposed methods can shorten the self-supervised learning procedure. However, these methods are limited to the small scaling factor (e.g., ×2) because their conventional pseudo datasets generation strategy lacks highfrequency details to be exploited.
In contrast to existing studies, we aim to adapt the parameters of pre-trained VSR networks with a given LR video sequence at test time for a larger scaling factor without a coarse-to-fine manner, and we introduce a new strategy to generate pseudo datasets for self-supervised learning.
Knowledge distillation. Knowledge distillation from a bigger (teacher) network to a smaller (student) one was first suggested by Hinton et al. [12]. They trained a shallow network to imitate a deeper network for the classification task while keeping high performance; many follow-up studies have been introduced [30,26,40,14].
Recently, a few researchers have attempted to use knowledge distillation techniques for the SR task. He et al. [11] proposed affinity-based distillation loss to bound space of the features; this approach enables further suitable loss to the regression task. Lee et al. [22] constructed the teacher architecture with auto-encoder and trained the student network to resemble the decoder part of the teacher.
In contrast to conventional approaches that use the notion of knowledge distillation during the training phase, we distill the knowledge of a bigger network during test time to a smaller network to boost the adaptation efficiency.

Proposed method
In this section, we present a self-supervised learning approach based on the patch-recurrence property and provide theoretical analysis on the proposed algorithm. Ground-truth and restored HR frames by EDVR [37] show patch-recurrence across difference scales. Unlike ground-truth frames, downscaled version of a large patch includes more details in the restored HR frames. (c) -(d): Our goal is increasing the resolution of a small patch bLR using the downscaled patch a within the HR frames by adaptation.
creases when we deal with a video rather than a single image [32]. As shown in Figure 1, forward and backward motions of camera and/or objects generate recurring patches of different scales across multiple frames, which are crucial for the SR task. Specifically, larger patches include more detailed information than the corresponding smaller ones among neighboring frames, and these additional details facilitate the enhancement of the quality of the smaller ones, as introduced in [33, 28].

Pseudo datasets for large-scale VSR
In exemplar-based SR, we need to search for corresponding large patches among neighboring frames to increase the resolution of a small patch by a large scaling factor. For example, to increase the resolution of a 10×10 patch to a fourtimes enlarged one, we should find 40 × 40 patches within the LR inputs. However, these large target patches become scarce as the scaling factor increases [41]. Therefore, recent self-supervised approaches [33,28,34] are limited to a relatively small scaling factor (e.g., ×2). One can take advantage of a gradual upscaling strategy, as suggested in [13,33], but this coarse-to-fine approach greatly increases the adaptation time in the test stage.
To mitigate this problem and directly allow a large scaling factor, we acquire pseudo datasets from the initially restored HR video frames by fully pre-trained VSR networks.
In Figure 2, we illustrate how we organize datasets for the test-time adaptation without ground-truth targets. Our key observation in this work is that the visual quality of the downscaled version of a large patch and the corresponding small patch (e.g., a gt and b gt in Figure 2 (a)) is similar on the ground-truth video frames. However, this property does not hold with the HR frames predicted by conventional VSR networks, and the quality of the downscaled version of a large patch is much better than that of its corresponding small patch (e.g., a and b in Figure 2 (b)) because the LR version of the small patch (b LR ) includes minimal details and thus is non-discriminative for VSR networks to generate its high-quality counterpart. Furthermore, we discover that LR input of the small patch and a further downscaled version of the large patch become similar (e.g. a LR and b LR in Figure 2 (b)) because the additional details in a are also attenuated by the large downscaling to a LR from a.
Based on these findings, we generate a new training dataset to improve the performance of the pre-trained network on the given input frames, and we use a and a LR as our training target and input, respectively. Using this dataset, we can fine-tune the pre-trained VSR networks, as shown in Figure 2 (c). Then, the fine-tuned network can increase the resolution of b LR with a corresponding HR patch a, thereby including additional details (Figure 2 (d)). Note that, we generate the train set for the fine-tuning without using ground-truth frames; thus, our training targets become pseudo targets. Moreover, given that our test-time adaptation method relies on pre-trained VSR networks on the large external datasets and initial restoration results with a large scaling factor, we can naturally combine internal and large external information and handle large scaling factors. 1 Dynamite -BTS

Adaptation without patch-match
In Figure 2, we need to find a pair of corresponding patches (i.e. A and b) in the restored HR frames to enhance the quality of a patch b. However, finding these correspondences is a difficult task (e.g., optical flow estimation), which takes much time even with a naive patch-match algorithm [2].
To alleviate this problem, we use a simple randomized scheme under the assumption that the distributions of a LR and b LR are similar, which improves b without explicit searching for a. Specifically, we randomly choose patch a A. Then, we downscale A to a, and a to a LR in turn. In this manner, we can generate a large number of pseudo train datasets. Statistically, patches with high patch-recurrence are likely to be included multiple times in our dataset. Therefore, we can easily expose pairs of highly recurring patches across different scales to the VSR networks during adaptation, and the VSR networks can be fine-tuned without accurate correspondences if they are fully convolutional due to the translation equivariance property of CNNs [5]. Update θ using the gradient-based learning rule 8: end for 9: return {f θ (X t )}

Overall flow
The overall adaptation procedure of the proposed method is described in Algorithm 1. We first obtain the initial super-resolved frames {Y t } using a pre-trained VSR network f θ . Next, we randomly select a frame Y from the HR sequence {Y t }, and crop a patch Y p from Y randomly. Then, the random patch Y p is downscaled by a random scaling factor to generate the pseudo target y. Thus, we can generate a corresponding pseudo LR input y LR by simply downscaling the pseudo target y with the known desired scaling factor (e.g., ×4). By using this pseudo dataset, we update the network parameters by minimizing the distance between the pseudo target y and the network output (i.e., f θ (y LR )) based on the mean squared error (MSE). The network can be optimized with a conventional gradient-based optimizer, such as Adam [19], and we repeat these steps until convergence. Finally, we can render the enhanced out-

Recurring patches in restored frames
Pseudo targets for $ : Pseudo targets for % : Figure 3. Illustration of pseudo target generation. Our adaptation procedure can selectively utilize patches with more details by downscaling bigger patches.
puts by using the updated network parameters.

Theoretical analysis
In this section, we analyze the adaptation procedure to understand the principle of the proposed method in Algorithm 1.

Adaptation performance
In Figure 2, we observed that larger patches can help improve the quality of the corresponding but smaller ones. We analyzed this observation more concretely. Assume that we have k similar restored HR patches from various scales, and they are sorted from smallest to largest ones as illustrated in the top of Figure 3. Then, we can guarantee that the quality of the SR results by our adaptation algorithm is better than the initially restored results from the pre-trained baseline. Theorem 1. The restoration quality of recurring patches improves after the adaptation.
Proof. As we assume that corresponding HR patches are sorted, larger versions of a patch y m are {y i } k i=m+1 when 1 ≤ m < k. Using known SR kernel (e.g., bicubic), we can easily downscale these (k − m) larger patches (i.e. {y i } k i=m+1 ) and generate {y i→m } k i=m+1 where the size of y i→m equals that of y m (see Figure 3).
Note that, we acquire these pseudo targets {y i→m } k i=m+1 by using downscaling in Algorithm 1, and thus the pseudo targets include more image details. Accordingly, under an assumption that y LR m and {y i→m } LR are identical, which are LR versions of y m and {y i→m } by downscaling with the given large scaling factor (e.g., ×4),  our Algorithm 1 will minimize the MSE loss for the patch y m as: where f θ is the network to be adapted. Then, we can update the parameter θ, which results in f θ (y LR m ) = 1 k−m k i=m+1 y i→m for m ∈ {1, 2, ..., k − 1}. Recall that patches y i→m with larger i includes more image details in our observation; thus, a newly restored version of f θ (y LR m ) also includes more details than the initially restored patch y m .Meanwhile, the adaptation for y m naturally discards corresponding but smaller patches (i.e., {y i } m i=1 ) because our proposed pseudo target generation is solely with the downscaling operation.

Space-time consistency
Next, we provide analysis on the space-time consistency of the recurring patches. That is, we enforce consistency among recurring patches via our adaptation. Lemma 2. The adapted network generates consistent HR patches.
Proof. Assume that we have two corresponding patches y m and y n of the same size (e.g., y 2 and y 3 in Figure 3), then the adapted network parameter θ would predict the same results for these patches in accordance with Theorem 1 (i.e., 1 k−n k i=n+1 y i→n if m < n), and the corresponding patches become identical.
The above lemma shows that the corresponding HR patches by the adapted network are consistent. This property is important because the adapted network is guaranteed to predict spatio-temporally consistent results.

Efficient adaptation via knowledge distillation
Although our test-time adaptation algorithm in Algorithm 1 can elevate SR performance, it takes much time Acquire pseudo input y LR by downscaling y 6: Compute gradient: ∇ φ ||g φ (y LR ) − y|| 2 2 7: Update φ using the gradient-based learning rule 8: end for 9: return {g φ (X t )} when the pre-trained network f θ is large. To mitigate this problem, we introduce an efficient adaptation algorithm with the aid of a knowledge distillation technique as in Algorithm 2. Specifically, we define teacher as a big network and student as a much smaller network (Figure 4). Conventional distillation [11,22] is performed during the training phase with ground-truth HR images, whereas we can distill useful information in test time solely with our generated pseudo datasets. We find that our method without sophisticated techniques (e.g., feature distillation) reduces computational complexity whilst boosts the SR performance.

Experiments
In this section, we provide the quantitative and qualitative experimental results and demonstrate the performance of the proposed method. Please refer to our supplementary material for more results. Moreover, the code, dataset, and pre-trained models for the experiments are also included in the supplementary material.

Implementation details
We implement our adaptation algorithm on the PyTorch framework and use NVIDIA GeForce RTX 2080Ti GPU for the experiments.
Baseline VSR networks and test dataset. For our baseline VSR networks, we adopt three different VSR networks: TOFlow [38], RBPN [10], and EDVR [37]. Notably, EDVR is the state-of-the-art VSR approach at the time of submission. Each network is fully pre-trained with large external datasets, and we use publicly available pre-trained network parameters. 2 To evaluate the performance of the proposed adaptation algorithm, we test our method on public test datasets, i.e., Vid4 and REDS4. The Vid4 dataset [24] includes four clips  Table 1. Quantitative results of the proposed method using various baseline networks with ×4 upscaling factor on Vid4 (top) and REDS4 (bottom) dataset. The performance of the baseline networks is consistently boosted with our proposed adaptation.
with 41, 34, 49, and 47 frames each. The video contains limited motion, and the ground-truth video still shows a certain amount of noise. The REDS4 test dataset [37] includes four clips from the original REDS dataset [27]. The REDS dataset comprises 720×1280 HR videos from dynamic scenes. It also contains a larger motion than Vid4, and each clip contains 100 frames. Note that, none of these test datasets are used for pre-training the baseline networks.
Adaptation setting and evaluation metrics. We minimize MSE loss using the Adam [19] in Algorithm 1 and Algorithm 2. Refer to our supplementary material and codes for detailed settings, including patch size, batch size, and learning rate. For each pseudo dataset generation procedure, we randomly choose a downscaling factor from 0.8 to 0.95. The number of adaptation iterations for the Vid4 and REDS4 datasets are 1K and 3K, respectively. All the experiments are conducted with a fixed upscaling factor (i.e., ×4), which is the most challenging setting in conventional VSR works. We evaluate the SR results in terms of peak signal-tonoise ratio (PSNR) and structure similarity (SSIM). In calculating the values, we convert the RGB channel into the YCbCr channel and use only the Y channel as suggested in [37]. Moreover, to evaluate the temporal consistency of the restored frames, we use a pixel-wise error of the estimated optical flow (tOF) as introduced in [4].

Restoration results
Quantitative and qualitative VSR results. In Table 1, we compare the SR performance before and after adaptation. TOFlow [38], RBPN [10], and EDVR [37] are used as our baselines and evaluated on the Vid4 and REDS4 datasets. The proposed method consistently improves the SR performance over the baseline networks. In particular, we observe a large margin on the REDS4 dataset be-  Table 2. Evaluating temporal consistencies in terms of tOF [4] before and after adaptation. Our proposed method largely improves the temporal consistency than all baselines. Lower score indicates better performance.
cause the REDS4 dataset includes more recurring patches (more frames and forward/backward motions than the Vid4 dataset).
In Figure 5, we provide visual comparisons. We see that the restored frames after using our adaptation algorithm show much clearer and sharper results than the initial results by the pre-trained baseline networks. In particular, broken and distorted edges are well restored.
Temporal consistency. We also compare the temporal consistencies in Table 2 in terms of the correctness of estimated optical flow [4], and we see that our method consistently improves temporal consistency (i.e., tOF). We also visualize the temporal consistency in Figure 6. We trace the fixed horizontal lines (yellow line in the left sub-figures) and vertically stack it for every time step. Then, the noisy effect (e.g., jagged line) in the result indicates the flickering of the video [31]. Thus, we conclude that the adapted networks achieve temporally more smooth results while maintaining sharp details over the baselines.
Efficient adaptation via knowledge distillation. As conventional VSR networks are very huge, it takes much time to apply our adaptation algorithm at test time. Thus, we reduce the adaptation time by using the knowledge distillation method in Algorithm 2. We demonstrate the effects of our algorithm using the large and small versions of EDVR (EDVR L and EDVR S for each) on the Vid4 dataset. Note  that, EDVR L has approximately 21 million parameters, and EDVR S has about 3.3 million parameters.
In Table 3, we observe that we can reduce the adaptation time in half with less hardware resources by distilling knowledge from EDVR L to EDVR S (EDVR L→S ) compared with the adaptation from EDVR L to EDVR L (EDVR L→L ) while improving the performance over the large baseline network (EDVR L ).
This promising result opens an interesting research direction of combining knowledge distillation with the selfsupervision-based SR task.

Ablation study
VSR quality and the number of recurring patches. To observe the enhanced region with our adaptation, we restore frames including highly repeated patches in Figure 7. The error maps show that the smaller patches are well restored by our adaptation without distorting the larger patches; these results are in consistent with Theorem 1. Moreover, we measure the adaptation performance by changing the number of recurring patches. For the comparison, we first restore T frames in the given video with T different parameters, which are adapted for each frame without using neighboring frames (low patch-recurrence). Next, we predicted results with a global parameter adapted using every frame in the given input video (high patchrecurrence). These results are compared in Table 4, and we see that we achieve better performance when the number of recurring patches is large. Notably, low patch-recurrence on the REDS4 dataset even degrades the performance over the baseline.
Random downscaling and VSR results. In Table 5, we compare VSR results obtained with and without downscaling in generating the pseudo dataset. We demonstrate that we can exploit self-similar patches by generating pseudo dataset with downscaling as illustrated in Figure 2, and random downscaling records the best performance. Note that no-downscaling and upscaling produce poor results since  Table 5. VSR results by changing scaling methods for pseudo target generation with EDVR [37]. Downscaling in pseudo target generation improves the performance while upscaling degrades. Random downscaling shows the best performance.   we cannot generate high-quality pseudo targets with more image details.
Application to SISR. We conduct experiments to observe the applicability of our algorithm to the SISR task with RCAN [39] on the DIV2K [1] and Urban100 [13] datasets. Notably, RCAN is a state-of-the-art SISR approach currently. We apply Algorithm 1 to RCAN by assuming that the the given video includes only a single frame. Table 6 shows the consistent improvements. In particular, on the Urban100 dataset, which contains highly recurring patches across different scales, performance gain is significant (+0.5 dB). Visual comparisons are also provided in Figure 8, we see the correctly restored edges with our adaptation.

Conclusion
In this study, we propose a self-supervision-based adaptation algorithm for the VSR task. Although many SISR methods benefit from self-supervision, only a few studies have been attempted for the VSR task. Thus, we present a new self-supervised VSR algorithm which can further improve the pre-trained networks and allows to deal with large scaling factors by combining the information from the external and internal dataset. We also introduce test-time knowledge distillation algorithm for the self-supervised SR task. In the experiments, we show the superiority of the proposed method over various baseline VSR networks.