Code Monkey home page Code Monkey logo

torch-gan's Introduction

Torch convolutional GAN

To run the code clone the repository

git clone https://github.com/skaae/torch-gan.git

cd to the datasets subfolder and run create_dataset.py. This will create the labeled faces in the wildt dataset. This may take a while depending on your internet connection etc.

Then run

th train_lfw.lua -g 0

where -g 0 specifies the GPU you want to use. The code will only run on GPU, but you can easily modify to run on CPU by removing the cudnn dependencies.

The code will plot 100 generated images after each epoch. After a 5-10 epochs you should see something that looks like a face.

The code was written by Anders Boesen Lindbo Larsen and Søren Kaae Sønderby. Our code is based on code released with the LAPGAN paper.

Move in latent space

Long latent space movie

Faces

100 epochs

Faces

Dependencies

torch-gan's People

Contributors

skaae avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

torch-gan's Issues

why use gmodule for generator

Can you explain why you're using nn.gmodule instead of nn.sequential for the generator? It seems all the modules are sequential.

retrieval incomplete: got only 17610303 out of 108761145 bytes

rzai@rzai00:~/prj/torch-gan/datasets$ python create_datasets.py
Traceback (most recent call last):
File "create_datasets.py", line 38, in
x = create_lfw()
File "create_datasets.py", line 27, in create_lfw
imgs = lfw_imgs(alignment='deepfunneled', size=64, crop=50)
File "create_datasets.py", line 16, in lfw_imgs
imgs, names_idx, names = lfw.LFW(alignment).arrays()
File "/home/rzai/prj/torch-gan/datasets/lfw/lfw.py", line 43, in init
self._install()
File "/home/rzai/prj/torch-gan/datasets/lfw/lfw.py", line 57, in _install
filepath = download(url, self.data_dir)
File "/home/rzai/prj/torch-gan/datasets/lfw/util.py", line 35, in download
urllib.urlretrieve(url, filepath)
File "/usr/lib/python2.7/urllib.py", line 94, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "/usr/lib/python2.7/urllib.py", line 284, in retrieve
"of %i bytes" % (read, size), result)
urllib.ContentTooShortError: retrieval incomplete: got only 17610303 out of 108761145 bytes

rzai@rzai00:~/prj/torch-gan/datasets$

Error from train_lfw.lua

.....
Generator network:
nn.gModule
Copy model to gpu
/home/sdq/torch/install/bin/luajit: /home/sdq/.luarocks/share/lua/5.1/nn/THNN.lua:109: wrong number of arguments for function call
stack traceback:
[C]: in function 'v'
/home/sdq/.luarocks/share/lua/5.1/nn/THNN.lua:109: in function 'HardTanh_updateOutput'
/home/sdq/.luarocks/share/lua/5.1/nn/HardTanh.lua:17: in function 'forward'
train_lfw.lua:180: in function 'getSamples'
train_lfw.lua:192: in main chunk
[C]: in function 'dofile'
.../sdq/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00406670

LFW processing

Hi,

I can't make your create_dataset.py to work. One sanity check failing: np.array(self.imgs.tolist().getdata()).sum() seems to be zero.

The actual error I got is:

Traceback (most recent call last):
  File "create_datasets.py", line 38, in <module>
    x = create_lfw()
  File "create_datasets.py", line 27, in create_lfw
    imgs = lfw_imgs(alignment='deepfunneled', size=64, crop=50)
  File "create_datasets.py", line 19, in lfw_imgs
    img = img[crop:-crop, crop:-crop]
IndexError: too many indices for array

Thank you,
Jake

Train on own dataset?

Looks interesting and impressive results after only few epochs. How would I go about training this on my own dataset of face photos, rather than the In the Wild dataset? From other posts it appears these need to all be cropped to same dimensions and aligned similarly. Is there any other gotchas? Pixel width / height? Any recommendations for minimum # of photos required to work properly?

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.