pathak22/context-encoder

[CVPR 2016] Unsupervised Feature Learning by Image Inpainting using GANs

What it solves

This project provides the training code for Context Encoders, a method that learns useful image features without labeled data. Instead of requiring human-annotated examples, it trains a neural network to fill in missing parts of images (inpainting). The learned features can then be reused for other vision tasks.

How it works

The code trains a convolutional neural network (adapted from a DCGAN implementation) using two losses: a reconstruction loss that measures how close the filled-in region is to the original, and an adversarial loss that makes the output look realistic. The repository includes a demo for center-region inpainting, scripts to train models for both center and random-region inpainting, and testing scripts. It also provides a pre-trained Caffe model for feature extraction and links to a TensorFlow implementation.

Who it’s for

Researchers and practitioners in computer vision who want to reproduce the CVPR 2016 paper, train their own inpainting models, or use the pre-trained features. It requires familiarity with Torch (Lua) and command-line usage.

Highlights

  • Demo with pre-trained models for Paris, ImageNet, and UC Berkeley images
  • Training code for both center-region and random-region inpainting
  • Joint reconstruction and adversarial loss training
  • Pre-trained Caffe model for feature extraction
  • Link to a TensorFlow implementation (though not full functionality)

Related

  • Project
  • Project
  • Project
  • Project