Giter Club home page Giter Club logo

joligan's Introduction

Logo

Image-to-Image Translation for Domain Adaptation

JoliGAN provides models and machine learning tools for unpaired image to image translation and domain adaptation.

  • Multiple models based on adversarial generation: CycleGAN, CyCADA, CUT and more
  • Many generator architectures such as styleGAN2 decoder / mobile resnet, attention resnet,...
  • Semantic consistency allowing to perform domain adaptation e.g. from synthetic to real-like data

Use cases

  • Image to image translation while preserving semantic
  • Image to image translation to cope with scarce data

Models

Name Paper
CycleGAN https://arxiv.org/abs/1703.10593
CyCADA https://arxiv.org/abs/1711.03213
CUT https://arxiv.org/abs/2007.15651
RecycleGAN https://arxiv.org/abs/1808.05174
StyleGAN2 https://arxiv.org/abs/1912.04958

Generator architectures

Architecture Number of parameters
Resnet 9 blocks 11.378M
Mobile resnet 9 blocks 1.987M
Resnet attn 11.823M
Mobile resnet attn 2.432M
Segformer b0 4.158M
Segformer attn b0 4.60M
Segformer attn b1 14.724M
Segformer attn b5 83.016M

Quick Start

Prerequisites

  • Linux
  • Python 3
  • CPU or NVIDIA GPU + CUDA CuDNN

Installation

Clone this repo:

git clone --recursive https://github.com/jolibrain/joliGAN.git
cd joliGAN

Install PyTorch and other dependencies (torchvision, visdom and dominate, FID).
For pip users, please type the command pip install -r requirements.txt.

JoliGAN training

With a dataset located in directory dataroot:

  • Train with cut :

You can modify the hyperparameters in ./scripts/train_cut.sh and then use the following line command.

bash ./scripts/train_cut.sh dataroot

  • Train with cut and labels :

You can modify the hyperparameters in ./scripts/train_cut_semantic.sh and then use the following line command.

bash ./scripts/train_cut_semantic.sh dataroot

  • Train with cut and mask labels :

You can modify the hyperparameters in ./scripts/train_cut_semantic_mask.sh and then use the following line command.

bash ./scripts/train_cut_semantic_mask.sh dataroot
  • Train with cycleGAN :

You can modify the hyperparameters in ./scripts/train_cyclegan.sh and then use the following line command.

bash ./scripts/train_cyclegan.sh dataroot

  • Train with cycleGAN and labels :

You can modify the hyperparameters in ./scripts/train_cyclegan_semantic.sh and then use the following line command.

bash ./scripts/train_cyclegan_semantic.sh dataroot

  • Train with cycleGAN and mask labels :

You can modify the hyperparameters in ./scripts/train_cyclegan_semantic_mask.sh and then use the following line command.

bash ./scripts/train_cyclegan_semantic_mask.sh dataroot

JoliGAN server

Ensure everything is installed

python3 -m pip install fastapi uvicorn

Then run server:

server/run.sh --host localhost --port 8000

Tests

To launch tests before new commits:

bash scripts/run_tests.sh /path/to/dir

Docker build

To build a docker for joliGAN server:

docker build -t jolibrain/joligan_build -f docker/Dockerfile.build .
docker build -t jolibrain/joligan_server -f docker/Dockerfile.server .

To run the joliGAN docker:

nvidia-docker run jolibrain/myjoligan

Code format

If you want to contribute please use black code format. Install:

pip install black 

Usage :

black .

If you want to format the code automatically before every commit :

pip install pre-commit
pre-commit install

Authors

JoliGAN is created and maintained by Jolibrain.

Our code is inspired by pytorch-CycleGAN-and-pix2pix, CUT, AttentionGAN, MoNCE among others.

joligan's People

Contributors

alx avatar beniz avatar bycob avatar pnsuau avatar

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.