GithubHelp home page GithubHelp logo

pmlg / selfie2anime-tutorial Goto Github PK

View Code? Open in Web Editor NEW

This project forked from t04glovern/selfie2anime-tutorial

0.0 2.0 0.0 2.96 MB

License: MIT License

Dockerfile 0.33% Python 86.33% Jupyter Notebook 4.55% JavaScript 0.59% Shell 0.70% TypeScript 7.50%

selfie2anime-tutorial's Introduction

UGATIT - Model Training Tutorial

Selfie2Anime was a successful use of Image-to-Image translation using UGATIT. In this post we learn how to setup a development environment capable of running UGATIT, then train out own variation of a model.

Detailed tutorial for training and inference are outlined in the blog

Setup

Pip

pip3 install --upgrade pip
pip3 install -r requirements.txt

Conda

conda env create -f environment.yml
conda activate UGATIT

Usage

├── dataset
   └── YOUR_DATASET_NAME
       ├── trainA
           ├── xxx.jpg (name, format does not matter)
           ├── yyy.png
           └── ...
       ├── trainB
           ├── zzz.jpg
           ├── www.png
           └── ...
       ├── testA
           ├── aaa.jpg
           ├── bbb.png
           └── ...
       └── testB
           ├── ccc.jpg
           ├── ddd.png
           └── ...

Train

python main.py --dataset YOUR_DATASET_NAME

If the memory of gpu is not sufficient, set --light to True

  • But it may not perform well
  • paper version is --light to False

Test

python main.py --dataset YOUR_DATASET_NAME --phase test

Test Video

Make sure to set your video device in the State class of main.py if you have a unique setup.

By default it'll use the first video device attached

python main.py --dataset YOUR_DATASET_NAME --phase video

Test Process Endpoint [WIP]

python main.py --dataset YOUR_DATASET_NAME --phase web

POST to http://0.0.0.0:5000/process with the following data format

{
  "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...."
}

Common Errors

No module named 'tensorflow.contrib'

Version 2.0 of Tensorflow isn't supported, you might need to change the environment.yaml to the following

name: UGATIT
dependencies:
  - python=3.5
  - matplotlib
  - numpy
  - pip
  - pip:
    - opencv-python
    - Pillow
#    - tensorflow==1.15.0 # CPU support
    - tensorflow-gpu==1.15.0

Citation

If you find the code useful for your research, please cite their paper:

@article{kim2019u,
  title={U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation},
  author={Kim, Junho and Kim, Minjae and Kang, Hyeonwoo and Lee, Kwanghee},
  journal={arXiv preprint arXiv:1907.10830},
  year={2019}
}

Attribution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.