gan workflow

GAN Workflow

The whole workflow of GAN including data processing, model constructing and other details is recorded here based on https://github.com/soumith/dcgan.torch. Here we take the LSUN(Large-Scale Scene Understanding Challenge) as an example.

  1. Download the dataset through this script https://github.com/fyu/lsun/blob/master/download.py. The dataset is stored as a lmdb(Lightning Memory-Mapped Database) database file. Lmdb database(folder named of bedroom_train_lmdb) contains data.mdb and lock.mdb.
  2. Generate an index file to record all the keys in lmdb database. bedroom_train_lmdb_hashes_chartensor.t7
  3. Achieve the data:get_batches() function. This work is finished through the cooperation of two files data.lua and donkey_lsun.lua. In data.lua, multi threads are built to speed the data-reading. In donkey_lsun.lua, data reading from lmdb database and image cropping behaviors are defined.
  4. Model building and training is achieved in main.lua. Pretrained model is stored in checkpoints/train_netG.t7 and checkspoints/train_netD.t7.
  5. Generate new samples using generate.lua. Vector Arithmetic is implemented in arithmetic.lua.

Note that if the training images are not database files, step 2 and 3 will is suppose d to be replaced with the code in donkey_folder.lua and dataset.lua.