Filtered-Laion-Face / README.md
csyxwei's picture
upload data
a8c1b6c
|
raw
history blame
No virus
2.65 kB

Filtered Laion Face


This repository provides the pipeline to construt the face augmneted dataset used in MasterWeaver. The dataset contains ~160k text-image pairs from the LAION-Face dataset. We have generated the corresponding captions using BLIP2 and created several attribute-augmented faces.

Steps to Construct the Dataset

1. Clone the Repository

git clone https://huggingface.co/datasets/csyxwei/Filtered-Laion-Face
cd Filtered-Laion-Face

2. Download images

We have provided links of filerted laion face images in filtered_laion_faces.parquet. You can download the original image using img2dataset tool:

pip install img2dataset

img2dataset --url_list ./filtered_laion_faces.parquet --input_format "parquet" \
        --url_col "URL" --caption_col "TEXT" --output_format files \
        --output_folder ./filtered_laion_faces/images --processes_count 16 --thread_count 128 --resize_mode no \
            --save_additional_columns '["NSFW","similarity","LICENSE","SAMPLE_ID"]'

The downloaded images will be saved in the ./filtered_laion_faces/images directory.

3. Process Laion Face Images

Next, use dlib and a face parsing model to crop and align the downloaded images:

cd data_scripts

CUDA_VISIBLE_DEVICES=4 python process_images.py

4. Augment the Face Images

After processing, construct the augmented faces using DeltaEdit. Refer to its official repository for configuration details.

Then, run the following command::

cd ../delta_edit

CUDA_VISIBLE_DEVICES=7 python scripts/inference_laion.py \
--image_dir "../filtered_laion_faces/images_cropped_face" \
--save_dir "../filtered_laion_faces/images_cropped_face_aug/" \
--target ""

The final directory structure will be as follows:

filtered_laion_faces
└─ images
└─ images_cropped
└─ images_cropped_face
└─ images_cropped_face_mask
└─ images_cropped_face_aug
└─ captions

Acknowledgements

This dataset is built upon the Laion Face dataset with tools from FFHQ, face-parsing.PyTorch, and DeltaEdit. We thank the authors for sharing the datasets and code.