The Weizmann Institute of Science
Faculty of Mathematics and Computer Science
Computer Vision Lab


Drop The GAN: In Defense of Patch Nearest Neighbors as Single Image Generative Models
Accepted to CVPR 2022

Niv Granot, Ben Feinstein, Assaf Shocher, Shai Bagon, Michal Irani

[arxiv] [Code]


Abstract

Image manipulation dates back long before the deep learning era. The classical prevailing approaches were based on maximizing patch similarity between the input and generated output. Recently, single-image GANs were introduced as a superior and more sophisticated solution to image manipulation tasks. Moreover, they offered the opportunity not only to manipulate a given image, but also to generate a large and diverse set of different outputs from a single natural image. This gave rise to new tasks, which are considered "GAN-only". However, despite their impressiveness, single-image GANs require long training time (usually hours) for each image and each task and often suffer from visual artifacts. In this paper we revisit the classical patch-based methods, and show that – unlike previously believed – classical methods can be adapted to tackle these novel "GAN-only" tasks. Moreover, they do so better and faster than single-image GAN-based methods. More specifically, we show that: (i) by introducing slight modifications, classical patch-based methods are able to unconditionally generate diverse images based on a single natural image; (ii) the generated output visual quality exceeds that of single-image GANs by a large margin (confirmed both quantitatively and qualitatively); (iii) they are orders of magnitude faster (runtime reduced from hours to seconds).

Supplementary Material

1. Diverse image generation based on a single image
2. Conditional Inpainting
3. Structural Analogies
4. Retargeting
5. Collage
6. Editing
7. User-Study Images
8. Runtime and Memory
9. Implementation Details



1. Diverse Image Generation Based on a Single Image
Single Source Image
Input image
GPNN (Ours)
Randomly generated images
SinGAN [23]
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images
Input image
Randomly generated images
Randomly generated images

2. Conditional Inpainting
Source Image
Source Image



Source Image
Source Image



Source Image
Source Image



Source Image
Source Image



Source Image
Source Image



Source Image
Source Image



Source Image
Source Image



Source Image
Source Image




3. Analogies
Input A
Source Image
Input B
Source Image
A to B
A to B


B to A
B to A



Input A
Source Image
Input B
Source Image
A to B
A to B


B to A
B to A



Input A
Source Image
Input B
Source Image
A to B
A to B


B to A
B to A



Input A
Source Image
Input B
Source Image
A to B
A to B


B to A
B to A



Input A
Source Image
Input B
Source Image
A to B
A to B


B to A
B to A



Input A
Source Image
Input B
Source Image
A to B
A to B



Input A
Source Image
Input B
Source Image
A to B
A to B




4. Retargeting
Source
Source Image
GPNN (Ours)
GPNN (Ours)




Source
Source Image

GPNN (Ours)
GPNN (Ours)




Source
Source Image
GPNN (Ours)
GPNN (Ours)




Source
Source Image

Ours
Ours





Source
Source Image

Ours
Ours





Source
Source Image


GPNN (Ours)
GPNN (Ours)


Ours
Ours



Source
Source Image

GPNN (Ours)
GPNN (Ours)




Source
Source Image
Ours
Ours




5. Collage
Source Images
Source Image 1

Source Image 2
GPNN (Ours)
Source Image




Source Image 3

Source Images
Source Image 1

Source Image 2
GPNN (Ours)
Source Image




Source Image 3

Source Images
Source Image 1

Source Image 3
Source
Source Image




6. Editing
Source Image
Source Image
Edit
S




Source Image
Source Image
Edit
S





7. User-Study Images

8. Runtime and Memory

9. Implementation Details


Relevant references:
[2] Connelly Barnes, Eli Shechtman, Adam Finkelstein, and Dan B Goldman. PatchMatch: A Randomized Correspondence Algorithm for Structural Image Editing. ACM Trans. Graph.,28(3):24, 2009.
[3] Sagie Benaim, Ron Mokady, Amit Bermano, and L Wolf. Structural Analogy from a Single Image Pair. In Computer Graphics Forum. Wiley Online Library, 2020.
[23] Tamar Rott Shaham, Tali Dekel, and Tomer Michaeli. SinGAN: Learning a Generative Model from a Single Natural Image. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4570-4580, 2019.
[24] Assaf Shocher, Shai Bagon, Phillip Isola, and Michal Irani. InGAN: Capturing and Remapping the "DNA" of a Natural Image. In arXiv, 2019.
[26] Denis Simakov, Yaron Caspi, Eli Shechtman, and Michal Irani. Summarizing Visual Data Using Bidirectional Similarity. In 2008 IEEE Conference on Computer Vision and Pattern Recognition, pages 1-8. IEEE, 2008.