HyperAIHyperAI

Command Palette

Search for a command to run...

ST-GAN: 이미지 합성을 위한 Spatial Transformer Generative Adversarial Networks

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

공간 변환 네트워크

노트북으로 이동

초록

우리는 배경 이미지에 합성했을 때 자연스러워 보이도록 전경 객체에 대한 현실적인 기하학적 보정을 찾는 문제를 다룹니다. 이를 위해 우리는 생성자(Generator)로 Spatial Transformer Networks(STNs)를 활용하는 새로운 Generative Adversarial Network(GAN) 아키텍처를 제안하며, 이를 Spatial Transformer GANs(ST-GANs)라고 명명합니다. ST-GANs는 기하학적 왜곡 파라미터 공간에서 연산을 수행함으로써 이미지의 현실감을 향상시킵니다. 특히, 우리는 반복형 STN 왜곡 방식을 활용하고, 단일 생성자의 단순한 학습 방식보다 더 우수한 성능을 달성하는 순차적 학습 전략을 제안합니다. ST-GAN의 주요 장점 중 하나는 예측된 왜곡 파라미터가 기준 프레임 간에 이동 가능하므로, 간접적으로 고해상도 이미지에 적용할 수 있다는 점입니다. 우리는 제안된 접근법을 두 가지 응용 분야에 적용하여 검증했습니다: (1) 제품 이미지 등에서 가져온 실내 가구들이 실제 방 안에서 어떻게 인식될 수 있는지 시각화, (2) 안경과 같은 액세서리가 실제 초상화와 어우러졌을 때의 모습을 환상적(Hallucinating)으로 생성.

One-sentence Summary

ST-GAN is a generative adversarial network that employs Spatial Transformer Networks as generators to compute realistic geometric warp parameters for foreground-background compositing, and by optimizing transformations directly in parameter space through an iterative warping scheme and sequential training strategy, it outperforms naive single-generator baselines while enabling high-resolution applications such as indoor furniture visualization and accessory try-on.

Key Contributions

  • This work introduces Spatial Transformer GANs (ST-GANs), a framework that integrates Spatial Transformer Networks with adversarial learning to compute realistic geometric corrections for foreground objects in image compositing. By operating in a low-dimensional warp parameter space, the architecture generates transformations that align inserted objects with background scenes.
  • A sequential adversarial training strategy decomposes large spatial transformations into iterative warping steps to stabilize the generator-discriminator minimax game. This multi-stage approach improves the convergence and precision of geometric adjustments compared to naive single-generator training.
  • The framework is evaluated on paired synthetic datasets for indoor furniture placement and unpaired real-world data for portrait accessory insertion. Large-scale user studies confirm improved visual realism, while transferable warp parameters enable effective application to high-resolution images.

Introduction

Generative adversarial networks have advanced realistic image synthesis, yet direct pixel-level generation remains constrained by high-dimensional data spaces and finite network capacity. These models frequently struggle with geometric discrepancies, making them unreliable for practical applications like image compositing where source objects must seamlessly blend into new environments. To overcome these limitations, the authors leverage Spatial Transformer Networks within a GAN framework to introduce ST-GANs, a novel architecture that generates realistic outputs by learning iterative geometric warps instead of direct pixel predictions. By employing a sequential adversarial training strategy, the model progressively corrects spatial transformations to align composite images with the natural image manifold, delivering substantially improved realism across both paired and unpaired compositing tasks.

Method

The authors propose a novel Generative Adversarial Network (GAN) architecture, termed Spatial Transformer GANs (ST-GANs), designed to address realistic geometric corrections for image compositing. The framework operates by learning to adjust the geometric parameters of a foreground object so that it appears natural when composited into a given background image. The core of the model leverages Spatial Transformer Networks (STNs) as its generator, enabling differentiable image warping conditioned on both foreground and background inputs. This allows the network to predict geometric corrections that account for the complex interactions between the object and its intended scene, including perspective, position, and orientation.

Refer to the framework diagram for an overview of the overall process. The composite image is formed by overlaying the foreground object, masked and warped according to a set of parameters p\mathbf{p}p, onto the background image. The model's objective is to find a sequence of geometric warp updates that transforms the initial composite into one that lies within the natural image manifold. The geometric warp function is restricted to homography transformations, which are parameterized using the sl(3)\mathfrak{sl}(3)sl(3) Lie algebra. This parameterization enables the composition of warp parameters through simple addition, which is a key property for the iterative process.

As shown in the figure below, the model employs an iterative approach to predict a series of incremental warp updates. At each iteration iii, a geometric prediction network Gi\mathcal{G}_iGi takes the warped foreground image IFG(pi1)I_{\text{FG}}(\mathbf{p}_{i-1})IFG(pi1) and the background image IBGI_{\text{BG}}IBG as inputs to predict a correction Δpi\Delta\mathbf{p}_iΔpi. The new warp state pi\mathbf{p}_ipi is then obtained by composing the previous state pi1\mathbf{p}_{i-1}pi1 with the update Δpi\Delta\mathbf{p}_iΔpi. This iterative refinement allows the model to learn complex geometric transformations by breaking them down into smaller, more manageable steps.

To train the network, the authors integrate the iterative STN into a GAN framework. The generator Gi\mathcal{G}_iGi produces a low-dimensional warp parameter update rather than a full image, while the discriminator D\mathcal{D}D evaluates the realism of the resulting composite image. A key innovation is the sequential adversarial training strategy. The training begins with a single generator G1\mathcal{G}_1G1, and subsequent generators Gi\mathcal{G}_iGi are added one at a time. During the training of each new generator Gi\mathcal{G}_iGi, the weights of all previously trained generators are fixed. The same discriminator D\mathcal{D}D is used across all stages, continuously learning to distinguish between real and fake composites. This approach ensures that each generator learns to produce a meaningful correction, building upon the work of the previous stages, which leads to faster and more robust training.

The adversarial objective is based on the Wasserstein GAN (WGAN) formulation, which provides more stable training compared to traditional GANs. The loss function for the discriminator includes a gradient penalty term to enforce the 1-Lipschitz constraint. To prevent trivial solutions where the foreground object is simply removed, a penalty term on the magnitude of the warp update Δpi\Delta\mathbf{p}_iΔpi is introduced, constraining it to a trust region. During sequential training, the discriminator and the current generator Gi\mathcal{G}_iGi are updated alternately. After all generators are trained, the entire network is fine-tuned end-to-end to optimize the final composite image.

The generator Gi\mathcal{G}_iGi is implemented as a convolutional neural network with an architecture of C(32)-C(64)-C(128)-C(256)-C(512)-L(256)-L(8), where C(k) denotes a 2D convolutional layer with k filters and L(k) denotes a fully-connected layer with k output nodes. The input to Gi\mathcal{G}_iGi consists of the foreground and background images, resulting in a 7-channel input. The discriminator D\mathcal{D}D uses a PatchGAN architecture, which classifies local image patches for realism. The model is trained on images resized to 120×160120 \times 160120×160, but the learned warp parameters are transferable to full-resolution images at test time, enabling the application of the method to high-resolution compositing tasks.

Experiment

The first experiment evaluates the model by perturbing rendered 3D cubes with random homographies and training against their original ground truth, validating its capacity to correct geometric distortions while capturing a multi-modal distribution of realistic placements. The second experiment operates in an entirely unpaired setting using facial images and hand-crafted glasses, testing the system's ability to gradually warp composites into natural positions without relying on structural annotations. Qualitatively, the method successfully aligns foreground elements under moderate transformations but struggles with extreme out-of-plane rotations, ultimately demonstrating strong potential for image alignment tasks where acquiring paired data is highly challenging.

The authors evaluate ST-GAN across various furniture categories, comparing its performance against baseline methods and different variants of ST-GAN. Results show that ST-GAN consistently improves over initial warps and achieves higher realism, with the end-to-end version generally outperforming sequential warping approaches. The method demonstrates robustness across categories, though performance varies, with some objects showing more significant improvements than others. ST-GAN outperforms baseline methods and achieves higher realism compared to initial warps across all categories. The end-to-end ST-GAN variant generally performs better than sequential warping versions, particularly on certain objects like the chair and dresser. Performance varies by object, with some categories showing substantial improvement while others exhibit more modest gains.

The authors present an experiment involving the compositing of glasses on human faces in an unpaired setting, where no ground-truth paired data is available. The method uses a spatial transformer network to gradually warp the glasses into realistic positions on faces, demonstrating the ability to align objects without explicit structural information. Results show that the approach performs well for faces with limited out-of-plane rotation but struggles with more extreme rotations. The method learns to warp glasses onto faces without paired data or facial landmarks. The approach successfully aligns glasses in a gradual manner, improving realism over multiple steps. Performance degrades for faces with significant out-of-plane rotation.

The evaluation examines ST-GAN across furniture categorization and an unpaired face-glasses compositing task to assess its ability to generate realistic spatial transformations without paired data or explicit landmarks. Results demonstrate that the end-to-end variant consistently enhances realism over initial warps and generally surpasses sequential warping approaches, though performance gains vary by object complexity. In the facial compositing experiment, the model successfully learns to gradually align objects through iterative warping, yet exhibits noticeable sensitivity to extreme out-of-plane rotations. Overall, the findings highlight the method's robust capacity for unpaired spatial alignment while underscoring its limitations under severe geometric distortions.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp