FFHQ - xyfJASON/image-datasets GitHub Wiki

Links

Official website | Papers with Code | Google drive

Brief introduction

Copied from paperswithcode.

Flickr-Faces-HQ (FFHQ) consists of 70,000 high-quality PNG images at 1024×1024 resolution and contains considerable variation in terms of age, ethnicity and image background. It also has good coverage of accessories such as eyeglasses, sunglasses, hats, etc. The images were crawled from Flickr, thus inheriting all the biases of that website, and automatically aligned and cropped using dlib. Only images under permissive licenses were collected. Various automatic filters were used to prune the set, and finally Amazon Mechanical Turk was used to remove the occasional statues, paintings, or photos of photos.

Statistics

Numbers: 70,000

Splits: 60,000 / 10,000 (train / test)

Resolution: 1024×1024

Files

Content Filename Size
Metadata ffhq-dataset-v2.json 255 MB
Aligned and cropped images at 1024×1024 images1024x1024.zip 89.1 GB
Thumbnails at 128×128 thumbnails128x128.zip 1.95 GB
Original images from Flickr in-the-wild-images.zip 955 GB
Multi-resolution data for StyleGAN and StyleGAN2 tfrecords.zip 273 GB

Usage

Notes: The authors provide several versions of dataset (see the table here), among which images1024x1024 is the most commonly used one. This package supports images1024x1024 and thumbnails128x128 for now.

File structure

Please organize the downloaded dataset in the following file structure:

root
├── ffhq-dataset-v2.json
├── LICENSE.txt
├── README.txt
├── thumbnails128x128
│   ├── 00000.png
│   ├── ...
│   └── 69999.png
└── images1024x1024
    ├── 00000.png
    ├── ...
    └── 69999.png

API Reference

FFHQ(root: str, split: str = 'train', version: str = 'images1024x1024', transforms: Optional[Callable] = None)
  • root: Root directory of dataset.
  • split: One of {'train', 'test', 'all'}.
  • version: One of {'images1024x1024', 'thumbnails128x128'}.
  • transforms: A function/transform that takes in an PIL image and returns a transformed version.

Example

from image_datasets import FFHQ

root = '~/data/FFHQ/'  # path to the dataset
train_set = FFHQ(root=root, split='train')
test_set = FFHQ(root=root, split='test')
all_set = FFHQ(root=root, split='all')
print(len(train_set))  # 60000
print(len(test_set))   # 10000
print(len(all_set))    # 70000
print(train_set[0])    # <PIL.PngImagePlugin.PngImageFile image mode=RGB size=1024x1024 at 0x7FD1B8BF1A50>
⚠️ **GitHub.com Fallback** ⚠️