Difference between revisions of "DCGAN"

From Interaction Station Wiki
Jump to navigation Jump to search
Line 6: Line 6:
 
== Getting started ==
 
== Getting started ==
  
Because training a DCGAN requires a lot of computing power, head over to the interaction station and sit behind the computer with the 'ml  machineq' sticker. This computer runs a Ubuntu installation with (almost) every dependencies required to run some machine learning scripts/programs.
+
Because training a DCGAN requires a lot of computing power, head over to the interaction station and sit behind the computer with the 'ml  machineq' sticker. This computer runs a Ubuntu installation with (almost) every dependencies required to run some machine learning scripts/programs. In this tutorial I will be using blocks to make clear we are pressing some keys or typing some code. Example:
 +
 
 +
 +
enter
 +
 
 +
This would mean you need to press the Windows (⊞) key, follwed by an 'enter'. A code block that begins with a dollar sign means you need to type the command in the terminal window we are using. Example:
 +
 
 +
$ python3 test.py
 +
 
 +
This would mean you need to type 'python3 test.py' in the terminal window, '''without''' the dollar sign, this is just for indicating we're talking about the terminal window.
  
 
== DCGAN ==
 
== DCGAN ==
Line 38: Line 47:
 
[[File:Dcgan_4.png|600px]]
 
[[File:Dcgan_4.png|600px]]
  
use the arrow keys to move the variable 'genre_to_scrape' and change it to the desired genre from Wikiart. Example:
+
Use the arrow keys to move the variable 'genre_to_scrape' and change it to the desired genre from Wikiart. Example:
  
 
  genre_to_scrape = "nude-painting-nu"
 
  genre_to_scrape = "nude-painting-nu"
Line 46: Line 55:
 
[[File:Dcgan_6.png|600px]]
 
[[File:Dcgan_6.png|600px]]
  
save the changes you've made by pressing the following keys in the same order
+
Save the changes you've made by pressing the following keys in the same order
 
  ctrl+X
 
  ctrl+X
 
  Y
 
  Y

Revision as of 14:00, 16 January 2018

Generating images using A "Deep Convolutional Generative Adversarial Network"

In this tutorial we will be using a modified version of Soumith Chintala's torch implementation (https://github.com/soumith/dcgan.torch) of DCGAN - Deep Convolutional Generative Adversarial Network (https://arxiv.org/pdf/1511.06434.pdf) with a focus on generating images.

Getting started

Because training a DCGAN requires a lot of computing power, head over to the interaction station and sit behind the computer with the 'ml machineq' sticker. This computer runs a Ubuntu installation with (almost) every dependencies required to run some machine learning scripts/programs. In this tutorial I will be using blocks to make clear we are pressing some keys or typing some code. Example:

⊞
enter

This would mean you need to press the Windows (⊞) key, follwed by an 'enter'. A code block that begins with a dollar sign means you need to type the command in the terminal window we are using. Example:

$ python3 test.py

This would mean you need to type 'python3 test.py' in the terminal window, without the dollar sign, this is just for indicating we're talking about the terminal window.

DCGAN

1: Log in to the computer by using the 'interactionstation' account.

username: interactionstation
password: interactionstation

2: Start a new 'terminal' window by pressing the windows key (⊞) and typing 'term', followed by pressing 'enter'

⊞
term
enter

Dcgan 1.png

3: Navigate to the folder where the DCGAN script is stored (/home/interactionstation/dcgan.epoch)

$ cd dcgan.epoch

Dcgan 2.png

4: If you have your own dataset ready, you can skip part 4 till part ...

This script also includes a dataset downloader. This allows you to download from Wikiart based on their genres. The usage is quite simple, but requires a bit of attention. In the script 'genre-scraper.py' there is a variable called 'genre_to_scrape' - simply change that to any of the genres listen on the Wikiart [1] website. After changing the variable to the desired genre, run the script with python3. This will create a folder named after the genre inside '/home/interactionstation/dcgan.epoch/', containing all the download images. Note: the script takes a while to finish!

Dcgan 3.png

$ sudo nano genre-scraper.py

Dcgan 4.png

Use the arrow keys to move the variable 'genre_to_scrape' and change it to the desired genre from Wikiart. Example:

genre_to_scrape = "nude-painting-nu"

Dcgan 5.png

Dcgan 6.png

Save the changes you've made by pressing the following keys in the same order

ctrl+X
Y
enter

Dcgan 7.png

Run the script! Note: this is going to take a while, grab a coffee.

python3 genre-scraper.py