πŸ‘¦ 내일배움캠프/TIL(Today I Learned)

TIL_220623_λ”₯λŸ¬λ‹

  • -

μœ ν™”μ œμž‘ ν”„λ‘œμ νŠΈ

Style transfer = μ—…λ‘œλ“œν•œ 사진을 μœ ν™”μ²˜λŸΌ λ³€ν™˜ν•΄μ€€λ‹€.

 

012

μ‚¬μš© 방법

git μ°Έκ³  : https://github.com/crowsonkb/style-transfer-pytorch

 

GitHub - crowsonkb/style-transfer-pytorch: Neural style transfer in PyTorch.

Neural style transfer in PyTorch. Contribute to crowsonkb/style-transfer-pytorch development by creating an account on GitHub.

github.com

  1. κ°€μƒν™˜κ²½ μ„€μ • ν›„ [ pip install -e . ] μ„€μΉ˜
  2. style_transfer_pytorch.egg-info 경둜 μ„€μ •
    • $ cd ~/code/deep_learning/style_transfer_pytorch.egg-info
  3. style_transfer main.jpg backgraound.jpg
    • style_transfer CONTENT_IMAGE STYLE_IMAGE [STYLE_IMAGE ...] [-o OUTPUT_IMAGE]
  4. iterations: int = 500, 500번 λŒμ•„μ„œ 아웃풋 좜λ ₯(쑰정에 따라 퀄리티 μ‘°μ • 퀄리티와 μ‹œκ°„ λΉ„λ‘€)
    • 쑰건이 ν•„μš”ν•  λ“― ν•˜λ‹€.
      • 사진 μš©λŸ‰μ— λŒ€ν•œ μ œν•œ
      • ν™•μž₯자 지정 μ•ˆλ‚΄

 

Q. μ„œλΉ„μŠ€ ν•˜λ €λ©΄ μ–΄λŠμ •λ„ μ‹œκ°„μ— 결과물을 λ³΄μ—¬μ€˜μ•Ό ν•˜λ‚˜μš”?

- λ‘œλ”©μ΄ λ˜λŠ” μ‹œκ°„ λ™μ•ˆ λ‹€λ₯Έ μ˜μƒμ„ ν‹€μ–΄μ£ΌλŠ” λ“±μ˜ μ„œλΉ„μŠ€ μ œκ³΅ν•˜λŠ”κ²Œ 쒋을 λ“―

 

HOW? μ–΄λ–»κ²Œ 압좕이 λ˜λŠ”κ°€?

  1. 볡원 과정은 μ—¬λŸ¬λ²ˆμ˜ μͺΌκ°œλŠ” 과정을 톡해 μœ μ‚¬ν•œ λ ˆμ΄μ•„μ›ƒμ„ κ΅¬λΆ„ν•œλ‹€.
  2. 볡원 κ³Όμ •μ—μ„œ μŠ€νƒ€μΌμ„ μž…νžŒλ‹€κ³  보면 λœλ‹€

 


 

λ”₯λŸ¬λ‹ λ‹€λ₯Έ μ’…λ₯˜

λ”₯페이크

git : https://github.com/AliaksandrSiarohin/first-order-model

 

GitHub - AliaksandrSiarohin/first-order-model: This repository contains the source code for the paper First Order Motion Model f

This repository contains the source code for the paper First Order Motion Model for Image Animation - GitHub - AliaksandrSiarohin/first-order-model: This repository contains the source code for th...

github.com

 

SEFA

git : https://github.com/genforce/sefa

 

GitHub - genforce/sefa: [CVPR 2021] Closed-Form Factorization of Latent Semantics in GANs

[CVPR 2021] Closed-Form Factorization of Latent Semantics in GANs - GitHub - genforce/sefa: [CVPR 2021] Closed-Form Factorization of Latent Semantics in GANs

github.com

더보기

sefa-gan μ‚¬μš©λ°©λ²•

1. checkpoints 폴더 μ•ˆμ— λͺ¨λΈ μ €μž₯

[λͺ¨λΈ λ‹€μš΄λ‘œλ“œ νŽ˜μ΄μ§€]
https://github.com/genforce/genforce/blob/master/MODEL_ZOO.md

 

[ν‚€μ›Œλ“œ]

car512, anime

 

[λ‹€μš΄λ‘œλ“œν•œ νŒŒμΌ]

stylegan_animeface512.pth

 

2.λͺ¨λΈ μ„ΈνŒ…

MODEL_NAME=stylegan_animeface512
LAYER_IDX=0-1
NUM_SAMPLES=5
NUM_SEMANTICS=5
python sefa.py ${MODEL_NAME} \
    -L ${LAYER_IDX} \
    -N ${NUM_SAMPLES} \
    -K ${NUM_SEMANTICS}

3. pip install

[streamlit 버전 μΆ©λŒμ‹œ]
pip uninstall streamlit

[정상버전]
1. pip install streamlit==1.3.1
2. pip install opencv-python
3. pip install torch==1.9.0+cu111 (λ²„μ „μ˜€λ₯˜) torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

[이걸둜 μ§„ν–‰]
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

pip install torch==1.11.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchvision==0.10.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

4. μ‹€ν–‰
CUDA_VISIBLE_DEVICES=0 streamlit run interface.py

 

Simple StyleGan2 for Pytorch

git : https://github.com/lucidrains/stylegan2-pytorch

 

GitHub - lucidrains/stylegan2-pytorch: Simplest working implementation of Stylegan2, state of the art generative adversarial net

Simplest working implementation of Stylegan2, state of the art generative adversarial network, in Pytorch. Enabling everyone to experience disentanglement - GitHub - lucidrains/stylegan2-pytorch: S...

github.com

 

pix2pix

git : https://github.com/phillipi/pix2pix

 

GitHub - phillipi/pix2pix: Image-to-image translation with conditional adversarial nets

Image-to-image translation with conditional adversarial nets - GitHub - phillipi/pix2pix: Image-to-image translation with conditional adversarial nets

github.com

Contents

ν¬μŠ€νŒ… μ£Όμ†Œλ₯Ό λ³΅μ‚¬ν–ˆμŠ΅λ‹ˆλ‹€

이 글이 도움이 λ˜μ—ˆλ‹€λ©΄ 곡감 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.