A PyTorch implementation of EncodeGAN
this project is used to achieve face image fusion and attribute change tasks
- Python 3.6
- PyTorch
- TensorboardX
pip install -r requirements.txt
- Dataset
- CelebA dataset
- Images should be placed in
data/CelebA/img/img_align_celeba/*.jpg
- Attribute labels should be placed in
data/CelebA/anno/list_attr_celeba.txt
- Images should be placed in
- test_data:you can use CelebA's test dataset, or select some face image from CelebA and add them in
test_data/*.jpg
.
- CelebA dataset
data
├── CelebA
├── img
├── img_align_celeba
├── anno
├── list_attr_celeba.txt
├── test_data
├── *.jpg
CUDA_VISIBLE_DEVICES=0 \
python train.py --gpu=True --data_save_root=output --experiment_name=Encode_GAN --total_steps=100000 --latent_dim=128 --batch_size=32 --b1=0 --b2=0.999 --data_path='data/CelebA/img/img_align_celeba' --attr_path='data/CelebA/anno/list_attr_celeba.txt' --data_save_root='output' --E_mode='enc' --n_e=2
CUDA_VISIBLE_DEVICES=0 \
python face_latent_space_explore_test.py --gpu=True --data_save_root=output --experiment_name=face_latent_space_explore_test --weight_path=output/Encode_GAN/checkpoint/weights.99999.pth --setting_path=output/Encode_GAN/setting.txt --test_data_path=test_data
CUDA_VISIBLE_DEVICES=0 \
python face_attr_change_test.py --gpu=True --data_save_root=output --experiment_name=face_attr_change_test --data_path=data/CelebA/img/img_align_celeba --attr_path=data/CelebA/anno/list_attr_celeba.txt --data_save_root=output --weight_path=output/Encode_GAN/checkpoint/weights.99999.pth --setting_path=output/Encode_GAN/setting.txt --test_data_path=test_data
tensorboard \
--logdir output/your_experiment_name/summary