Source-linked AI summary

ST-GAN: Spatial Transformer Generative Adversarial Networks for Image Compositing

Chen-Hsuan Lin, Ersin Yumer, Oliver Wang, Eli Shechtman, Simon Lucey

arXiv:1803.01837v1cs.CVcs.LG

TL;DR

The paper asks how to make foreground objects appear geometrically natural when composited into backgrounds, addressing limitations of direct image generation. It proposes ST-GAN, which adversarially learns iterative spatial transformations in low-dimensional warp-parameter space. The method improves composite realism across indoor-object and portrait-accessory applications, including fully unpaired data, while remaining subject to data-imbalance and extreme-motion limitations.

  • Problem

    Direct image generation is limited by high-dimensional image spaces and finite network capacity, motivating realistic geometric correction for foreground objects composited into background images.

  • Method

    ST-GAN integrates Spatial Transformer Networks with GANs so generators predict iterative low-dimensional warp updates and discriminators assess warped foreground-background composites.

  • Results

    ST-GAN improves composite realism in indoor-object and fully unpaired portrait-accessory applications, with large-scale user-study evidence and reported applicability to high-resolution images.

  • Takeaways & Limitations

    Adversarial geometric warping provides a demonstrated approach for modeling geometric realism in image compositing without requiring ground-truth warp parameters.

  • Takeaways & Limitations

    ST-GAN is more vulnerable to imbalanced data and can fail to converge for more extreme object translations or in-plane rotations.

Abstract

from arXiv · show

We address the problem of finding realistic geometric corrections to a foreground object such that it appears natural when composited into a background image. To achieve this, we propose a novel Generative Adversarial Network (GAN) architecture that utilizes Spatial Transformer Networks (STNs) as the generator, which we call Spatial Transformer GANs (ST-GANs). ST-GANs seek image realism by operating in the geometric warp parameter space. In particular, we exploit an iterative STN warping scheme and propose a sequential training strategy that achieves better results compared to naive training of a single generator. One of the key advantages of ST-GAN is its applicability to high-resolution images indirectly since the predicted warp parameters are transferable between reference frames. We demonstrate our approach in two applications: (1) visualizing how indoor furniture (e.g. from product images) might be perceived in a room, (2) hallucinating how accessories like glasses would look when matched with real portraits.

1. Introduction

The paper targets realistic geometric correction for image compositing by replacing direct pixel generation with adversarially learned spatial warps. ST-GAN uses iterative STN transformations and sequential training, demonstrating improved realism across compositing settings and high-resolution applicability.

  • Direct image generation is limited by high-dimensional image spaces and finite network capacity, restricting strong performance to narrow domains or low resolutions.
  • ST-GAN integrates Spatial Transformer Networks into a GAN so the generator predicts low-dimensional geometric corrections rather than complete images.
  • Sequential adversarial training learns iterative spatial transformations that decompose large geometric corrections into smaller warps.
  • The method evaluates geometric compositing for indoor furniture in paired and unpaired settings and glasses on real portraits in a fully unpaired setting.
  • A large-scale user study shows that ST-GAN improves the realism of image composites, while the approach also applies indirectly to high-resolution images.

2. Related Work

Related work spans appearance correction, learnable geometric warping, and adversarial image generation. ST-GAN combines these directions for conditional image compositing by adversarially training spatial transformations on given inputs.

  • Image compositing overlays a masked foreground image onto a background, with realism affected by appearance and geometric differences between scenes.
  • Prior compositing methods automate appearance corrections, whereas this work focuses on geometric inconsistencies between source and target images.
  • Spatial Transformer Networks predict warp parameters with a subnetwork and apply the resulting transformation through a differentiable warp function.
  • Iterative alignment work motivates the use of separate generators at successive warping steps with sequential training rather than recurrence in one prediction network.
  • Unlike conventional GANs that generate images, ST-GAN predicts warp parameters and discriminates composites formed from warped foregrounds and backgrounds.

3. Approach

ST-GAN corrects geometric inconsistencies in image composites by iteratively predicting low-dimensional warp updates with STNs inside a GAN framework. Sequential adversarial training learns these updates progressively while constraining them to avoid trivial foreground-removal solutions.

  • 3. Approach: ST-GAN targets realistic composites by correcting the foreground camera perspective, position, and orientation relative to the background.The approach focuses on geometric inconsistencies rather than appearance corrections.
  • 3. Approach: The geometric prediction network conditions each correcting update on both foreground and background images to model their scene interaction.This conditioning uses object and scene geometry, relative camera position, and realistic layout information.
  • 3.1. Iterative Geometric Corrections: Iterative STNs decompose difficult large displacements into a series of warp updates composed into successive warp states.The iterative formulation preserves the original images from information loss caused by repeated warping operations.
  • 3.2. Sequential Adversarial Training: ST-GAN generates low-dimensional warp parameter updates, while its discriminator evaluates the warped foreground composited with the background.This design addresses multimodal realistic corrections without requiring direct supervision for warp parameters.
  • 3.2. Sequential Adversarial Training: Sequential training fixes earlier generators, trains only the new generator and discriminator at each stage, and finally fine-tunes the full network end-to-end.The authors report that this strategy makes training faster and more robust; the discriminator is shared across stages and continuously improved.
  • 3.3. Adversarial Objective: A trust-region penalty constrains each warp update because unconstrained ST-GAN training can remove the foreground by translating or shrinking it away.The discriminator otherwise could be satisfied by a realistic background-only composite.

4. Experiments

Experiments evaluate ST-GAN on synthetic geometric correction, indoor furniture compositing, and glasses alignment. Across these settings, iterative sequential warping improves realism, transfers to high-resolution images, and works with paired or unpaired data, while performance degrades for unusual or strongly rotated cases.

  • Experimental settings: The experiments use a homography-parameterized ST-GAN with low-resolution inputs, while predicted warp parameters can be applied to full-resolution images at test time.The generator receives foreground RGBA and background RGB channels and predicts an 8-dimensional homography update.
  • Synthetic cubes: On synthetic cubes, ST-GAN corrects scale and perspective distortions and sometimes discovers realistic placements different from the ground-truth location.The synthetic setup applies random translations and camera perturbations before rendering foreground/background pairs.
  • Indoor objects: Indoor-object training uses rendered scenes with occlusions removed, perturbed camera views, and mismatched-perspective foreground/background pairs.The dataset includes rendered candidate objects and camera viewpoints from SUNCG-based indoor scenes.
  • Indoor objects: AMT evaluations show ST-GAN substantially improves geometric realism over direct-supervision baselines, without requiring ground-truth warp parameters.Realism improves with sequential warps and end-to-end fine-tuning; HomographyNet improves less, while SDM yields no improvement.
  • Ablations: Iterative warp updates improve geometric realism more effectively than a non-iterative model, while sequentially trained iterative HomographyNet shows little visual improvement.The sequential strategy trains each generator while fixing previous generators, then fine-tunes the full network end-to-end.
  • High-resolution evaluation: Warp parameters predicted from low-resolution inputs transfer to high-resolution photographs, making ST-GAN indirectly applicable across image resolutions.The high-resolution evaluation uses photographic test images that were manually masked.
  • Glasses: For glasses, ST-GAN gradually improves realism and aligns glasses under some in-plane rotations, but performs worse with excessive out-of-plane rotation.The method also demonstrates applicability to unpaired images of people with and without glasses.

5. Conclusion

The conclusion presents ST-GANs as a framework for modeling geometric realism through image compositing. It reports improved realism on large-scale rendered data and results on fully unpaired real-world images, while identifying data imbalance and extreme transformations as limitations.

  • Conclusion: ST-GANs model geometric realism and improve image compositing realism on a large-scale rendered dataset and fully unpaired real-world image data.The paper positions these results as evidence of the method’s potential for geometric realism modeling.
  • Limitations: Imbalanced data, especially rare examples, harms ST-GAN performance, and convergence can fail under extreme translation or in-plane rotation.The authors identify convergence analysis with classical alignment methods and GAN frameworks as a direction for improving robustness.

A.1. Indoor Object Experiment: Rendering Details

The indoor-object experiment constructs candidate objects and clean compositing scenes from rendered indoor data. It removes occlusions, applies camera perturbations, and renders low-resolution color images and masks for training.

  • Candidate object selection: Candidate objects are rendered from camera viewpoints and separately masked by removing all other scene objects.Objects that are too small or only partially visible are excluded before selection.
  • Candidate object selection: Selected objects must be fully inside the camera view, occupy at least 10% of pixels, have at least 50% mask visibility, and belong to specified NYUv2 categories.The listed categories include refrigerators, desks, bookshelves, cabinets, beds, dressers, sofas, and chairs.
  • Occlusion removal: Occluding objects are detected through overlapping masks and removed iteratively to expose hidden occlusions.A dilated 3 × 3 mask applied ten times thickens the candidate mask by 10 pixels during removal.
  • Camera perturbation: Camera perturbations use random forward-backward and left-right translations plus random azimuth rotations, with invisible or partially visible renderings discarded.Translations are sampled from Unif(−1, 1), while azimuth rotations are sampled from Unif(−30, 30) degrees.
  • Rendering: Mitsuba renders 120 × 160 realistic textures, while OpenGL renders 240 × 320 masks that are downscaled by two for anti-aliasing.The rendering setup combines photorealistic textures with object masks.

A.2. Warp Parameterization Details

The method represents homographies through an sl(3) Lie-algebra warp vector and the matrix exponential, making warp composition additive in parameter space.

  • A warp parameter vector p in sl(3) maps to a homography H in SL(3) through the exponential map.
  • Warp composition is represented as parameter addition: pa ◦ pb ≡ pa + pb for pa, pb ∈ sl(3).
  • The resulting homography has determinant 1, and the all-zero parameter vector represents the identity transformation.
  • The matrix exponential is approximated with a Taylor expansion using K = 20.

A.3. Training Details

Training uses Adam with shared initialization conventions, while experiment-specific procedures vary across synthetic cubes, indoor objects, and glasses.

  • All experiments use batch size 20, Gaussian weight initialization with standard deviation 0.01, zero biases, Adam optimization, and λgrad = 10.
  • 3D cubes: The 3D-cube experiment uses four sequential warps for 50K iterations each, with initial homography perturbations sampled from N(0, 0.1I).
  • Indoor objects: Indoor-object baselines use on-the-fly perturbations for HomographyNet and 750K perturbed examples per SDM regressor, while ST-GAN generators are initialized from pretrained HomographyNet.
  • Indoor objects: Indoor-object adversarial training runs each generator for 40K iterations, followed by 40K end-to-end fine-tuning; the non-sequential baseline runs for 160K iterations.
  • Glasses: Glasses training augments faces with random similarity transformations and perturbs glasses using the 3D-cube homography noise model.
  • ST-GAN training uses five sequential warps for 50K iterations each, preceded by 50K discriminator pretraining, with both learning rates set to 10^-5.

A.4. Additional Indoor Object Results

On the indoor-object test set, ST-GAN generally produces more realistic geometric corrections than the evaluated baselines.

  • ST-GAN consistently predicts more realistic geometric corrections than the baselines in most indoor-object test cases.

A.5. Additional Glasses Results

Additional glasses results show ST-GAN matching foreground glasses to background faces despite unpaired training data without placement annotations.

  • The glasses experiment uses unpaired data with no dataset information about where the glasses are placed.
  • Despite the lack of placement information, ST-GAN consistently matches the initial glasses foreground to the background faces.
  • Figure 13 compares initial composites in the top row with ST-GAN outputs in the bottom row.
  • Figure 13 provides additional qualitative glasses results from the test set.
Loading 1803.01837v1…