Code Monkey home page Code Monkey logo

art-dcgan's People

Contributors

robbiebarrat 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  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

art-dcgan's Issues

Continuous noisemode?

This isn't a bug, just a request: I can't manage to generate more than 1100 examples (with batchSize) and I'd like to do longer animations. Is there a way to generate more images, or just "pick up" the noise where it previously left off?

What are the training parameters for pre-trained networks?

I've been training for cubism style with 500 images (I know I should have around ~3k but there's not enough sample) with nz=300 ndf=20 ngf=100 (if I make them higher D or G would fixate on 0) and here are my results after 750, 1500 and 2250 iterations respectively:

generation1-1500
generation1-750
generation1-2250

Any suggestions for parameter tuning?

Resuming from pretrained network checkpoints on CPU fails: unknown Torch class <torch.CudaTensor>

Trying to resume training from one of the models on CPU returns an error regarding an unknown Torch class.

DATA_ROOT=myimages dataset=folder gpu=0 netD=checkpoints/landscapes_776_net_D.t7 netG=checkpoints/landscapes_776_net_G.t7 th main-128.lua
{
ntrain : inf
netD : "checkpoints/landscapes_776_net_D.t7"
nThreads : 4
niter : 100
batchSize : 64
netG : "checkpoints/landscapes_776_net_G.t7"
ndf : 40
fineSize : 128
nz : 100
loadSize : 129
gpu : 0
ngf : 160
dataset : "folder"
lr : 0.0002
noise : "normal"
name : "experiment1"
beta1 : 0.5
display_id : 10
display : 1
}
Random Seed: 8411
Starting donkey with id: 2 seed: 8413
table: 0x0a0c0bc8
Starting donkey with id: 1 seed: 8412
table: 0x0a0e2528
Starting donkey with id: 4 seed: 8415
table: 0x0a100ae0
Starting donkey with id: 3 seed: 8414
table: 0x0a122460
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Dataset: folder Size: 5209
Initializing generator network from checkpoints/landscapes_776_net_G.t7
/Users/hans/torch/install/bin/luajit: /Users/hans/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor>
stack traceback:
[C]: in function 'error'
/Users/hans/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject'
/Users/hans/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
/Users/hans/torch/install/share/lua/5.1/nn/Module.lua:192: in function 'read'
/Users/hans/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject'
/Users/hans/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
main-128.lua:72: in main chunk
[C]: in function 'dofile'
...hans/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x010912cd60

This seems to be because the models were trained using a GPU and thus require CUNN to load. According to this comment however, this can be remedied simply by converting the models to float before saving them. I would test it out myself and pull request (seeing as this might be as simple as adding 2 lines) but I don't have an NVIDIA graphics card.

Next to this I have found this script, which seems to be able to convert checkpoints after the fact. This also requires CUNN though, so it would be nice if the checkpoints could be converted for us CPU users!

Feature Request: Image cropping

@robbiebarrat thanks for the wonderful project. I have written a short script to crop images to certain dimensions. This can be used in conjunction with the genre-scraper to produce training images with uniform dimensions. Can I start a pull request to add this feature in?

WikiArt scraper only scraping <3000 images

Hi! When scraping and downloading images to train the DCGAN on, the scraper is unable to get access to the full dataset. Instead, for example when I try downloading images using the command python art.py --genre=landscape --num_pages=250 --output_dir=landscape_scraped I am only able to download around 2400 images before the prorgram ends. However, when you go to the WikiArt website, it shows that for landscape there are around 22000 images available.

Here's what I think the issue is: when you go to the landscape page, the webpage shows that there are a total of 3600 images you can see. I tried scrolling all the way down to see if there were other pages I could access with different images, but it doesn't show any buttons to go to any other pages (if there are any). It looks like WikiArt has their website so that you can only view those 3600 images instead of the entire dataset, which poses a problem since we have less data to train the network on. I might be wrong since I don't really know how WikiArt works, but how can I obtain more images than just the 2400 images?

Thanks in advance!

genre_scraper.py only scraping 4000 images max

The scraper works fantastic but is unable to get more than 3000-4000 images from wikiart. I tried adjustung num_pages (up to 4000 pages) but it won't scrape more than 4k pictures.

wikiart

Maybe it is because on the webpage it is also only showing max 3600 pictures? As can be seen here: https://www.wikiart.org/en/paintings-by-genre/portrait?select=featured#!#filterName:featured,viewType:masonry

Is there any fix to this because I'd like to train the network on more than 4k pictures.

another way to train

First, great work on this Robbie, I recently came across PG GANS

https://github.com/tkarras/progressive_growing_of_gans

edit: https://cari-gan.github.io/
Cari-gan seems very interesting for stylized portraits.

edit2: big gan was impressed by this alot and they have a colab notebook for a demo https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/biggan_generation_with_tf_hub.ipynb

Im not sure if you have seen this but i think it will help the images getting more finer details. The celebrity output they show is incredibly close to the sample data in terms of quality. I was wondering if there is a way to incorporate this into this project, would be open to working on it.

Also, would be cool if this project could be on google colab, the free GPU is always great. Thanks

Feature Request

Just wondering about the 'coming soon' feature of "creating animated gifs of walks throughout latent space" โ€“ how's the progressing? Happy to assist with that one.

Error on training a GAN on a folder of images

Hi,
So after I scrapped some images and used myimages as output_dir from genre-scrapper.py command.I ran the command DATA_ROOT=myimages dataset=folder ndf=50 ngf=150 th main.lua

Then I got this:
THCudaCheck FAIL file=/home/ubuntu/torch/extra/cutorch/lib/THC/THCGeneral.c line=70 error=30 : unknown error /home/ubuntu/torch/install/bin/luajit: /home/ubuntu/torch/install/share/lua/5.1/trepl/init.lua:389: /home/ubuntu/torch/install/share/lua/5.1/trepl/init.lua:389: cuda runtime error (30) : unknown error at /home/ubuntu/torch/extra/cutorch/lib/THC/THCGeneral.c:70 stack traceback: [C]: in function 'error' /home/ubuntu/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require' main.lua:29: in main chunk [C]: in function 'dofile' ...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405e90

Get painting list requests get throttled by wikiart

When running genre-scraper.py using the currently harcoded values for randomization

time.sleep(3.0*random.random())  # random sleep to decrease concurrence of requests

requests get throttled by Wikiart that returns

[Errno 104] Connection reset by peer

I think there are 2 improvements:

  • Throttled a bit more the request from the script side by having a fixed latency summed up to the randomised one.
  • when you run the script only failures are printed out in the console. And because of that initially I wrongly assumed the the script wasn't working at all. In reality all the successful requests are not logged, so might be good to add some more logs.

I'm happy to open a PR for this.

Error with own image dataset

Despite installing dependancies I'm getting this error when trying to train my own very small dataset. Could it be the naming or formatting of the jpg? They are named 001.jpg etc and have RGB no alpha channel colour properties.
Any help would be appreciated.

Random Seed: 2589
Starting donkey with id: 3 seed: 2592
table: 0x418eb430
Starting donkey with id: 4 seed: 2593
table: 0x40715898
Starting donkey with id: 2 seed: 2591
table: 0x41bebf68
Starting donkey with id: 1 seed: 2590
table: 0x4190c650
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Dataset: folder Size: 455
/home/paperspace/torch/install/bin/luajit: ...perspace/torch/install/share/lua/5.1/threads/threads.lua:315: ...perspace/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 3 callback] /home/paperspace/torch/install/share/lua/5.1/image/init.lua:235: Not a JPEG file: starts with 0x00 0x00
stack traceback:
[C]: in function 'load'
/home/paperspace/torch/install/share/lua/5.1/image/init.lua:235: in function 'loader'
/home/paperspace/torch/install/share/lua/5.1/image/init.lua:388: in function 'load'
/home/paperspace/art-DCGAN/data/donkey_folder.lua:34: in function 'loadImage'
/home/paperspace/art-DCGAN/data/donkey_folder.lua:54: in function 'getByClass'
/home/paperspace/art-DCGAN/data/dataset.lua:341: in function </home/paperspace/art-DCGAN/data/dataset.lua:335>
[C]: in function 'xpcall'
...perspace/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback'
...paperspace/torch/install/share/lua/5.1/threads/queue.lua:65: in function <...paperspace/torch/install/share/lua/5.1/threads/queue.lua:41>
[C]: in function 'pcall'
...paperspace/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob'
[string " local Queue = require 'threads.queue'..."]:15: in main chunk

How to resume from checkpoint? There is no checkpoint?

Hey
I do not know how to resume from a checkpoint.
Before that, I even don't know how to get a checkpoint.
In /cache/ is a file called images_trainCache.t7 but there is no file in checkpoint but the keepempty.sh.

  1. How do I state the number of epochs to be trained?
  2. How do I get a checkpoint/network *.t7 ?
  3. How is keepempty.sh supposed to be used?
  4. How do I pause/quit the training process and saving the trained network?
art-DCGAN$ DATA_ROOT=images dataset=folder name=earthporn1 noise=normal display=1 ndf=50 ngf=150 th main.lua
{
  ntrain : inf
  saveIter : 100
  netD : ""
  nThreads : 4
  niter : 100
  batchSize : 64
  netG : ""
  ndf : 50
  fineSize : 128
  nz : 100
  loadSize : 129
  gpu : 1
  ngf : 150
  dataset : "folder"
  lr : 0.0002
  noise : "normal"
  name : "earthporn1"
  beta1 : 0.5
  display_id : 10
  display : 1
}
Random Seed: 889	
Starting donkey with id: 1 seed: 890
table: 0x41843be8
Starting donkey with id: 2 seed: 891
table: 0x40fc9d10
Starting donkey with id: 4 seed: 893
table: 0x40ff9b78
Starting donkey with id: 3 seed: 892
table: 0x41bd0ca0
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Dataset: folder	 Size: 	5403	
Epoch: [1][       0 /       84]	 Time: 4.714  DataTime: 0.000    Err_G: 1.1734  Err_D: 1.8360	
Epoch: [1][       1 /       84]	 Time: 0.362  DataTime: 0.001    Err_G: 0.0002  Err_D: 9.7356	
Epoch: [1][       2 /       84]	 Time: 0.610  DataTime: 0.000    Err_G: 2.3843  Err_D: 1.0969	
Epoch: [1][       3 /       84]	 Time: 0.608  DataTime: 0.000    Err_G: 0.0051  Err_D: 6.9844	
Epoch: [1][       4 /       84]	 Time: 0.610  DataTime: 0.000    Err_G: 5.3534  Err_D: 1.2248	
Epoch: [1][       5 /       84]	 Time: 0.610  DataTime: 0.000    Err_G: 0.0003  Err_D: 10.6333	
Epoch: [1][       6 /       84]	 Time: 0.611  DataTime: 0.000    Err_G: 5.6328  Err_D: 1.3870	
Epoch: [1][       7 /       84]	 Time: 0.610  DataTime: 0.000    Err_G: 0.0010  Err_D: 8.7023	
Epoch: [1][       8 /       84]	 Time: 0.621  DataTime: 0.000    Err_G: 8.8540  Err_D: 1.1807	
Epoch: [1][       9 /       84]	 Time: 1.191  DataTime: 0.000    Err_G: 0.0016  Err_D: 8.0488	
Epoch: [1][      10 /       84]	 Time: 0.331  DataTime: 0.001    Err_G: 10.2465  Err_D: 0.9930	
Epoch: [1][      11 /       84]	 Time: 0.612  DataTime: 0.000    Err_G: 0.0015  Err_D: 9.1081	
Epoch: [1][      12 /       84]	 Time: 0.611  DataTime: 0.000    Err_G: 12.0652  Err_D: 0.8474	
Epoch: [1][      13 /       84]	 Time: 0.609  DataTime: 0.000    Err_G: 0.0191  Err_D: 6.1591	

I then CTRL+C out of the process because I don't know how else I am supposed to do so. Shown below

Epoch: [9][      75 /       84]	 Time: 0.647  DataTime: 0.000    Err_G: 27.6310  Err_D: 0.0000	
Epoch: [9][      76 /       84]	 Time: 0.645  DataTime: 0.000    Err_G: 27.6310  Err_D: 0.0001	
Epoch: [9][      77 /       84]	 Time: 0.646  DataTime: 0.000    Err_G: 27.6310  Err_D: 0.0001	
Epoch: [9][      78 /       84]	 Time: 0.646  DataTime: 0.000    Err_G: 27.6310  Err_D: 0.0000	
^C/home/castle/torch/install/bin/luajit: /home/castle/torch/install/share/lua/5.1/display/init.lua:124: interrupted!
stack traceback:
	/home/castle/torch/install/share/lua/5.1/display/init.lua:124: in function 'image'
	main.lua:246: in main chunk
	[C]: in function 'dofile'
	...stle/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00405d50

I only have this images_trainCache.t7in my cache folder. No file in the checkpoints folder.

When trying to resume it looks like this:

art-DCGAN$ DATA_ROOT=images dataset=folder name=earthporn1 netD=cache/images_trainCache.t7 netG=cache/images_trainCache.t7 th main.lua
{
  ntrain : inf
  saveIter : 100
  netD : "cache/images_trainCache.t7"
  nThreads : 4
  niter : 100
  batchSize : 64
  netG : "cache/images_trainCache.t7"
  ndf : 40
  fineSize : 128
  nz : 100
  loadSize : 129
  gpu : 1
  ngf : 160
  dataset : "folder"
  lr : 0.0002
  noise : "normal"
  name : "earthporn1"
  beta1 : 0.5
  display_id : 10
  display : 1
}
Random Seed: 8670	
Starting donkey with id: 1 seed: 8671
table: 0x411cfd78
Starting donkey with id: 3 seed: 8673
table: 0x41a72390
Starting donkey with id: 4 seed: 8674
table: 0x41031d58
Starting donkey with id: 2 seed: 8672
table: 0x400a3ca0
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Loading train metadata from cache
Dataset: folder	 Size: 	5403	
Initializing generator network from cache/images_trainCache.t7	
/home/castle/torch/install/bin/luajit: /home/castle/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <dataLoader>
stack traceback:
	[C]: in function 'error'
	/home/castle/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject'
	/home/castle/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
	main.lua:73: in main chunk
	[C]: in function 'dofile'
	...stle/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00405d50

Also I have to set name=earthporn1 else the name is set to name=experiment1 automatically.

Cant run example with landscapes

Hey,
Running this on Razerblade w/ cudnn and the CUDA installed.
Seem to be getting this error, any tips to get around it?

reads/threads.lua:183: [thread 4 callback] /home/USER/Desktop/art-DCGAN/data/donkey_folder.lua:20: bad argument #2 to 'error' (number expected, got string)

Suggestions for pre-trained models

Comment in this issue if you:

  • Have a pre-trained network you want to share (just paste the drive link)

  • Have an idea for something cool to train the GAN on

  • Have an idea about training in general (e.g. why don't we train a network on landscapes for 500 epochs, and then switch the dataset to portraits? What would happen?)

How to run?

I am currently downloading Ubuntu but I am not the most proficient person with running repositories from Github, could anyone provide me with steps to run this project for landscapes and portraits as the instructions are rather confusing to be

100 epochs with 10,000 images from celebA... still noise?

Hi, thanks very much for adding a more layers so that the networks would be able to generate higher res images...

I'm a bit confused about how to go about training properly. I put 10,000 images from "img_align_celebA" into the landscape/images folder and ran "DATA_ROOT=landscape dataset=folder ndf=30 ngf=90 th main.lua", but I'm still getting almost pure noise in the localhost:8000 display... is this normal?

Progress Updates

Hey Robbie!

How far along are the future updates e.g. "creating animated gifs of walks throughout latent space" and
"a GUI for this whole thing"?

Portrait GAN

Hey! I've downloaded the portrait dataset myself, albeit only ~4k images as the other issue suggests. My question is: have you used a face detector before training, because the images have a lot of different sizes and shapes, and while I do resizing before training, that will of course extremely skew the results!

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.