Workshop in Machine Learning Applications for Computer Graphics, Tel-Aviv University, 2019.
- Chen Barnoy
- Gili Shohat
- Michael Glukhman
Based on a PyTorch implementation of AttGAN - Arbitrary Facial Attribute Editing: Only Change What You Want.
Test on the CelebA validating set
- Python 3
- PyTorch 0.4.0
- TensorboardX
pip3 install -r requirements.txt
If you'd like to train with multiple GPUs, please install PyTorch v0.4.0 instead of v1.0.0 or above. The so-called stable version of PyTorch has a bunch of problems with regard to nn.DataParallel()
. E.g. pytorch/pytorch#15716, pytorch/pytorch#16532, etc.
pip3 install --upgrade torch==0.4.0
-
Generated datasets (by stain types/by image dirtiness level
- Images should be placed in
./data/custom/*.jpg
- Attribute labels should be placed in
./data/list_attr_custom.txt
- Images should be placed in
CUDA_VISIBLE_DEVICES=0 \
python train.py \
--img_size 128 \
--shortcut_layers 1 \
--inject_layers 1 \
--experiment_name 128_shortcut1_inject1_none \
--gpu
CUDA_VISIBLE_DEVICES=0 \
python train.py \
--data CelebA-HQ \
--img_size 256 \
--shortcut_layers 1 \
--inject_layers 1 \
--experiment_name 256_shortcut1_inject1_none_hq \
--gpu \
--multi_gpu
tensorboard \
--logdir ./output
CUDA_VISIBLE_DEVICES=0 \
python test.py \
--experiment_name 128_shortcut1_inject1_none \
--test_int 1.0 \
--gpu
CUDA_VISIBLE_DEVICES=0 \
python test_multi.py \
--experiment_name 128_shortcut1_inject1_none \
--test_atts Pale_Skin Male \
--test_ints 0.5 0.5 \
--gpu
Example for our case (turning off clean attribute and turning on level 1 of image dirtiness:
CUDA_VISIBLE_DEVICES=0 \
python3 test_multi.py --experiment_name 128_shortcut1_inject1_none_16000_bytype \
--test_atts Clean Stain_Level_1 \
--test_ints -1 1 \
--gpu \
--custom_img
CUDA_VISIBLE_DEVICES=0 \
python test_slide.py \
--experiment_name 128_shortcut1_inject1_none \
--test_att black \
--test_int_min -1.0 \
--test_int_max 1.0 \
--n_slide 10 \
--gpu
CUDA_VISIBLE_DEVICES=0 \
python test.py \
--experiment_name 384_shortcut1_inject1_none_hq \
--test_int 1.0 \
--gpu \
--custom_img
Your custom images are supposed to be in ./data/custom
and you also need an attribute list of the images ./data/list_attr_custom.txt
. Please crop and resize them into square images in advance.