Giter Site home page Giter Site logo

ramap27 / cyclegan-unpaired-image-translation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mukku27/cyclegan-unpaired-image-translation

0.0 0.0 0.0 10 KB

CycleGAN implementation for unpaired image-to-image translation. Train a model to translate images between domains (e.g., horse <-> zebra) using PyTorch. This code includes pre-processing, training, and utility functions.

Python 39.84% Jupyter Notebook 60.16%

cyclegan-unpaired-image-translation's Introduction

CycleGAN: Unpaired Image-to-Image Translation

This repository contains the code for training a CycleGAN model for unpaired image-to-image translation, inspired by the research paper Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks: https://arxiv.org/abs/1703.10593.

Here's a breakdown of the code files:

  • Discriminator.py and Generator.py: These files define the core components of the CycleGAN model:

    • Discriminator (Discriminator.py): This network aims to distinguish between real images and images generated by the generators. It takes two images (e.g., horse and zebra) as input and outputs a single value representing the likelihood of being a real image.
    • Generator (Generator.py): This network learns to translate images from one domain (e.g., horse) to another (e.g., zebra). It takes an image from one domain as input and generates a realistic image in the target domain.
  • utils.py: This file contains helper functions for training, including saving/loading model checkpoints and setting random seeds for reproducibility.

  • config.py: This file stores the configuration details for training, such as:

    • Device to use (CPU or GPU)
    • Training data directories
    • Hyperparameters like learning rate, batch size, and number of epochs
    • Data augmentation techniques
    • Options for loading/saving model checkpoints
  • Dataset.py: This file defines a custom dataset class that loads horse and zebra images, applies data augmentation, and prepares them for training.

  • train.ipynb: This Jupyter notebook is the main training script. It:

    • Defines the models (Discriminator and Generator)
    • Creates optimizers for training
    • Defines loss functions for measuring errors
    • Loads the training and validation datasets
    • Implements the training loop:
      • Trains the Discriminators to distinguish real from fake images
      • Trains the Generators to fool the Discriminators and generate realistic images
      • Calculates cycle consistency loss to ensure images can be translated back to their original domain
      • Optionally calculates identity loss to preserve image content during translation
    • Saves the model checkpoints periodically
    • Optionally visualizes the generated images during training

Overall, this code implements a CycleGAN model for unpaired image-to-image translation. The model learns to translate images from one domain to another while maintaining image consistency through cycle consistency loss.

cyclegan-unpaired-image-translation's People

Contributors

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