Code Monkey home page Code Monkey logo

cyclegans-pytorch's Introduction

CycleGANs-PyTorch applied on Young to Old image converter.

Py-Torch implementation of CycleGANs Paper.

  • You can find more about this project in my blog here.

CycleGAN Block Diagram:

BD

RESULTS FIRST: Young to Old converter

img1.jpg img2.jpg img3.jpg img4.jpg

IF you want to replicate these results may be on different dataset. Read More..

  1. Clone the repository:
git clone https://github.com/abhishekyana/CycleGANs-PyTorch.git
cd CycleGANs-PyTorch
# As this is a huge project, I'd suggest to make a conda environment and then run the training and all.
  1. Install all the requirements from requirements.txt file:
  2. Download the dataset, It can be grabbed from here.
  3. Unzip and Move the dataset folder into this project's root directory.
  4. Adjust the configure.py file according to your flavour, these parameters affect the training.
  5. Run the python train.py file and see the training happen for yourself.
  • The models will be saved to and loaded from ./outputs as default.
  • The model trained for around 4 hours on GTX1080 and i7 system.

If you want to test the mode, then you can download the pretrained model from here. Sorry the link is broken I'll fix it..

  • Download the dataset.
  • Download the pretrained model. Only Generator model is enough.
  • Copy these folders into appropriate directories as mentioned above.
  • Run python test.py, After the provess is done, you can see the Juxtaposed results in ./outputs/A and ./outputs/B.
  • If you want to run this on your own images, Copy your image into a directory in ./directory/A if you want to make your picture old or into ./directory/B if you want your picture to be Young. Then edit the ./directory in testoptions in configure.py and run the code again. Now, you can see the your image in the outputs directory.

Please Feel Free to Fork it, Clone it and whatever you want.

  • Not only this data, A CycleGAN can map from any unpaired domains, as this application si trending now, I've chosen this to code.

With Love on Open Source

Thank you

This project is inspired from Aitor Ruano and I would like to thank him for providing such a beautiful code which I used to clarify my doubts during the implementation.

cyclegans-pytorch's People

Contributors

abhishekyana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

stanleydukor

cyclegans-pytorch's Issues

pretrained model

the link is broken, where is the pretrained model ?please

python 3.7.9 run test.py No module named 'torch.vision'

Hi:
I run test.py and encounter an error. error message is

python test.py
Traceback (most recent call last):
File "test.py", line 4, in
from datasets import AnBDataset
File "/Users/think/app/CycleGANs-PyTorch/datasets.py", line 2, in
import torch.vision.transforms as transforms
ModuleNotFoundError: No module named 'torch.vision'

My steps are as follows:

  1. clone CycleGANs-PyTorch
  2. conda create --name old2young python=3.7 and activate old2young
  3. pip install -r requirements.txt
  4. run test.py

Result of step 3:
pip install -r requirements.txt
Requirement already satisfied: numpy==1.16.2 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (1.16.2)
Requirement already satisfied: torch==1.1.0 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (1.1.0)
Requirement already satisfied: scipy==1.2.1 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (1.2.1)
Requirement already satisfied: torchvision==0.3.0 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (0.3.0)
Requirement already satisfied: visdom==0.1.8.8 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 5)) (0.1.8.8)
Requirement already satisfied: Pillow==6.1.0 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from -r requirements.txt (line 6)) (6.1.0)
Requirement already satisfied: six in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from torchvision==0.3.0->-r requirements.txt (line 4)) (1.15.0)
Requirement already satisfied: requests in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from visdom==0.1.8.8->-r requirements.txt (line 5)) (2.25.0)
Requirement already satisfied: tornado in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from visdom==0.1.8.8->-r requirements.txt (line 5)) (6.1)
Requirement already satisfied: pyzmq in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from visdom==0.1.8.8->-r requirements.txt (line 5)) (20.0.0)
Requirement already satisfied: torchfile in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from visdom==0.1.8.8->-r requirements.txt (line 5)) (0.1.0)
Requirement already satisfied: websocket-client in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from visdom==0.1.8.8->-r requirements.txt (line 5)) (0.57.0)
Requirement already satisfied: certifi>=2017.4.17 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from requests->visdom==0.1.8.8->-r requirements.txt (line 5)) (2020.6.20)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from requests->visdom==0.1.8.8->-r requirements.txt (line 5)) (1.26.2)
Requirement already satisfied: idna<3,>=2.5 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from requests->visdom==0.1.8.8->-r requirements.txt (line 5)) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/think/miniconda3/envs/old2young/lib/python3.7/site-packages (from requests->visdom==0.1.8.8->-r requirements.txt (line 5)) (3.0.4)

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.