Skip to content

NYCU Data Sicence 2024 Makeup Transfer using BeautyGAN, write code in Morden way

License

Notifications You must be signed in to change notification settings

KeithLin724/NYCU-Data-Science-2024-Makeup-Transfer

Repository files navigation

NYCU Data Science 2024 - HW5 Makeup Transfer Using BeautyGAN

written BY KYLiN

BeautyGAN: Instance-level Facial Makeup Transfer with Deep Generative Adversarial Network


Platform

Ubuntu Window

Tools

Python Pytorch jupyter numpy pandas

Requirements

First :

pip install poetry

Second :

poetry install


Datasets

In this code we using mtdataset

Structure like :

./mtdataset
├── images
│   ├── makeup
│   └── non-makeup
└── parsing
    ├── makeup
    └── non-makeup

Training Code

python train.py --data_path {your dataset path}

For Tensorboard:

tensorboard --logdir runs, then open http://localhost:6006/

Run score :

python ./run_score.py --checkpoint "{model path}" --add_128 {resize image to 128}

Example :

python ./run_score.py --checkpoint "model/83_780/83_780_G.pth" --add_128 True


TA readme

If you want to use this evaluation metric, you need prepare:

  1. mtdataset/images/non-makeup
  2. mtdataset/images/makeup
  3. mt_removal
  4. output_folder (the generated images)

The filenames of generated images should be as follows: pred_0.png, pred_1.png, .....

The order of generated images are the makuep_test.txt and nomakup_test.txt . For example, pred_0.png are generated by non-makeup/xfsy_0458.png and makeup/vHX44.png. non-makeup/xfsy_0458.png and makeup/vHX44.png are the first line of nomakeup_test.txt and makup_test.txt, respectively


Best score

+------------+-------------+----------+-----------+
| Approach   |   Precision |   Recall |   Overall |
+============+=============+==========+===========+
| mt         |       0.959 |    0.001 |     0.029 |
+------------+-------------+----------+-----------+

Acknowledgement

This code is heavily based on BeautyGAN - Offical Pytorch Implementation and BeautyGAN-PyTorch-reimplementation. Thanks wtjiang98,thaoshibe so much to make his work available 🙏🙏🙏 Package : Poetry Reference : TTUR