← 开源
vitoralbiero

img2pose

The official PyTorch implementation of img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation - CVPR 2021

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
613
Star
112
Fork
+0
本周
5
贡献者
创建于 2020-12-11 · 更新于 2026-07-30 · 今日第 16080 名
主要开发者
vitoralbieroTalHassnermavaa

vitoralbiero/img2pose 排名第 16,080,有 613 个星标。

同类别比较

vitoralbiero/img2pose 排名第 16,080,此处有 8 个同类条目;tegg89/SRCNN-Tensorflow 排名第 16,077。

同类别比较
名称排名指标
ServiceNow/N-BEATS16,063
语言:
Python
星标数:
613
分叉数:
131
简介:
N-BEATS is a neural-network based model for univariate timeseries forecasting. N-BEATS is a ServiceNow Research project that was started at Element AI.
araffin/sbx16,067
语言:
Python
星标数:
613
分叉数:
61
简介:
SBX: Stable Baselines Jax (SB3 + Jax) RL algorithms
bowenc0221/panoptic-deeplab16,068
语言:
Python
星标数:
613
分叉数:
116
简介:
This is Pytorch re-implementation of our CVPR 2020 paper "Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation" (https://arxiv.org/abs/1911.10194)
tegg89/SRCNN-Tensorflow16,077
语言:
Python
星标数:
613
分叉数:
270
简介:
Image Super-Resolution Using Deep Convolutional Networks in Tensorflow https://arxiv.org/abs/1501.00092v3
Neuraxio/Neuraxle16,083
语言:
Python
星标数:
612
分叉数:
62
简介:
The world's cleanest AutoML library ✨ - Do hyperparameter tuning with the right pipeline abstractions to write clean deep learning production pipelines. Let your pipeline steps have hyperparameter spaces. Design steps in your pipeline like components. Compatible with Scikit-Learn, TensorFlow, and most other libraries, frameworks and MLOps environments.
Relja/netvlad16,085
语言:
Matlab
星标数:
612
分叉数:
118
简介:
NetVLAD: CNN architecture for weakly supervised place recognition
anki/vector-python-sdk16,088
语言:
Python
星标数:
612
分叉数:
385
简介:
Anki Vector Python SDK
cszn/IRCNN16,093
语言:
MATLAB
星标数:
612
分叉数:
169
简介:
Learning Deep CNN Denoiser Prior for Image Restoration (CVPR, 2017) (Matlab)
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词3D, Computer vision
星标数613
分叉数112
贡献者5
创建日期2020-12-11
更新日期2026-07-30
1 天星标数0
7 天星标数0
排名16,080
上次排名15,879
排名变化-201
7 天星标排名15,332
上次 7 天星标排名15,341
7 天星标排名变化9
总星标排名16,505
上次总星标排名16,477
总星标排名变化-28
README 摘录

img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation Paper accepted to the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2021 Figure 1: We estimate the 6DoF rigid transformation of a 3D face (rendered in silver), aligning it with even the tiniest faces, without face detection or facial landmark localization. Our estimated 3D face locations are rendered by descending distances from the camera, for coherent visualization. TL;DR This repository provides a novel method for six degrees

of fredoom (6DoF) detection on multiple faces without the need of prior face detection. After prediction, one can visualize the detections (as show in the figure above), customize projected bounding boxes, or crop and align each face for further processing. Table of contents Paper details Abstract Video Spotlight Citation Installation Training Prepare WIDER FACE dataset Train Training on your own dataset Testing Visualizing trained model WIDER FACE dataset evaluation AFLW2000-3D dataset evaluation BIWI dataset evaluation Testing on your own

images Output customization Align faces Resources License Paper details Vítor Albiero, Xingyu Chen, Xi Yin, Guan Pang, Tal Hassner, "*img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation,*" CVPR, 2021, arXiv:2012. 07791 Abstract We propose real-time, six degrees of freedom (6DoF), 3D face pose estimation without face detection or landmark localization. We observe that estimating the 6DoF rigid transformation of a face is a simpler problem than facial landmark detection, often used for 3D face alignment

. In addition, 6DoF offers more information than face bounding box labels. (b) We explain how pose is converted and kept consistent between the input photo and arbitrary crops created while training and evaluating our model. (c) Finally, we show how face poses can replace detection bounding box training labels. Tests on AFLW2000-3D and BIWI show that our method runs at real-time and outperforms state of the art (SotA) face pose estimators. Remarkably, our method also surpasses SotA models

of comparable complexity on the WIDER FACE detection benchmark, despite not been optimized on bounding box labels. Video Spotlight CVPR 2021 Spotlight Citation If you use any part of our code or data, please cite our paper. Installation Install dependecies with Python 3. Install the renderer, which is used to visualize predictions. The renderer implementation is forked from here. Training Prepare WIDER FACE dataset First, download our annotations as instructed in Annotations. Download WIDER FACE dataset and extract to datasets

/WIDER_Face. Then, to create the train and validation files (LMDB), run the following scripts. This first script will generate a LMDB dataset, which contains the training images along with annotations. It will also output a pose mean and std deviation files, which will be used for training and testing. This second script will create a LMDB containing the validation images along with annotations. Train Once the LMDB train/val files are created, to start training simple run the script

below. To train with multiple GPUs (in the example below 4 GPUs), use the script below. Training on your own

常见问题

记录了多少星标和分叉?

vitoralbiero/img2pose 有 613 个星标和 112 个分叉。

仓库排名是多少?

vitoralbiero/img2pose 排名第 16,080。

记录的语言和类别是什么?

vitoralbiero/img2pose 有 613 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

vitoralbiero/img2pose 与 tegg89/SRCNN-Tensorflow 比较,后者排名第 16,077,有 613 个星标。

README

img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation

Paper accepted to the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2021

Figure 1: We estimate the 6DoF rigid transformation of a 3D face (rendered in silver), aligning it with even the tiniest faces, without face detection or facial landmark localization. Our estimated 3D face locations are rendered by descending distances from the camera, for coherent visualization.

TL;DR

This repository provides a novel method for six degrees of fredoom (6DoF) detection on multiple faces without the need of prior face detection. After prediction, one can visualize the detections (as show in the figure above), customize projected bounding boxes, or crop and align each face for further processing. See details below.

Table of contents

Paper details

Vítor Albiero, Xingyu Chen, Xi Yin, Guan Pang, Tal Hassner, "img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation," CVPR, 2021, arXiv:2012.07791

Abstract

We propose real-time, six degrees of freedom (6DoF), 3D face pose estimation without face detection or landmark localization. We observe that estimating the 6DoF rigid transformation of a face is a simpler problem than facial landmark detection, often used for 3D face alignment. In addition, 6DoF offers more information than face bounding box labels. We leverage these observations to make multiple contributions: (a) We describe an easily trained, efficient, Faster R-CNN--based model which regresses 6DoF pose for all faces in the photo, without preliminary face detection. (b) We explain how pose is converted and kept consistent between the input photo and arbitrary crops created while training and evaluating our model. (c) Finally, we show how face poses can replace detection bounding box training labels. Tests on AFLW2000-3D and BIWI show that our method runs at real-time and outperforms state of the art (SotA) face pose estimators. Remarkably, our method also surpasses SotA models of comparable complexity on the WIDER FACE detection benchmark, despite not been optimized on bounding box labels.

Video Spotlight

CVPR 2021 Spotlight

Citation

If you use any part of our code or data, please cite our paper.

@inproceedings{albiero2021img2pose,
  title={img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation},
  author={Albiero, Vítor and Chen, Xingyu and Yin, Xi and Pang, Guan and Hassner, Tal},
  booktitle={CVPR},
  year={2021},
  url={https://arxiv.org/abs/2012.07791},
}

Installation

Install dependecies with Python 3.

pip install -r requirements.txt

Install the renderer, which is used to visualize predictions. The renderer implementation is forked from here.

cd Sim3DR
sh build_sim3dr.sh

Training

Prepare WIDER FACE dataset

First, download our annotations as instructed in Annotations.

Download WIDER FACE dataset and extract to datasets/WIDER_Face.

Then, to create the train and validation files (LMDB), run the following scripts.

python3 convert_json_list_to_lmdb.py \
--json_list ./annotations/WIDER_train_annotations.txt \
--dataset_path ./datasets/WIDER_Face/WIDER_train/images/ \
--dest ./datasets/lmdb/ \
--train

This first script will generate a LMDB dataset, which contains the training images along with annotations. It will also output a pose mean and std deviation files, which will be used for training and testing.

python3 convert_json_list_to_lmdb.py  \
--json_list ./annotations/WIDER_val_annotations.txt  \
--dataset_path ./datasets/WIDER_Face/WIDER_val/images/  \
--dest ./datasets/lmdb

This second script will create a LMDB containing the validation images along with annotations.

Train

Once the LMDB train/val files are created, to start training simple run the script below.

CUDA_VISIBLE_DEVICES=0 python3 train.py \
--pose_mean ./datasets/lmdb/WIDER_train_annotations_pose_mean.npy \
--pose_stddev ./datasets/lmdb/WIDER_train_annotations_pose_stddev.npy \
--workspace ./workspace/ \
--train_source ./datasets/lmdb/WIDER_train_annotations.lmdb \
--val_source ./datasets/lmdb/WIDER_val_annotations.lmdb \
--prefix trial_1 \
--batch_size 2 \
--lr_plateau \
--early_stop \
--random_flip \
--random_crop \
--max_size 1400

To train with multiple GPUs (in the example below 4 GPUs), use the script below.

python3 -m torch.distributed.launch --nproc_per_node=4 --use_env train.py \
--pose_mean ./datasets/lmdb/WIDER_train_annotations_pose_mean.npy \
--pose_stddev ./datasets/lmdb/WIDER_train_annotations_pose_stddev.npy \
--workspace ./workspace/ \
--train_source ./datasets/lmdb/WIDER_train_annotations.lmdb \
--val_source ./datasets/lmdb/WIDER_val_annotations.lmdb \
--prefix trial_1 \
--batch_size 2 \
--lr_plateau \
--early_stop \
--random_flip \
--random_crop \
--max_size 1400 \
--distributed

Training on your own dataset

If your dataset has facial landmarks and bounding boxes already annotated, store them into JSON files following the same format as in the WIDER FACE annotations.

If not, run the script below to annotate your dataset. You will need a detector and import it inside the script.

python3 utils/annotate_dataset.py 
--image_list list_of_images.txt 
--output_path ./annotations/dataset_name

After the dataset is annotated, create a list pointing to the JSON files there were saved. Then, follow the steps in Prepare WIDER FACE dataset replacing the WIDER annotations with your own dataset annotations. Once the LMDB and pose files are created, follow the steps in Train replacing the WIDER LMDB and pose files with your dataset own files.

Testing

To evaluate with the pretrained model, download the model from Model Zoo, and extract it to the main folder. It will create a folder called models, which contains the model weights and the pose mean and std dev that was used for training.

If evaluating with own trained model, change the pose mean and standard deviation to the ones trained with.

Visualizing trained model

To visualize a trained model on the WIDER FACE validation set run the notebook visualize_trained_model_predictions.

WIDER FACE dataset evaluation

If you haven't done already, download the WIDER FACE dataset and extract to datasets/WIDER_Face.

Download the pre-trained model.

python3 evaluation/evaluate_wider.py \
--dataset_path datasets/WIDER_Face/WIDER_val/images/ \
--dataset_list datasets/WIDER_Face/wider_face_split/wider_face_val_bbx_gt.txt \
--pose_mean models/WIDER_train_pose_mean_v1.npy \
--pose_stddev models/WIDER_train_pose_stddev_v1.npy \
--pretrained_path models/img2pose_v1.pth \
--output_path results/WIDER_FACE/Val/

To check mAP and plot curves, download the eval tools and point to results/WIDER_FACE/Val.

AFLW2000-3D dataset evaluation

Download the AFLW2000-3D dataset and unzip to datasets/AFLW2000.

Download the fine-tuned model.

Run the notebook aflw_2000_3d_evaluation.

BIWI dataset evaluation

Download the BIWI dataset and unzip to datasets/BIWI.

Download the fine-tuned model.

Run the notebook biwi_evaluation.

Testing on your own images

Run the notebook test_own_images.

Output customization

For every face detected, the model outputs by default:

  • Pose: rx, ry, rz, tx, ty, tz
  • Projected bounding boxes: left, top, right, bottom
  • Face scores: 0 to 1

Since the projected bounding box without expansion ends at the start of the forehead, we provide a way of expanding the forehead invidually, along with default x and y expansion.

To customize the size of the projected bounding boxes, when creating the model change any of the bounding box expansion variables as shown below (a complete example can be seen at visualize_trained_model_predictions).

# how much to expand in width
bbox_x_factor = 1.1
# how much to expand in height
bbox_y_factor = 1.1
# how much to expand in the forehead
expand_forehead = 0.3

img2pose_model = img2poseModel(
    ...,    
    bbox_x_factor=bbox_x_factor,
    bbox_y_factor=bbox_y_factor,
    expand_forehead=expand_forehead,
)

Align faces

To detect and align faces, simply run the command below, passing the path to the images you want to detect and align and the path to save them.

python3 run_face_alignment.py \
--pose_mean models/WIDER_train_pose_mean_v1.npy \
--pose_stddev models/WIDER_train_pose_stddev_v1.npy \
--pretrained_path models/img2pose_v1.pth \
--images_path image_path_or_list \
--output_path path_to_save_aligned_faces

Resources

Model Zoo

Annotations

Data Zoo

License

Check license for license details.

排名相邻
同类项目