---
abstract: 'This paper shows that when applying machine learning to digital zoom, it is beneficial to operate on real, RAW sensor data. Existing learning-based super-resolution methods do not use real sensor data, instead operating on processed RGB images. We show that these approaches forfeit detail and accuracy that can be gained by operating on raw data, particularly when zooming in on distant objects. The key barrier to using real sensor data for training is that ground-truth high-resolution imagery is missing. We show how to obtain such ground-truth data via optical zoom and contribute a dataset, SR-RAW, for real-world computational zoom. We use SR-RAW to train a deep network with a novel contextual bilateral loss that is robust to mild misalignment between input and outputs images. The trained network achieves state-of-the-art performance in 4X and 8X computational zoom. We also show that synthesizing sensor data by resampling high-resolution RGB images is an oversimplified approximation of real sensor data and noise, resulting in worse image quality.[^1]'
author:
- |
    Xuaner Zhang\
    UC Berkeley\
- |
    Qifeng Chen\
    HKUST\
- |
    Ren Ng\
    UC Berkeley\
- |
    Vladlen Koltun\
    Intel Labs\
bibliography:
- 'main.bib'
title: 'Zoom to Learn, Learn to Zoom'
---

Introduction
============

Zoom functionality is a necessity for mobile phones and cameras today. People zoom onto distant subjects such as wild animals and sports players in their captured images to view the subject in more detail. Smartphones such as iPhoneX are even equipped with two cameras at different zoom levels, indicating the importance of high-quality zoom functionality for the consumer camera market.

Optical zoom is an optimal choice for image zoom and can preserve high image quality, but zoom lenses are usually expensive and bulky. Alternatively, we can conveniently use digital zoom with a standard lens. However, digital zoom simply upsamples a cropped region of the camera sensor input, producing blurry output. It remains a challenge to obtain high-quality images for distant objects without expensive optical equipment.

We propose to improve the quality of super-resolution by starting with real raw sensor data. Recently, single-image super-resolution has progressed with deep models and learned image priors from large-scale datasets [@bruna2015super; @Johnson2016; @kim2016deeply; @Kim2016; @Lai2017; @ledig2017photo; @lim2017enhanced; @sajjadi2016enhancenet; @zhang2018residual]. However, these methods are constrained in the following two respects. First, they approach computational zoom under a synthetic setup where the input image is a downsampled version of the high-resolution image, indirectly reducing the noise level in the input. In practice, regions of distant objects often contain more noise as fewer photons enter the aperture during the exposure time. Second, most existing methods start with an 8-bit RGB image that has been processed by the camera’s image signal processor (ISP), which trades off high-frequency signal in higher-bit raw sensor data for other objectives (noise reduction). In this work, we raise the possibility to apply machine learning to computational zoom that uses real raw sensor data as input. The fundamental challenge is obtaining ground truth for this task: low-resolution raw sensor data with corresponding high-resolution images. One approach is to synthesize sensor data from 8-bit RGB images that are passed through some synthetic noise model [@gharbi2016deep]. However, noise from a real sensor [@tian2000noise] can be very challenging to model and is not modeled well by any current work that synthesizes sensor data for training. The reason is that sensor noise comes from a variety of sources, exhibiting color cross-talk and effects of micro-geometry and micro-optics close to the sensor surface. We find that while a model trained on synthetic sensor data works better than using 8-bit RGB data (compare (B) and (C) in Figure \[fig:teaser\]), the model trained on real raw sensor data performs best (compare (C) and (D) in Figure \[fig:teaser\]).

To enable learning from real raw sensor data for better computational zoom, we propose to capture real data with a zoom lens [@kingslake1960development], where the lens can move physically further from the image sensor to gather photons from a narrower solid angle for optical magnification. We build SR-RAW, the first dataset used for real-world computational zoom. contains ground-truth high-resolution images taken with high optical zoom levels. During training, an 8-bit image taken with a longer focal length serves as the ground truth for the higher-bit (12-14 bit) raw sensor image taken with a shorter focal length.

During training, SR-RAW brings up a new challenge: the source and target images are not perfectly aligned as they are taken with different camera configurations that cause mild perspective change. Furthermore, preprocessing introduces ambiguity in alignment between low- and high-resolution images. Mildly misaligned input-output image pairs make pixel-wise loss functions unsuitable for training. We thus introduce a novel contextual bilateral loss (CoBi) that is robust to such mild misalignment. CoBi draws inspiration from the recently proposed contextual loss (CX) [@mechrez2018contextual]. A direct application of CX to our task yields strong artifacts because CX doesn’t take spatial structure into account. To address this, CoBi prioritizes local features while also allowing for global search when features are not aligned.

In brief, we “Zoom to Learn" – collecting a dataset with ground-truth high-resolution images obtained via optical zoom, to “Learn to Zoom" – training a deep model that achieves better computational zoom. To evaluate our approach, we compare against existing super-resolution methods and also against an identical model to ours, but trained on synthetic sensor data obtained via a standard synthetic sensor approximation. Image quality is measured by distortion metrics such as SSIM, PSNR, and a learned perceptual metric. We also collect human judgments to validate the consistency of the generated images with human perception. Results show that real raw sensor data contains useful image signal for recovering high-fidelity super-resolved images. Our contributions can be summarized as follows:

-   We demonstrate the utility of using real high-bit sensor data for computational zoom, rather than processed RGB images or synthetic sensor models.

-   We introduce a new dataset, SR-RAW, the first dataset for super-resolution from raw data, with optical ground truth. SR-RAW is taken with a zoom lens. Images taken with long focal length serve as optical ground truth for images taken with shorter focal length.

-   We propose a novel contextual bilateral loss (CoBi) that handles slightly misaligned image pairs. CoBi considers local contextual similarities with weighted spatial awareness.

Related Work
============

Image super-resolution has advanced from traditional filtering to learning-based methods. The goal is to reconstruct a high-resolution image from a low-resolution RGB image. Traditional approaches include filtering-based techniques such as bicubic upsampling and edge-preserving filtering [@Li2001]. These filtering methods usually produce overly smooth texture in the output high-resolution image. Several approaches use patch matching to search for similar patches in a training dataset or in the image itself [@Freeman2002; @Glasner2009; @Huang2015]. Recently, deep neural networks have been applied to super-resolution, trained with a variety of losses [@Dong2016; @Johnson2016; @Kim2016].

Many recent super-resolution approaches are based on generative adversarial networks. SRGAN [@ledig2017photo] is an image super-resolution approach that applies a GAN to generate high-resolution images. The loss used in SRGAN combines a deep feature matching loss and an adversarial loss. Lai . [@Lai2017] propose the Laplacian Pyramid Super-Resolution Network to progressively predict the residual of high-frequency details of a lower-resolution image in a coarse-to-fine image pyramid. Wang . [@wang2018esrgan] propose ESRGAN, which enhances image super-resolution with a Relativistic GAN [@Jolicoeur_Martineau2019] that estimates how much one image is relatively more realistic than another. Wang . [@wang2018sftgan] study class-conditioned image super-resolution and propose SFT-GAN that is trained with a GAN loss and a perceptual loss. Most existing super-resolution models take a synthetic low-resolution RGB image (usually downsampled from a high-resolution image) as input. In contrast, we obtain real low-resolution images taken with shorter focal lengths and use optically zoomed images as ground truth.

Prior works have used raw sensor data to enhance image processing tasks. Farsiua . [@farsiu2006multiframe] propose a maximum a posteriori technique for joint multi-frame demosaicing and super-resolution estimation with raw sensor data. Gharbi . [@gharbi2016deep] train a deep neural network for joint demosaicing and denoising. Zhou . [@zhou2018deep] address joint demosaicing, denoising, and super-resolution. These methods use synthetic Bayer mosaics. Similarly, Mildenhall . [@mildenhall2018burst] synthesize raw burst sequences for denoising. Chen . [@Chen2018] present a learning-based image processing pipeline for extreme low-light photography using raw sensor data. DeepISP is an end-to-end deep learning model that enhances the traditional camera image signal processing pipeline [@Schwartz2019]. Similarly, we operate on raw sensor data and propose a method to super-resolve images by jointly optimizing for the camera image processing pipeline and super-resolution from raw sensor data.

Dataset With Optical Zoom Sequences {#sec:dataset}
===================================

[ccc]{}\
&(A) Example sequence from SR-RAW&\
\
(B1) Noticeable perspective misalignment & (B2) Depth-of-field misalignment & (B3) Resolution alignment ambiguity\

To enable training with real raw sensor data for computational zoom, we collect a diverse dataset, SR-RAW, that contains raw sensor data and ground-truth high-resolution images taken with a zoom lens at various zoom levels. For data preprocessing, we align the captured images with different zoom levels via field of view (FOV) matching and geometric transformation. The SR-RAW dataset enables training an end-to-end model that jointly performs demosaicing, denoising, and super-resolution on raw sensor data. Training on real sensor data differentiates our framework from existing image super-resolution algorithms that operate on low-bit RGB images.

Data Capture with a Zoom Lens {#subsec:capture}
-----------------------------

We use a 24-240 mm zoom lens to collect pairs of RAW images with different levels of optical zoom. Each pair of images forms an input-output pair for training a model: the short-focal-length raw sensor image is used as input and the long-focal-length RGB image is regarded as the ground-truth for super-resolution. For example, the RGB image taken with a 70mm focal length serves as the 2X zoom ground truth for the raw sensor data taken with a 35mm focal length. In practice, we collect 7 images under 7 optical zoom settings per scene for data collection efficiency. Every pair of images from the 7-image sequence forms a data pair for training a particular zoom model. In total, we collect 500 sequences in indoor and outdoor scenes. ISO ranges from 100 to 400. One example sequence is shown in Figure \[fig:dataset\]A.

During data capture, camera settings are important. First, depth of field (DOF) changes with focal length and it is not practical to adjust aperture size for each focal length to make DOF identical. We choose a small aperture size (at least f/20) to minimize the DOF difference (still noticeable in Figure \[fig:dataset\] B2), using a tripod to capture indoor scenes with a long exposure time. Second, we use the same exposure time for all images in a sequence so that noise level is not affected by focal length change. But we still observe noticeable illumination variations due to shutter and physical pupil being mechanical and involving action variation. This color variation is another motivation for us to avoid using pixel-to-pixel losses for training. Third, although perspective does not change with focal length, there exists slight variation (length of the lens) in the center of projection when the lens zooms in and out, generating noticeable perspective change between objects at different depths (Figure \[fig:dataset\] B1). Sony FE 24-240mm, the lens we use, requires a distance of at least 56.4 meters from the subject to have less than one-pixel perspective shift between objects that are 5 meters apart. Therefore, we avoid capturing very close objects but allow for such perspective shifts in our dataset.

Data Preprocessing
------------------

For a pair of training images, we denote the low-resolution image by RGB-L and its sensor data by RAW-L. For high-resolution ground truth we use RGB-H and RAW-H. We first match the field of view (FOV) between RAW-L and RGB-H. Alignment is then computed between RGB-L and RGB-H to account for slight camera movement caused by manually zooming the camera to adjust focal lengths. We apply a Euclidean motion model that allows image rotation and translation via enhanced correlation coefficient minimization [@evangelidis2008parametric]. During training, RAW-L with matched FOV is fed into the network as input; its ground truth target is RGB-H that is aligned and has the same FOV with RAW-L. A scale offset is applied to the image if the optical zoom does not perfectly match the target zoom ratio. For example, an offset of 1.07 is applied to the target image if we use (35mm, 150mm) to train a 4X zoom model.

Misalignment Analysis
---------------------

Misalignment is unavoidable during data capture and can hardly be eliminated by the preprocessing step. Since we capture data with different focal lengths, misalignment is inherently caused by the perspective changes as described in Section \[subsec:capture\]. Furthermore, when aligning images with different resolutions, sharp edges in the high-resolution image cannot be exactly aligned with blurry edges in the low-resolution image (Figure \[fig:dataset\] B3). The described misalignment in SR-RAW usually causes 40-80 pixel shifts in an 8-megapixel image pair.

Contextual Bilateral Loss {#sec:cobi}
=========================

When using SR-RAW for training, we find that pixel-to-pixel losses such as $L_1$ and $L_2$ generate blurred images due to misalignment in the training data (Section \[sec:dataset\]). On the other hand, the recently proposed Contextual Loss (CX) [@mechrez2018contextual] for unaligned data is also unsatisfactory as it only considers features but not their spatial location in the image. For a brief review, the contextual loss was proposed to train with unaligned data pairs. It treats the source image $P$ as a collection of feature points ${p_i}_{i=1}^{N}$ and the target image $Q$ as a set of feature points ${q_j}_{j=1}^{M}$. For each source image feature $p$, it searches for the nearest neighbor (NN) feature match $q$ such that $q=\argmin_{q}\mathbb{D}(p,q_j)_{j=1}^{M}$ under some distance measure $\mathbb{D}(p,q)$. Given input image $P$ and its target $Q$, the contextual loss tries to minimize the summed distance of all matched feature pairs, formulated as $$\label{eq:cx}
\mathrm{CX}(P, Q)=\frac{1}{N}\sum_{i}^{N}\min_{j=1,...,M}(\mathbb{D}_{p_i,q_j}).$$ We find that training with the contextual loss yields images that suffer from significant artifacts, demonstrated in Figure \[fig:artifact\]. We hypothesize that these artifacts are caused by inaccurate feature matching in the contextual loss. We thus analyze the percentage of features that are matched uniquely (i.e., bijectively). The percentage of target features matched with a unique source feature is only 43.7%, much less than the ideal percentage of 100%.

  --------------------------------------------------------------- ------------------------------------------------------------ ------------------------------------------------------------- ------------------------------------------------------------
   ![image](figures/artifacts-input.jpg){width=".239\linewidth"}   ![image](figures/artifacts-out.jpg){width=".24\linewidth"}   ![image](figures/artifacts-ours.jpg){width=".24\linewidth"}   ![image](figures/artifacts-gt.jpg){width=".238\linewidth"}
                           \(A) Bicubic                                                \(B) Train with CX                                          \(C) Train with CoBi                                           \(D) Ground truth
  --------------------------------------------------------------- ------------------------------------------------------------ ------------------------------------------------------------- ------------------------------------------------------------

\[fig:artifact\]

In order to train our model appropriately, we need to design an image similarity measure applicable to image pairs with mild misalignment. Inspired by the edge-preserving bilateral filter [@tomasi1998bilateral], we integrate the spatial pixel coordinates and pixel-level RGB information into the image features. Our Contextual Bilateral loss (CoBi) is defined as $$\label{eq:cobi}
\mathrm{CoBi}(P, Q)=\frac{1}{N}\sum_{i}^{N}\min_{j=1,...,M}(\mathbb{D}_{p_i,q_j}+w_{s}\mathbb{D'}_{p_i,q_j}),$$ where $\mathbb{D'}_{p_i,q_j}=\|(x_i,y_i) - (x_j,y_j)\|_2$. $(x_i,y_i)$ and $(x_j,y_j)$ are spatial coordinates of features $p_i$ and $q_j$, respectively, and $w_s$ denotes the weight of spatial awareness for nearest neighbor search. $w_s$ enables CoBi to be flexible to the amount of misalignment in the training dataset. The average number of one-to-one feature matches for our model trained with CoBi increases from 43.7% to 93.9%.

We experiment with different feature spaces for CoBi and conclude that a combination of RGB image patches and pre-trained perceptual features leads to the best performance. In particular, we use pretrained VGG-19 features [@Simonyan2015] and select ‘conv1\_2’, ‘conv2\_2’, and ‘conv3\_2’ as our deep features, shown to be successful for image synthesis and enhancement [@chen2017photographic; @zhang2018single]. Cosine distance is used to measure feature similarity. Our final loss function is defined as $$\label{eq:obj}
\begin{aligned}
 \mathrm{CoBi_{RGB}}(P, Q, n)+\lambda\mathrm{CoBi_{VGG}}(P, Q),
\end{aligned}$$ where we use $n \times n$ RGB patches as features for $\mathrm{CoBi_{RGB}}$, and $n$ should be larger for the 8X zoom (optimal $n=15$) than the 4X zoom model (optimal $n=10$). Qualitative comparisons on the effect of $\lambda$ are shown in the supplement.

Experimental Setup {#sec:experiments}
==================

We use images from SR-RAW to train a 4X model and an 8X model. We pack each $2\times 2$ block in the raw Bayer mosaic into 4 channels as input for our model. The packing reduces the spatial resolution of the image by a factor of two in width and height, without any loss of signal. We subtract the black level and then normalize the data to $[0,1]$. White balance is read from EXIF metadata and applied to the network output as post-processing for comparison against ground truth. We adopt a 16-layer ResNet architecture [@He2016] followed by $\log_2{N}+1$ up-convolution layers where $N$ is the zoom factor.

We split 500 sequences in SR-RAW into training, validation, and test sets with a ratio of 80:10:10, so that there are 400 sequences for training, 50 for validation, and 50 for testing. For a 4X zoom model, we get 3 input-output pairs per sequence for training, and for an 8X zoom model, we get 1 pair per sequence. Each pair contains a full-resolution (8-megapixel) Bayer mosaic image and its corresponding full-resolution optically zoomed RGB image. We randomly crop $64 \times 64$ patches from a full-resolution Bayer mosaic as input for training. Example training patches are shown in the supplement.

We first compare our approach to existing super-resolution methods that operate on processed RGB images. Then we conduct controlled experiments on our model variants trained on different source data types. All comparisons are tested on the 50 held-out test sequences from SR-RAW.

Baselines {#subsec:processed}
---------

We choose a few representative super-resolution (SR) methods for comparisons: SRGAN [@ledig2017photo], a GAN-based SR model; SRResnet [@ledig2017photo] and LapSRN [@Lai2017], which demonstrate different network architectures for SR; a model by Johnson . [@Johnson2016] that adopts perceptual losses; and finally ESRGAN [@wang2018esrgan], the winner of the most recent Perceptual SR Challenge PIRM [@blau20182018].

For all baselines except [@Johnson2016], we use public pretrained models; we first try to fine-tune their models on SR-RAW, adopting the standard setup in the literature: for each image, the input is the downsampled (bicubic) version of the target high-resolution image. However, we notice little difference in average performance ($<\!\!\pm$0.04 for SSIM, $<\!\!\pm$0.05 for PSNR, and $<\!\!\pm$0.025 for LPIPS) in comparison to the pretrained models without fine-tuning, and thus we directly use the models without fine-tuning for comparisons. For baseline methods without pretrained models, we train their models from scratch on SR-RAW.

Controlled Experiments on Our Model {#subsec:control}
-----------------------------------

  -- ----------------- ------ ---------
     Features          Syn    Real
     1\. AA Filter     No     Yes/No
     2\. Bit Depth     8      12-14
     3\. Crosstalk     No     Yes
     4\. Fill Factor   100%   $<$100%
  -- ----------------- ------ ---------

**“Ours-png".** For comparison, we also train a copy of our model (“Ours-png") using 8-bit processed RGB images to evaluate the benefits of having real raw sensor data. Different from the synthetic setup described in Section \[subsec:processed\], instead of using downsampled RGB image as input, we use the RGB image taken with a shorter focal length as input. The RGB image taken with a longer focal length serves as the ground truth. **“Ours-syn-raw".** To test whether synthesized raw data can replace real sensor data for training, we adopt the standard sensor synthesis model described by Gharbi et al. [@gharbi2016deep] to generate synthetic Bayer mosaics from 8-bit RGB images. In brief, we retain one color channel per pixel according to the Bayer mosaic pattern from a white-balanced, gamma-corrected sRGB image, and introduce Gaussian noise with random variance. We train a copy of our model on these synthetic sensor data (“Ours-syn-raw") and test on real sensor data that is white-balanced and gamma-corrected.

Results
=======

Quantitative Evaluation
-----------------------

To quantitatively evaluate the presented approach, we use the standard SSIM and PSNR metrics, as well as the recently proposed learned perceptual metric LPIPS [@zhang2018unreasonable], which measures perceptual image similarity using a pretrained deep network. Although there is mild misalignment in the input-output image pairs in SR-RAW (see Section \[sec:dataset\]), this misalignment exists across all methods and thus the comparisons are fair.

The results are reported in Table \[table:quant\]. They indicate that existing super-resolution models do not perform well on real low-resolution images that require digital zoom in practice. These models are trained under a synthetic setting where input images (usually downsampled) are clean and only contain 8-bit signal. GAN-based methods often generate noisy artifacts and lead to low PSNR and SSIM scores. Bicubic upsampling and SRResnet produce blurry results and get a low score in LPIPS. Our model, trained on high-bit real raw data and supervised by optically zoomed images, can effectively recover high-fidelity visual information with 4X and 8X computational zoom.

In Table \[table:quant\_control\], we show evaluations on our model trained with two different strategies. “Ours-png" is our model trained on processed RGB images. By accessing real low-resolution data taken by a short focal length, the model learns to better handle noise, but its super-resolution power is limited by the low-bit image source. “Ours-syn-raw" is our model trained on synthetic Bayer images. While the model gets access to raw sensor data during test time, it is limited by the domain gap between synthetic and real sensor data. We illustrate in Figure \[fig:sensor\] that a range of real sensor features are not reflected in a synthetic sensor model. Anti-aliasing filter (AA filter) exists in selected camera models. Synthetic sensor data is generated from 8-bit images while real sensor data contains high-bit signals. Inter-sensor crosstalk and sensor fill factor introduce noise into the color filter array and can be hardly parameterized by a simple noise model [@yamashita2018intercolor]. The synthetic sensor model is insufficient to represent these complicated noise patterns.

                                                     **4X**                                                **8X**      
  ---------------------------- ---------------- ---------------- ------------------- ---------------- ---------------- -------------------
                                SSIM$\uparrow$   PSNR$\uparrow$   LPIPS$\downarrow$   SSIM$\uparrow$   PSNR$\uparrow$   LPIPS$\downarrow$
  Bicubic                           0.615            20.15              0.344             0.488            14.71              0.525
  SRGAN [@ledig2017photo]           0.384            20.31              0.260             0.393            19.23              0.395
  SRResnet [@ledig2017photo]        0.683            23.13              0.364             0.633            19.48              0.416
  LapSRN [@Lai2017]                 0.632            21.01              0.324             0.539            17.55              0.525
  Johnson . [@Johnson2016]          0.354            18.83              0.270             0.421            18.18              0.394
  ESRGAN [@wang2018esrgan]          0.603            22.12              0.311             0.662            20.68              0.416
  Ours                          [**0.781**]{}    [**26.88**]{}      [**0.190**]{}     [**0.779**]{}    [**24.73**]{}      [**0.311**]{}

                                       **4X**                                                **8X**      
  -------------- ---------------- ---------------- ------------------- ---------------- ---------------- -------------------
                  SSIM$\uparrow$   PSNR$\uparrow$   LPIPS$\downarrow$   SSIM$\uparrow$   PSNR$\uparrow$   LPIPS$\downarrow$
  Ours-png            0.589            22.34              0.305             0.638            21.21              0.584
  Ours-syn-raw      [0.677]{}        [23.98]{}          [0.231]{}         [0.643]{}        [22.02]{}          [0.473]{}
  Ours            [**0.781**]{}    [**26.88**]{}      [**0.190**]{}     [**0.779**]{}    [**24.73**]{}      [**0.311**]{}

Qualitative Results
-------------------

We show qualitative comparisons in Figure \[fig:results\_rgb\] against baseline methods, and in Figure \[fig:results\_raw\] against our model variants trained with different data. Most input images contain objects that are far from the viewpoint and require computational zoom in practice. Ground truth is obtained using a zoom lens with 4X optical zoom. In Figure \[fig:results\_rgb\], baseline methods fail to separate contents from the noise; it appears that their performance is limited by only having access to 8-bit signals in color images, especially in “Stripe", which contains high-frequency details. Text in “Parking" appear noisy in all baseline results, while our model generates a clean and discernible output image. In Figure \[fig:results\_raw\], the model trained on synthetic sensor data produces jagged edges in “Mario" and “Poster," and demosaic color artifacts in “Pattern." Our model, trained on real sensor data with SR-RAW, can generate a clean demosaiced image with high image fidelity.

  ------------------------------------------------------------------- -------------------------------------------------------------------- ------------------------------------------------------------------- -------------------------------------------------------------------- ----------------------------------------------------------------- ------------------------------------------------------------------
   ![image](figures/parking-input.jpg){width="3.5cm" height="3.6cm"}   ![image](figures/parking-percep.jpg){width="2.3cm" height="3.6cm"}   ![image](figures/parking-srres.jpg){width="2.3cm" height="3.6cm"}   ![image](figures/parking-esrgan.jpg){width="2.3cm" height="3.6cm"}   ![image](figures/parking-lap.jpg){width="2.3cm" height="3.6cm"}   ![image](figures/parking-ours.jpg){width="2.3cm" height="3.6cm"}
   ![image](figures/stripe-input.jpg){width="3.5cm" height="3.8cm"}    ![image](figures/stripe-percep.jpg){width="2.3cm" height="3.8cm"}    ![image](figures/stripe-srres.jpg){width="2.3cm" height="3.8cm"}    ![image](figures/stripe-esrgan.jpg){width="2.3cm" height="3.8cm"}    ![image](figures/stripe-lap.jpg){width="2.3cm" height="3.8cm"}    ![image](figures/stripe-ours.jpg){width="2.3cm" height="3.8cm"}
                               Input GT                                                     Johnson . [@Johnson2016]                                           SRResnet [@ledig2017photo]                                            ESRGAN [@wang2018esrgan]                                               LapSRN [@Lai2017]                                                        Ours
  ------------------------------------------------------------------- -------------------------------------------------------------------- ------------------------------------------------------------------- -------------------------------------------------------------------- ----------------------------------------------------------------- ------------------------------------------------------------------

  ------------------------------------------------------------------- --------------------------------------------------------------------- ----------------------------------------------------------------- ------------------------------------------------------------------ ----------------------------------------------------------------
    ![image](figures/mario-input.jpg){width="4.5cm" height="3.3cm"}     ![image](figures/mario-bicubic.jpg){width="2.8cm" height="3.3cm"}     ![image](figures/mario-syn.jpg){width="2.8cm" height="3.3cm"}     ![image](figures/mario-ours.jpg){width="2.8cm" height="3.3cm"}     ![image](figures/mario-gt.jpg){width="2.8cm" height="3.3cm"}
   ![image](figures/pattern-input.jpg){width="4.5cm" height="3.3cm"}   ![image](figures/pattern-bicubic.jpg){width="2.8cm" height="3.3cm"}   ![image](figures/pattern-syn.jpg){width="2.8cm" height="3.3cm"}   ![image](figures/pattern-ours.jpg){width="2.8cm" height="3.3cm"}   ![image](figures/pattern-gt.jpg){width="2.8cm" height="3.3cm"}
   ![image](figures/poster-input.jpg){width="4.5cm" height="3.3cm"}    ![image](figures/poster-bicubic.jpg){width="2.8cm" height="3.3cm"}    ![image](figures/poster-syn.jpg){width="2.8cm" height="3.3cm"}    ![image](figures/poster-ours.jpg){width="2.8cm" height="3.3cm"}    ![image](figures/poster-gt.jpg){width="2.8cm" height="3.3cm"}
                                 Input                                                               Bicubic                                                        Synthetic sensor                                                         Ours                                                               GT
  ------------------------------------------------------------------- --------------------------------------------------------------------- ----------------------------------------------------------------- ------------------------------------------------------------------ ----------------------------------------------------------------

Perceptual Experiments {#subsec:percep}
----------------------

We also evaluate the perceptual quality of our generated images by conducting a perceptual experiment on Amazon Mechanical Turk. In each task, we compare our model against a baseline on 100 4X-zoomed images (50 test images from SR-RAW and additional 50 images taken without ground truth). We conduct blind randomized A/B testing against LapSRN, Johnson ., ESRGAN, and our model trained on synthetic sensor data. We show the participants both results side by side, in random left-right order. The original low-resolution image is also presented for reference. We ask the question: “A and B are two versions of the high-resolution image of the given low-resolution image. Which image (A or B) has better image quality?" In total, 50 workers participated in the experiment. The results, listed in Table \[tab:user\_study\], indicate that our model produces images that are seen as more realistic in a significant majority of blind pairwise comparisons.

                                     Preference rate
  --------------------------------- -----------------
  Ours$>$Syn-raw                          80.6%
  Ours$>$ESRGAN [@wang2018esrgan]         83.4%
  Ours$>$LapSRN [@Lai2017]                88.5%
  Ours$>$Johnson . [@Johnson2016]         92.1%

  : Perceptual experiments show that our results are strongly preferred over baseline methods.[]{data-label="tab:user_study"}

Generalization to Other Sensors
-------------------------------

Different image sensors have different structural noise patterns in their Bayer mosaics (See Figure \[fig:sensor\]). Our model, trained on one type of Bayer mosaic, may not perform as well when applied to a Bayer mosaic from another device (iPhoneX). To explore the potential of generalization to other sensors, we capture 50 additional iPhoneX-DSLR data pairs in outdoor environments. We fine-tune our model with only 5000 iterations to adapt our model to the iPhoneX sensor. A qualitative result is shown in Figure \[fig:iphone\] and more results can be found in the supplement. The results indicate that our pretrained model can be generalized to another sensor by fine-tuning the model on a small dataset captured with that sensor, and also indicate that input-output data pairs can come from different devices, suggesting the application of our method to devices with limited optical zoom power.

  --------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   \[9mm\]   \[10mm\][![Our model can adapt to input data from a different sensor after fine-tuning on a small dataset.[]{data-label="fig:iphone"}](figures/smartphone-input2.jpg "fig:"){width="0.43\linewidth"}]{}      ![Our model can adapt to input data from a different sensor after fine-tuning on a small dataset.[]{data-label="fig:iphone"}](figures/smartphone-bicubic2.jpg "fig:"){width="0.43\linewidth"}
                                                                                                                                                                                                                           ![Our model can adapt to input data from a different sensor after fine-tuning on a small dataset.[]{data-label="fig:iphone"}](figures/smartphone-ours2.jpg "fig:"){width="0.43\linewidth"}
  --------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Conclusion
==========

We have demonstrated the effectiveness of using real raw sensor data for computational zoom. Images are directly super-resolved from raw sensor data via a learned deep model that performs joint ISP and super-resolution. Our approach absorbs useful signal from the raw data and produces higher-fidelity results than models trained on processed RGB images or synthetic sensor data. To enable training with real sensor data, we collect a new dataset that contains optically-zoomed images as ground truth and introduce a novel contextual bilateral loss that is robust to mild misalignment in training data pairs. Our results suggest that learned models could be integrated into cameras for high-quality digital zoom. Our work also indicates that preserving signal from raw sensor data may be beneficial for other image processing tasks.

[^1]: Project website at: <https://ceciliavision.github.io/project-pages/project-zoom.html>
