Giter Site home page Giter Site logo

image2image's Introduction

tags license
conditional-image-generation
image-to-image
gan
cyclegan
mit

Image-to-image translation

A repository of image-to-image translation models developed for the Huggan hackaton here.

Currently it supports the cyclegan architecture for image-to-image translation

Installation

Firstly, after cloning this repository, run

cd image2image
pip install .

Then, set the wandb API_KEY if you wish to log all results to wandb with:

wandb login API_KEY

If you plan on uploading the resulting models to an huggingface repository, make sure to also login with your huggingface API_KEY with the following command:

huggingface-cli login 

Before starting the model training, it is necessary to configure the accelerate environment according to your available computing resource with the command:

accelerate config

After this, everything is setup to start training the image2image models

Training

To train an image2image translation model, one must only specify the dataset names
following the huggingface dataset convention {organization_name}/{dataset_name} in the following command line args:

  • --source_dataset_name
  • --target_dataset_name

In order to correctly configure the training procedure, it is necessary to first launch in a shell the accelerate config command(Only needs to be done once).
Note that in order to launch multi gpu single machine training, you need to set the accelerate config with multi-gpu training and
to the question How many processes in total will you use?
Answer with the number of gpus that you intend to use

accelerate config

After this, cd into im2im/train to launch the training script as follows

Single or multi gpu training is automatically set up by accelerate by running the following command to easily start the training of the image translation model

accelerate launch --config_file ~/.cache/huggingface/accelerate/default_config.yaml \
        train.py \
        --source_dataset_name Chris1/GTA5 \ 
        --target_dataset_name Chris1/cityscapes \        
        --batch_size 8 \
        --beta1 0.5 \
        --beta2 0.999 \
        --channels 3 \ 
        --checkpoint_interval 5 \
        --decay_epoch 80 \
        --epoch 0 \
        --image_size 256 \
        --lambda_cyc 10.0 \
        --lambda_id 5.0 \ 
        --lr 0.0002 \
        --mixed_precision no \
        --model_name cyclegan \
        --n_residual_blocks 9 \
        --num_epochs 200 \
        --num_workers 8 \
        --organization_name Chris1 \
        --push_to_hub \
        --sample_interval 10 \
        --wandb \
        --output_dir experiments

TODO

Provide a wider variety of architectures for the image2image translation task:

* [x] CycleGAN   
* [ ] Cycada    
* [ ] ...       

Architecture modifications:

* [ ] FID loss CycleGAN  
* [ ] ...     

About

Adapted by Christian Cancedda and inspired by Hugging Face with love ❤️# image2image

image2image's People

Contributors

chris1nexus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

johndpope

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.