VGGFace2-HQ
The first open source high resolution dataset for face swapping!!!
A high resolution version of VGGFace2 for academic face editing purpose.This project uses GFPGAN for image restoration and insightface for data preprocessing (crop and align).
We provide a download link for users to download the data, and also provide guidance on how to generate the VGGFace2 dataset from scratch.
If you find this project useful, please star it. It is the greatest appreciation of our work.
Get the VGGFace2-HQ dataset from cloud!
We have uploaded the dataset of VGGFace2 HQ to the cloud, and you can download it from the cloud.
[Baidu Drive] Password: sjtu
Google Drive is coming, it will take a while to upload all the files to Google Drive.
Generate the HQ dataset by yourself. (If you want to do so)
Preparation
Installation
We highly recommand that you use Anaconda for Installation
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch
pip install insightface==0.2.1 onnxruntime
(optional) pip install onnxruntime-gpu==1.2.0
pip install basicsr
pip install facexlib
pip install -r requirements.txt
python setup.py develop
- The pytorch and cuda versions above are most recommanded. They may vary.
- Using insightface with different versions is not recommanded. Please use this specific version.
- These settings are tested valid on both Windows and Ununtu.
Pretrained model
- We use the face detection and alignment methods from insightface for image preprocessing. Please download the relative files and unzip them to ./insightface_func/models from this link.
- Download GFPGANCleanv1-NoCE-C2.pth from GFPGAN offical repo. Place "GFPGANCleanv1-NoCE-C2.pth" in ./experiments/pretrained_models.
Data preparation
- Download VGGFace2 Dataset from VGGFace2 Dataset for Face Recognition
Inference
- Frist, perform data preprocessing on all photos in VGGFACE2, that is, detect faces and align them to the same alignment format as FFHQdataset.
python scripts/crop_align_vggface2_FFHQalign.py --input_dir $DATAPATH$/VGGface2/train --output_dir_ffhqalign $ALIGN_OUTDIR$ --mode ffhq --crop_size 256
- And then, do the magic of image restoration with GFPGAN for processed photos.
python scripts/inference_gfpgan_forvggface2.py --input_path $ALIGN_OUTDIR$ --batchSize 8 --save_dir $HQ_OUTDIR$