pytorch_gan_context_encoder
A convolutional encoder-decoder that fills a missing image region from its surroundings, trained adversarially.
Diffusion and generative · 31 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 71.1M
- Operations
- 31
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2016
- Cited by
- 5,678 (as of 16 October 2026)
- Authors
- Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue and others
- License
- BSD-3-Clause
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m8435
- Graph hash
- 6217afe44a4249efa9d3baa07b578a5abe5596c025b2cd582881640be0c5bbcb
- Skeleton hash
- ef48b623e59443b46cf9e4d430821091dc0a3c8e988eab932d22a47717fc7c4e
- Architecture hash
- e452bfc4ddb98baa7367af36e82bd39f9a5ba588a3b6b21b441e900bbc73dc16
- Diagram SHA-256
- faa07e627b1e8bf2c7edf92e602e99c66f7a1a9e148ff794db29194f3a632725
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
Context Encoders are convolutional networks trained to generate the contents of an arbitrary image region from its surroundings, a task known as inpainting. To succeed, the network must understand the whole image and produce a plausible hypothesis for the missing part. The paper frames this as unsupervised feature learning, in the spirit of word2vec learning word representations by predicting a word from its context.
The architecture is a simple encoder-decoder pipeline. The encoder is derived from AlexNet. Encoder and decoder are joined by a channel-wise fully-connected layer, which lets each decoder unit reason about the entire image. The decoder is a series of five up-convolutional layers with ReLU activations. Training uses a pixel-wise reconstruction loss, optionally with an adversarial loss, and the adversarial version gives much sharper results. Only the generator, not the discriminator, is conditioned on the context.
For inpainting the authors resize images to 128 by 128 and train with the joint loss. The captured member is the generator from the PyTorch-GAN collection's context_encoder.py. That collection states that its architectures do not always mirror the papers and that it focuses on the core ideas rather than every layer configuration. The authors' own training code was adapted from an initial fork of Soumith's DCGAN implementation.
Key idea. Context Encoders turned inpainting into a pretext task for unsupervised feature learning, and showed that adding an adversarial loss to pixel-wise reconstruction produces much sharper fills.
- Context Encoders
- context encoder
- image inpainting
- feature learning by inpainting
- Pathak
- Efros
- PyTorch-GAN
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{pathak2016contextencodersfeaturelearning,
title={Context Encoders: Feature Learning by Inpainting},
author={Deepak Pathak and Philipp Krahenbuhl and Jeff Donahue and Trevor Darrell and Alexei A. Efros},
year={2016},
eprint={1604.07379},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1604.07379},
}