본문 바로가기

deep learning

[Style Trasfer]Instance normalization

Style Transfer에서 contrast의 중요성

stylized image의 contrast는 대부분 style image의 contrast에 의해 결정되며 content image contrast와 거의 독립적이라는 것을 아래 이미지에서 확인할 수 있다.

https://arxiv.org/abs/1607.08022

 

content image를 style image의 style로 변환할 때 styleization의 결과가 일반적으로 content image의 contrast에 의존해서는 안된다. stylized image의 contrast는 style iamge의 contrast와 비슷하기를 원하기 때문에 generator는 content image에서 contrast information을 제거해야한다.

아래 이미지에서 contrast normalization의 필요성을 확인할 수 있다.

https://arxiv.org/abs/1607.08022  typical stylization results when trained for a large number of iterations using fast stylization method from Ulyanov et al. (2016): with zero padding(left), with zero padding and instance normalization(right)

 

batch normalization vs instance normalization

contrast normalization을 위해 batch normalization을 사용할 수도 있다. 하지만 batch normalization을 사용했을 시 너무 많은 training examples는 적은 training examples를 사용할 때보다 결과의 품질이 낮을 수 있다. 각 image의 channel 값 분포가 다른 비율로 존재한다면 해당 image의 분포를 기준으로 normalization되지 않고 전체 batch의 분포로 normalization되기 때문에 network의 training의 난이도가 상승하기 때문이다. 전체 statistics를 일치시키기 어렵다

https://arxiv.org/abs/1701.02096

 

현재 소개하고 있는 contrast normalization는, batch normalization을 전체 batch가 아닌 개별 instance에서 작동하는 drop-in replacement로 사용하기 때문에 GAN에서 instance normalization라는 명칭으로 주로 사용한다.

 

아래 이미지를 통해 batch normalization과 instance normalization의 차이를 쉽게 이해할 수 있다. (https://becominghuman.ai/all-about-normalization-6ea79e70894b에서 발췌)

Batch Normalization

https://becominghuman.ai/all-about-normalization-6ea79e70894b

 

https://becominghuman.ai/all-about-normalization-6ea79e70894b

 

In “Batch Normalization”, mean and variance are calculated for each individual channel across all samples and both spatial dimensions.

Instance Normalization

https://becominghuman.ai/all-about-normalization-6ea79e70894b

 

https://becominghuman.ai/all-about-normalization-6ea79e70894b

 

In “Instance Normalization”, mean and variance are calculated for each individual channel for each individual sample across both spatial dimensions.

 

최근 style transfer에서 normalization 추세

"IN (instance normalization)은 image의 feature statics를 normalization하여 style variantion을 제거하는 효과가 있으며 스타일 전송헤서 BN (batch normalization) 또는 LN(layer normalization)보다 자주 사용된다. 그러나 image를 normalization 할 때 최근 연구에서는 IN만 사용하는 대신 adaptive instance normalization (AdaIN), conditional instance normalization, 및 batch instance normalization을 사용한다." (https://arxiv.org/abs/1907.10830에서 발췌)

 

요약

  1. stylization이 성공적으로 수행되기 위해서 generator는 content image에서 contrast information을 contrast normalization을 통해 제거해야한다.
  2. contrast normalization을 위해 batch normalization을 사용할 때 batch 단위로 normalization 수행 시 training의 난이도가 상승해 instance normalization을 사용한다.

 

참고자료

  • Ulyanov, Dmitry, Andrea Vedaldi, and Victor Lempitsky. "Improved texture networks: Maximizing quality and diversity in feed-forward stylization and texture synthesis." Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2017.
  • Kim, Junho, et al. "U-gat-it: unsupervised generative attentional networks with adaptive layer-instance normalization for image-to-image translation." arXiv preprint arXiv:1907.10830 (2019).
  • Ulyanov, Dmitry, Andrea Vedaldi, and Victor Lempitsky. "Instance normalization: The missing ingredient for fast stylization." arXiv preprint arXiv:1607.08022 (2016).
  • https://becominghuman.ai/all-about-normalization-6ea79e70894b

'deep learning' 카테고리의 다른 글

EfficientNet 리뷰  (0) 2021.02.19
Skip connection 정리  (2) 2021.02.02
[Chapter 2]starGAN 코드 레벨 분석  (0) 2021.01.28
[Chapter 1]starGAN 리뷰  (0) 2021.01.28
Anomaly detection  (0) 2021.01.22