Home

Awesome

facial-landmark-dataset

A collection of public facial landmark datasets and the Python code to make use of them.

Watch this 1 minute introduction video.

Supported Datasets

NameAuthorPublished#Marks#Samples
300-WImperial College London201368600
300-VWImperial College London201568218597
AFWImperial College London201368337
AFLW2000-3DChinese Academy of Sciences2015682000
HELENImperial College London2013682330
IBUGImperial College London201368135
LFPWImperial College London2013681035
WFLWTsinghua National Laboratory20189810000

Face images and mark coordinates are required. Some dataset used existing images from other dataset, in which case the dataset was named after the image dataset.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

OpenCV 4.x

Installing

Just git clone this repo and you are good to go.

# From your favorite development directory
git clone https://github.com/yinguobing/facial-landmark-dataset

How to run

First, initialize the dataset. Take 300W as an example.

from fmd.ds300w import DS300W

# Set the path to the dataset directory.
DS300W_DIR = "/home/robin/data/facial-marks/300W"

# Construct a dataset.
ds = DS300W("300w")

# Populate the dataset with essential data
ds.populate_dataset(DS300W_DIR)

# See what we have got.
print(ds)

Possible output:

name: 300w
authors: Imperial College London
year: 2013
num_marks: 68
num_samples: 600

Pick one sample, randomly

Once the dataset is constructed:

sample = ds.pick_one()

Enumerate the dataset

This could be useful when you are trying to transform or export the dataset.

for sample in ds:
    # do whatever you want, like
    print(sample.marks)

Read image file

Read in the image file as a numpy array, and show the image.

image = sample.read_image()

import cv2
cv2.imshow("Preview", image)
cv2.waitKey()

Get the full marks

facial_marks = sample.marks

Get the key marks

The key marks are: left eye left corner, left eye right corner, right eye left corner, right eye right corner, mouse left corner, mouse right corner.

key_marks = sample.get_key_marks()

Draw the marks

draw_marks(image, facial_marks)

Authors

Yin Guobing (尹国冰) - yinguobing

wechat

License

GitHub

Acknowledgments

All the dataset authors who made their data public.