• Stars
    star
    169
  • Rank 223,151 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

To obtain high resolution face images from CelebA

HD CelebA Cropper

CelebA dataset provides an aligned set img_align_celeba.zip. However, the size of each aligned image is 218x178, so the faces cropped from such images would be even smaller!

Here we provide a code to obtain higher resolution face images, by cropping the faces from the original unaligned images via 68 landmarks.

We also use a deep image quality assessment method to evaluate and rank the cropped image quality in scores.txt, lower score the better.

Cropped Faces (512x512)

Notice: There are still some low resolution cropped faces since the corresponding original images are low resolution.

Usage

  • Prerequisites

    • OpenCV

    • Python 3.6

  • Dataset

    • CelebA-unaligned (10.2GB, higher quality than the aligned data)

      • download the dataset

      • unzip the data

        7z x ./data/img_celeba.7z/img_celeba.7z.001 -o./data/
        
        unzip ./data/annotations.zip -d ./data/
  • Cropping Examples

    • 512x512 + lanczos4 + jpg

      python align.py --crop_size_h 512 --crop_size_w 512 --order 4 --save_format jpg --n_worker 32

    • 512x512 + lanczos4 + png + larger face in the image (by setting face_factor, default is 0.45)

      python align.py --crop_size_h 512 --crop_size_w 512 --order 4 --save_format png --face_factor 0.6 --n_worker 32

    • 384x384 + bicubic + jpg + smaller face in the image (by setting face_factor, default is 0.45)

      python align.py --crop_size_h 384 --crop_size_w 384 --order 3 --save_format jpg --face_factor 0.3 --n_worker 32

  • Notice

    • order

      • 0: INTER_NEAREST

      • 1: INTER_LINEAR

      • 2: INTER_AREA

      • 3: INTER_CUBIC

      • 4: INTER_LANCZOS4

      • 5: INTER_LANCZOS4