Table of Contents
This repo contains the implementation of a project made during the course Machine Learning in Applications attended at Politecnico di Torino. The objective of this project is to create a filter for facial attribute editing. It contains the original baseline and the other techniques exploited to finetune the network.
The final report can be found here.
To setup the environment run the following script:
python setup_env.py
Otherwise install manually the dependencies with pip install -r requirements.txt
and download the dataset and the desired weights.
The dataset can be found in CelebA website and the weights in the Pytorch implementation of AttGAN repo.
To train the model simply run train.py
with the desired arguments. The ones used in report are:
- lambda_1 : the weight of reconstruction loss
- epochs : number of training epochs to run
- batch_size : the size of batch
- indices_path : the numpy file containing the indices of the images to use for training
- experiment_name : the CometML experiment name
- target_attr : the attribute to modify
- dg_ratio : how many discriminator steps we run for each generator step
- freeze_layers : how many low layers of discriminator to freeze
- use_alternate_dataset : use Alternate method as described in report
- max_time : timer for stopping training
- upload_weights : if present upload checkpoint to CometML
For more details use python train.py --help
and refer to original implementation.
Distributed under the MIT License. See LICENSE for more information.
We used third-party AttGAN implementation see ATTGAN for more details.
The project was built by Damiano Bonaccorsi, Daniele Rege Cambrin, Giulia D’Ascenzi, Patrizio de Girolamo.
- He, Zhenliang et al. "AttGAN: Facial Attribute Editing by Only Changing What You Want." (2017).
- Mo, Sangwoo et al. "Freeze the Discriminator: a Simple Baseline for Fine-Tuning GANs." (2020).