Performance of pre-trained CNNs (Deep-Transfer-Learning) as discriminator for Generative Neural Networks
This project researches the feasibility and performance of applying deep transfer learning on generative neural networks. This is done by taking an existing GAN architecture, and subsequently separating the generator from the discriminator. Then the discriminator is either left untrained, pre-trained on the desired dataset or pre-trained on a similar dataset (therefore applying deep transfer learning).
The following choices were made:
- The existing GAN architecture was chosen to be DCGAN (implementation 1, implementation 2).
- The MNIST handwritten digits and Fashion MNIST datasets were used as both have 28 × 28 × 1 shaped images, are relatively small datasets and are both contained in the Keras api.
DL-PR2
│
├─── discriminator1_digits
├─── discriminator1_fashion
├─── discriminator2_digits
├─── discriminator2_fashion
│
└─── r_analysis
The discriminatorx_d
folders contain the pre-trained discriminators in Tensorflow SavedModel
format. The 1 or 2 denotes whether the first implementation or second implementation was used. The name after the underscore denotes the dataset on which the discriminator was trained. The training method used can be found in the pretrain_disc.py
file. Refer to the TensorFlow documentation on how to load these models.
The r_analysis
folder contains the R scripts used to visualise the results of the experiments.
The multiple .sh
files are used to execute the code on the Peregrine cluster, refer to the 'Running on Peregrine' section for more information.
main.py
is the main entry point for the code, the experiments are executed by the code contained in experiment.py
.
(set_session.py
is a supplementary file that is used to initialise certain GPUs so that they can run TensorFlow)
No DTL | DTL on the training dataset | DTL on the other dataset | |
---|---|---|---|
Digits | ![]() |
![]() |
![]() |
Fashion | ![]() |
![]() |
![]() |
Peregrine is a compute cluster offered by the University of Groningen for its students. More information can be found here.
You can run the script on Peregrine as follows:
sbatch --job-name=JOBNAME main.sh --you "can" --use "python" --args "here"
Make sure to supply a descriptive job name, otherwise it will be impossible to
find your results. Also check the run time when a job finishes and adjust the
sbatch time
parameter accordingly to avoid allocating too much time. For
convenience, the output location is provided in the bash file by default.
The bash file currently assumes the project files are located at
/home/$USER/deep_learning_course/project_2/
, and will write its output to
/home/$USER/deep_learning_course/project_2/output/
(as long as the python code
respects the --outdir
argument).