Generate face mesh dataset using Google's FaceMesh model from annotated face datasets.
There are built in features to help generating the dataset more efficiently.
- Automatically centralize the marked face.
- Rotate the image to align the face horizontally.
- Crop the face with custom scale range.
- Generate mark heatmaps.
- Write TensorFlow Record files, or export the processed image and marks.
- Support multiple public datasets. Check the full list here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
First clone this repo.
# From your favorite development directory git clone https://github.com/yinguobing/face-mesh-generator.git
Then download Google's FaceMesh tflite model and put it in the
How to run
Take WFLW as an example. Download the dataset files from the official website. Extract all files to one directory.
First, Construct the dataset.
ds_wflw = fmd.wflw.WFLW("wflw") ds_wflw.populate_dataset(wflw_dir)
wflw_dir is the directory for the extracted files.
Then, process the dataset.
There is a demo file
generate_mesh_dataset.py demonstrating how to generate face mesh data and save them in a TFRecord file. Please refer to it for more details.
Yin Guobing (尹国冰) - yinguobing