MICA (Metrical Reconstruction of Human Faces)

repository·master·Indexed 20 days ago

https://github.com/zielon/mica

A system for the metrical reconstruction of human faces based on the ECCV 2022 paper. MICA utilizes FLAME topologies to generate 3D meshes and parameters from images. It includes a unified dataset of approximately 2315 subjects across eight source datasets, providing registration meshes and fitted FLAME parameters for academic, non-commercial use.

Tokens
1.7K
Snippets
5
Records
14
Agent score
71%

What's inside MICA

  1. Overview of the MICA Dataset

    master

    The MICA dataset is a collection of eight smaller datasets unified under a common FLAME topology, covering approximately 2315 subjects. It provides registration meshes and corresponding fitted FLAME parameters.

    Note: This dataset contains shape geometry only. To obtain the actual images for each subject, you must refer to the primary source datasets listed in the documentation.

  2. MICA Dataset License and Usage

    master

    The MICA dataset is for academic, non-commercial usage only.

    Because MICA is an extension of existing datasets, the license is shared. You must also comply with the original licenses of each source dataset (e.g., Stirling, D3DFACS, Florence, LYHM, FaceWarehouse, FRGC, BP4D+), particularly regarding data privacy.

  3. Run testing routines

    master
    Testing routines for the Stirling and NoW datasets are available in the models directory of the repository. These scripts generate the corresponding meshes for evaluation. To calculate the error for the NoW challenge, use the now_evaluation repository.
  4. Install MICA via the installation script

    master

    The easiest way to set up MICA is to use the provided install.sh script. This script handles the Conda environment creation and the downloading of required models. During execution, you will be prompted to provide your FLAME account credentials ({flame_user} and {flame_password}) to access the FLAME2020 model file server.

    git clone https://github.com/Zielon/MICA.git
    cd MICA
    ./install.sh
  5. Manual Installation and Model Setup

    master

    If you prefer to install manually, follow these steps:

    1. Environment: Create the Conda environment using the provided file: conda env create -f environment.yml

    2. FLAME2020 Model: Create an account at flame.is.tue.mpg.de, download the model, and place it in the /data/pretrained/FLAME2020/ directory.

    3. MICA Pre-trained Model: Download the pre-trained model and place it in /data/pretrained/mica.tar.

    4. InsightFace Models: Download antelopev2 and buffalo_l, unzip them, and place them in ~/.insightface/models/.

  6. Train MICA from scratch

    master

    To train MICA, you need images from all eight datasets included in the MICA dataset collection.

    If you are training from scratch and require Arcface model initialization, you must download Glint360K and specify its path in your configuration file using the key cfg.model.arcface_pretrained_model.

  7. Prepare the MICA Training Dataset

    master
    To prepare the training dataset, use the scripts located in the datasets/creation folder. A complete mapping of .npz FLAME parameter files to their original image names is available in the datasets/image_paths folder, which stores the data as a dictionary.
  8. Retrieve and Load FLAME2020 Parameters

    master

    The dataset provides FLAME parameters stored in .npz files. You can load these using numpy and convert them to torch tensors for use in your models. The parameters include pose and betas.

    import numpy as np
    import torch
    
    params = np.load('path.npz', allow_pickle=True)
    pose = torch.tensor(params['pose']).float()
    betas = torch.tensor(params['betas']).float()
    
    flame = {
        'shape_params': betas[:300],
        'expression_params': betas[300:],
        'pose_params': torch.cat([pose[:3], pose[6:9]]),
    }
  9. Run the MICA demo

    master

    To perform a quick demonstration of MICA, run the demo.py script. The script automatically processes all images located in the demo/input/ folder. For each subject processed, it generates:

    • A .ply mesh file
    • A rendered image
    • A .npy file containing the FLAME parameters.
    python demo.py