This is unofficial inference implementation of DensePose from detectron2
The project is focused on creating simple and TorchScript compilable inference interface for the original pretrained models to free them from the heavy dependency on the detectron2 framework.
Only inference is supported, no training. Also no confidence estimation or bootstapping pipelines were implemented.
To run already exported model (which you might find in the Releases section) you only need PyTorch and OpenCV (for image reading):
pip install torch torchvision opencv-python
Then you can run the model using the small example script:
python run.py <model.pt> <input.[jpg|png|mp4|avi]>
This will run the model and save the result in the same directory as the input.
To export a model you need to have a model checkpoint and a config file. You can find them in the table below
python export.py <config> <model> [--fp16]
If --fp16 is specified, the model will be exported in fp16 mode. This will reduce the model size at the cost of precision.
Example of exporting an R_50_FPN_s1x_legacy model into fp16 format model:
python export.py configs/densepose_rcnn_R_50_FPN_s1x_legacy.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_s1x_legacy/164832157/model_final_d366fa.pkl --fp16
All models available for download are licensed under the Creative Commons Attribution-ShareAlike 3.0 license
Baselines trained using schedules from Güler et al, 2018
Name | lr sched |
train time (s/iter) |
inference time (s/im) |
train mem (GB) |
box AP |
segm AP |
dp. AP GPS |
dp. AP GPSm |
model id | download |
---|---|---|---|---|---|---|---|---|---|---|
R_50_FPN_s1x_legacy | s1x | 0.307 | 0.051 | 3.2 | 58.1 | 58.2 | 52.1 | 54.9 | 164832157 | model | metrics |
R_101_FPN_s1x_legacy | s1x | 0.390 | 0.063 | 4.3 | 59.5 | 59.3 | 53.2 | 56.0 | 164832182 | model | metrics |
python export.py configs/densepose_rcnn_R_50_FPN_s1x_legacy.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_s1x_legacy/164832157/model_final_d366fa.pkl
python export.py configs/densepose_rcnn_R_101_FPN_s1x_legacy.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_101_FPN_s1x_legacy/164832182/model_final_10af0e.pkl
These models use an improved training schedule and Panoptic FPN head from Kirillov et al, 2019.
Name | lr sched |
train time (s/iter) |
inference time (s/im) |
train mem (GB) |
box AP |
segm AP |
dp. AP GPS |
dp. AP GPSm |
model id | download |
---|---|---|---|---|---|---|---|---|---|---|
R_50_FPN_s1x | s1x | 0.359 | 0.066 | 4.5 | 61.2 | 67.2 | 63.7 | 65.3 | 165712039 | model | metrics |
R_101_FPN_s1x | s1x | 0.428 | 0.079 | 5.8 | 62.3 | 67.8 | 64.5 | 66.2 | 165712084 | model | metrics |
python export.py configs/densepose_rcnn_R_50_FPN_s1x.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_s1x/165712039/model_final_162be9.pkl
python export.py configs/densepose_rcnn_R_101_FPN_s1x.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_101_FPN_s1x/165712084/model_final_c6ab63.pkl
These models use an improved training schedule, Panoptic FPN head from Kirillov et al, 2019 and DeepLabV3 head from Chen et al, 2017.
Name | lr sched |
train time (s/iter) |
inference time (s/im) |
train mem (GB) |
box AP |
segm AP |
dp. AP GPS |
dp. AP GPSm |
model id | download |
---|---|---|---|---|---|---|---|---|---|---|
R_50_FPN_DL_s1x | s1x | 0.392 | 0.070 | 6.7 | 61.1 | 68.3 | 65.6 | 66.7 | 165712097 | model | metrics |
R_101_FPN_DL_s1x | s1x | 0.478 | 0.083 | 7.0 | 62.3 | 68.7 | 66.3 | 67.6 | 165712116 | model | metrics |
python export.py configs/densepose_rcnn_R_50_FPN_DL_s1x.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_DL_s1x/165712097/model_final_0ed407.pkl
python export.py configs/densepose_rcnn_R_101_FPN_DL_s1x.yaml https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_101_FPN_DL_s1x/165712116/model_final_844d15.pkl
@InProceedings{Guler2018DensePose,
title={DensePose: Dense Human Pose Estimation In The Wild},
author={R\{i}za Alp G\"uler, Natalia Neverova, Iasonas Kokkinos},
journal={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2018}
}