상세 컨텐츠

본문 제목

[논문 리뷰 스터디] Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks

심화 스터디/논문 리뷰 스터디

by 임채명 2023. 5. 4. 18:18

본문

작성자: 16기 임채명

 

Abstract

Image-to-image는 input 이미지와 output 이미지 사이의 mapping을 학습하는 것이 목표

하지만 대부분의 경우 paired training dataset 존재하지않음

 본 논문에서는 paired dataset 없이도 X도메인에서 Y도메인으로 이미지를 바꿀 수 있는 모델을 제안

Introduction

 

- GAN

- Pix2Pix

 

 

Pix2Pix

학습 과정에서 이미지 x 자체를 조건으로 입력받는 cGAN의 한 유형
- 픽셀들을 입력으로 받아 픽셀들을 예측한다는 의미

 

=> 학습 과정에서 paired input-output examples 필요 

-> 이러한 한계점을 보완한 것이 cycleGAN!

 

GAN의 구조를 활용하여 X를 Y로 만들어주는 mapping 학습

그러나 단순한 GAN 구조는 X와 Y를 의미있게 매칭시키지 못한다는 한계점을 지님

 

어떤 X가 입력값으로 오더라도 Y도메인에 해당하는 하나의 이미지만 제시할 수 있음

-> cycle consistent한 translation이 필요하다!

 

*cycle consistent 예시: if we translate a sentence from English to French, and then transate it back from French to English, we should arrive back at the original sentence

 

따라서 X를 Y에 mapping하는 G 외에 Y를 X에 mapping하는 F를 도입(두 개의 GAN 사용), 이떄 G와 F는 역함수 관계

G와 F를 동시에 학습시키는 동시에 이 둘을 활용한 cycle consistency loss를 추가

cycle consistency loss: $F(G(x))  \approx x, G(F(x))  \approx x$이 되도록함

 

Formulation

two mapping: $G: X \rightarrow Y, F: Y \rightarrow X$ (GAN에서 Generator 역할)

two discriminators: $D_{X}, D_{Y}$ (GAN에서 Discriminator역할)

 

 

loss는 크게 두개로 나뉜다

- 각각 X와 Y의 분포를 잘 학습하여 생성하는가와 관련된 adversarial loss (GAN loss라고 생각)

- G와 F가 학습한 mapping이 매칭되는지에 대한 cycle consistency loss

 

adversarial loss

G는 Y도메인 이미지들과 유사한 이미지 G(x)를 생성하려고 노력한다

이때 D_{Y}는 G(x)와 real sample인 y를 구분하려고 노력함

이는 $min_{G}max_{D_{Y}}\mathfrak{L}_{GAN}(G, D_{Y}, X, Y)$의 형태로도 표현 가능

F도 마찬가지로 $min_{F}max_{D_{X}}\mathfrak{L}_{GAN}(F, D_{X}, X, Y)$로 표현 가능

 

cycle consistency loss

adversarial loss만으로는 individual input $x_{i}$를 desired ouput $y_{i}$로 map해줄 것이라는 보장이 없다.

To reduce the space of possible mapping functions, cycle consistency loss 추가

 

Forward cycle consistency: $x \rightarrow G(x) \rightarrow F(G(x)) \approx x$가 되도록 함

Backward cycle consistency: $y \rightarrow F(y) \rightarrow G(F(y)) \approx y$가 되도록 함

*실험적으로 하나의 cycle은 불충분하다는 것을 밝혀냄

 

$F(G(x))$와 $x$, $G(F(y))$와 $y$ 간의  adversarial loss를 추가하는 방법도 실험해보았으나 위 형태의 loss를 사용했을 때 성능이 더 좋게 나타났다.

 

Implementation

Network Architecture

1. instance normalization: 평균과 표준편차는 batch와 channel과는 무관하게 각 데이터에 대해서만 normalization

- 이미지의 명암에 의존X

 2. discriminator로 patchGAN 사용. 즉 patch-level discriminator를 사용하여 파라미터 수를 줄이고 arbitrarily sized images를 input으로 받을 수 있도록 함

 

Training Details

1. $\mathfrak{L}_{GAN}$으로 negative log likelihood를  least squares loss로 대체 -> 안정적인 학습이 가능하고 더 높은 퀄리티의 이미지를 생성

 

2. 가장 최근에 생성한 이미지만으로 discriminator를 업데이트하는 것이 아니라 생성자가 이전에 만든 50개의 이미지를 저장하여 이를 모두 활용

 

*model oscillation: 판별자와 생성자가 서로를 속고 속이며 제자리를 맴돈다면 양쪽 모두 전역해로 수렴할 수 없게 됩니다. 이런 상황을 일컬어 모델이 진동(oscillation)한다고 합니다.

 

Evaluation


pytorch 코드: GitHub - junyanz/pytorch-CycleGAN-and-pix2pix: Image-to-Image Translation in PyTorch

 

GitHub - junyanz/pytorch-CycleGAN-and-pix2pix: Image-to-Image Translation in PyTorch

Image-to-Image Translation in PyTorch. Contribute to junyanz/pytorch-CycleGAN-and-pix2pix development by creating an account on GitHub.

github.com

참고 영상: https://www.youtube.com/watch?v=dr9Yf8EY4J4 

관련글 더보기

댓글 영역