GithubHelp home page GithubHelp logo

bryanlimy / tf2-cyclegan Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 4.0 16.44 MB

TensorFlow 2 implementation of CycleGAN with multi-GPU training.

License: MIT License

Python 97.64% Shell 2.36%
tensorflow cyclegan tf2 tensorflow2 mirroredstrategy distributed-training multi-gpus gan

tf2-cyclegan's Introduction

CycleGAN with multi-GPUs training in TensorFlow 2

This repository provide a concise example on how to use tf.distribute.MirroredStrategy with custom training loops in TensorFlow 2. We adapt the CycleGAN (Zhu et. al. 2017) tutorials from Keras and TensorFlow and train the model with multiple GPUs. See towardsdatascience.com/multi-gpus-and-custom-training-loops-in-tensorflow-2-15b4b86b53bd for a detailed tutorial.

horse → zebra → horse zebra → horse → zebra

1. Setup

  • create virtual environment for the project
    conda create -n cyclegan python=3.8
    
  • activate virtual environment
    conda activate cyclegan
    
  • install required packages
    sh setup.sh
    

2. Run

  • We use the horse2zebra dataset from TensorFlow Datasets by default.
  • Training logs and checkpoints are stored in --output_dir
  • We can use the following command to train the CycleGAN model on 2 GPUs and store the TensorBoard summary and checkpoints to runs/:
    CUDA_VISIBLE_DEVICES=0,1 python main.py --output_dir runs/ --epochs 200
    
  • Use --help to see all available flags.

3. Result

  • Use TensorBoard to inspect the training summary and plots
    tensorboard --logdir runs/cyclegan
    

tf2-cyclegan's People

Contributors

bryanlimy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.