One-Shot Synthesis of Images and Segmentation Masks

Vadim Sushko, Dan Zhang, Juergen Gall, Anna Khoreva

TL;DR

OSMIS (One-Shot Mask-Image Synthesis) is a novel GAN framework that generates diverse new images and their corresponding segmentation masks from just a single labeled training pair. Unlike previous approaches, it requires zero pre-training on large datasets, overcoming the "memorization" trap of one-shot learning by using a masked attention mechanism in the discriminator.

What Problem Does This Paper Address?

Training deep networks for image segmentation requires massive amounts of pixel-level annotations, which are incredibly expensive to produce (sometimes taking over 30 minutes per image). While Generative Adversarial Networks (GANs) can be used to "synthesize" labeled data, existing models like DatasetGAN or SemanticGAN have a major catch: they require extensive pre-training on thousands of images from the same domain (e.g., faces or cars) before they can learn to generate masks from a few examples.

In many real-world scenarios—like identifying rare medical conditions or specific industrial defects—large datasets simply don't exist. The authors tackle the "one-shot" challenge: Can we train a model from scratch using only one image and its mask to generate an infinite variety of new, labeled training examples?

Methods

The authors introduce OSMIS, building upon the architecture of "One-Shot GAN." The framework introduces two critical modifications:

  1. Mask Synthesis Branch (Generator): The generator is modified to produce both an image and an $N$-channel probability map (the mask) simultaneously. To handle the non-differentiable nature of picking the "best" class for each pixel (the argmax operation), they use a straight-through gradient estimator. This allows the model to backpropagate errors from the discriminator through discrete mask predictions.
  2. Masked Content Attention (MCA) (Discriminator): This is the core innovation. Standard discriminators look at the whole image, which leads to "memorization" (the GAN just recreates the training image exactly). The MCA module uses the segmentation mask to "crop" features of individual objects. The discriminator then judges the realism of these objects separately.

By forcing the discriminator to look at objects in isolation, the generator is incentivized to create realistic objects that can be moved around and rearranged, rather than just memorizing a static global scene.

Datasets

The researchers evaluated OSMIS on two primary benchmarks:

  • DAVIS-17: A video object segmentation dataset. They treated the first frame of each video (30 total) as a standalone one-shot training pair.
  • COCO: Used to demonstrate the model's versatility across indoor and outdoor scenes with varying annotation styles (class-wise vs. instance-wise).

Key Insights and Ideas

  • Breaking the Memorization Cycle: In one-shot GANs, the discriminator usually "wins" too easily by memorizing the single training image. By using the MCA module, the authors effectively turn one image into a "dataset" of individual objects, making the discriminator's job harder and forcing the generator to be more creative with layouts.
  • Implicit Alignment: Because the discriminator evaluates masked features, the generator must align the correct pixels with the correct mask channels to fool the discriminator. There is no need for an explicit alignment loss; it emerges naturally from the adversarial game.
  • The Downsampling Trade-off: The authors found a "Goldilocks zone" for discriminator downsampling. Too much downsampling helps global image quality but loses fine-grained mask details (like a bird's thin legs). They settled on a specific depth ($N_{low-level} = 4$) as the best compromise.

Key Results

  • Superior Diversity: OSMIS significantly outperformed previous single-image GANs (like SinGAN) in diversity. It achieved an LPIPS score of 0.387 (higher is more diverse) compared to SinGAN’s 0.267.
  • High-Fidelity Masks: In terms of mask alignment, OSMIS reached an mIoU of 86.6 on DAVIS-17, dwarfing SemanticGAN’s 65.8 when trained in the same one-shot regime.
  • Effective Data Augmentation: When used to augment training for state-of-the-art segmentation models (like OSVOS or STM), OSMIS-generated data provided consistent performance boosts. For example, it improved OSVOS's performance on DAVIS-16 from 78.5 to 79.8 (J&F score), proving that "fake" data from a single image can actually help train better real-world models.

Limitations and Future Work

  • Fine Details: The model still struggles with extremely thin or small objects due to the downsampling required by the discriminator's architecture.
  • Stochastic Failures: Like many GANs, OSMIS can occasionally produce "garbage" samples. The authors currently mitigate this by filtering out the bottom 15% of generated images based on a quality metric (SIFID).
  • Static Poses: While the model is excellent at changing the layout and background of a scene, it doesn't yet learn to significantly change the pose of an object (e.g., making a sitting dog stand) because it only has one reference pose to learn from.

Future work could involve incorporating structural priors to allow for more complex object deformations and pose changes from a single example.

Summary updated

BibTeX
@inproceedings{sushko2023one,
  author = {Vadim Sushko and Dan Zhang and Juergen Gall and Anna Khoreva},
  title = {{One-Shot Synthesis of Images and Segmentation Masks}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2023},
  doi = {10.1109/wacv56688.2023.00622},
}
Figure