# Technical Documentation: facebookresearch/DensePose

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/facebookresearch/DensePose)

### Overview (`README.md`)

# DensePose: 
**Dense Human Pose Estimation In The Wild**

_Rıza Alp Güler, Natalia Neverova, Iasonas Kokkinos_

[[`densepose.org`](https://densepose.org)] [[`arXiv`](https://arxiv.org/abs/1802.00434)] [[`BibTeX`](#CitingDensePose)]

Dense human pose estimation aims at mapping all human pixels of an RGB image to the 3D surface of the human body. 
DensePose-RCNN is implemented in the [Detectron](https://github.com/facebookresearch/Detectron) framework and is powered by [Caffe2](https://github.com/caffe2/caffe2).

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1qfSOkpueo1kVZbXOuQJJhyagKjMgepsz" width="700px" />
</div>


In this repository, we provide the code to train and evaluate DensePose-RCNN. We also provide notebooks to visualize the collected DensePose-COCO dataset and show the correspondences to the SMPL model.

## Important Note

**!!! This project is no longer supported !!!**

DensePose is now part of Detectron2 (https://github.com/facebookresearch/detectron2/tree/master/projects/DensePose). There you can find the most up to date architectures / models. If you think some feature is missing from there, please post an issue in [Detectron2 DensePose](https://github.com/facebookresearch/detectron2/tree/master/projects/DensePose).

## Installation

Please find installation instructions for Caffe2 and DensePose in [`INSTALL.md`](INSTALL.md), a document based on the [Detectron](https://github.com/facebookresearch/Detectron) installation instructions.

## Inference-Training-Testing

After installation, please see [`GETTING_STARTED.md`](GETTING_STARTED.md)  for examples of inference and training and testing.

## Notebooks

### Visualization of DensePose-COCO annotations:

See [`notebooks/DensePose-COCO-Visualize.ipynb`](notebooks/DensePose-COCO-Visualize.ipynb) to visualize the DensePose-COCO annotations on the images:

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1uYRJkIA24KkJU2i4sMwrKa61P0xtZzHk" width="800px" />
</div>

---

### DensePose-COCO in 3D:

See [`notebooks/DensePose-COCO-on-SMPL.ipynb`](notebooks/DensePose-COCO-on-SMPL.ipynb) to localize the DensePose-COCO annotations on the 3D template ([`SMPL`](http://smpl.is.tue.mpg.de)) model:

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1m32oyMuE7AZd3EOf9k8zHpr75C8bHlYj" width="500px" />
</div>

---
### Visualize DensePose-RCNN Results:

See [`notebooks/DensePose-RCNN-Visualize-Results.ipynb`](notebooks/DensePose-RCNN-Visualize-Results.ipynb) to visualize the inferred DensePose-RCNN Results.

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1k4HtoXpbDV9MhuyhaVcxDrXnyP_NX896" width="900px" />
</div>

---
### DensePose-RCNN Texture Transfer:

See [`notebooks/DensePose-RCNN-Texture-Transfer.ipynb`](notebooks/DensePose-RCNN-Texture-Transfer.ipynb) to localize the DensePose-COCO annotations on the 3D template ([`SMPL`](http://smpl.is.tue.mpg.de)) model:

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1r-w1oDkDHYnc1vYMbpXcYBVD1-V3B4Le" width="900px" />
</div>

## License

This source code is licensed under the license found in the [`LICENSE`](LICENSE) file in the root directory of this source tree.

## <a name="CitingDensePose"></a>Citing DensePose

If you use Densepose, please use the following BibTeX entry.

```
  @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}
  }
```

---

### Overview (`PoseTrack/README.md`)

#  DensePose-PoseTrack
We introduce the DensePose-Posetrack dataset, which consists of videos of multiple persons containing rapid motions, occlusions and scale variations which leads to a very challenging correspondence task. DensePose-PoseTrack will be a part of the [ECCV 2018 - POSETRACK CHALLENGE](https://posetrack.net/workshops/eccv2018/).

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1fed2Xvy2G6t4V_ICsEJIm-PaJ8o-e0Ws" width="700px" />
</div>

Please first follow the [INSTALL.md](https://github.com/facebookresearch/DensePose/blob/master/INSTALL.md) and [GETTING_STARTED.md](https://github.com/facebookresearch/DensePose/blob/master/GETTING_STARTED.md), to install and run the DensePose inference and training. Herein, we provide instructions to download and evaluate on the DensePose-PoseTrack dataset.

### Fetch DensePose-PoseTrack dataset

To download the images of the original PoseTrack dataset, please refer to the posetrack webpage: https://posetrack.net. Note that we have used the keypoints provided in the PoseTrack dataset to form the DensePose-PoseTrack dataset. Our dense correspondence annotations are distributed under [NonCommercial Creative Commons](https://creativecommons.org/licenses/by-nc/2.0/) license.

To downoad, run:
```
cd $DENSEPOSE/PoseTrack
bash get_DensePose_PoseTrack.sh
```
This script downloads *.json files that contains all annotations along with files that only contains annotations for images with densepose annotations. The latter is used during evaluation.

Visualization of the DensePose-PoseTrack annotations are demonstrated in the [DensePose-PoseTrack-Visualize.ipynb](https://github.com/facebookresearch/DensePose/blob/master/PoseTrack/DensePose-PoseTrack-Visualize.ipynb):

<div align="center">
  <img src="https://drive.google.com/uc?export=view&id=1jUNl07Rw_Y7IRvZimaChfQPDIDkWqxzc" width="600px" />
</div>


## Setting-up the PoseTrack dataset.

Create a symlink for the PoseTrack dataset in your `datasets/data` folder.
```
ln -s /path/to/posetrack $DENSEPOSE/detectron/datasets/data/posetrack
```
Create symlinks for the DensePose-PoseTrack annotations

```
ln -s $DENSEPOSE/PoseTrack/DensePose_PoseTrack/densepose_only_posetrack_train2017.json $DENSEPOSE/detectron/datasets/data/posetrack/
ln -s $DENSEPOSE/PoseTrack/DensePose_PoseTrack/densepose_only_posetrack_val2017.json $DENSEPOSE/detectron/datasets/data/posetrack/
ln -s $DENSEPOSE/PoseTrack/DensePose_PoseTrack/densepose_posetrack_test2017.json $DENSEPOSE/detectron/datasets/data/posetrack/
```
Your local PoseTrack dataset copy at `/path/to/posetrack` should have the following directory structure:

```
posetrack
|_ images
|  |_ <im-folder-1>
|  |_ ...
|  |_ <im-folder-N>.
|_ densepose_only_posetrack_train2017.json
|_ densepose_only_posetrack_val2017.json
|_ densepose_posetrack_test2017.json
```

### Evaluation on DensePose-PoseTrack dataset

To demonstrate the evaluation, we use a DensePose-RCNN with a ResNet-50 trunk that is trained on the DensePose-COCO dataset.
```
cd $DENSEPOSE
python2 tools/test_net.py \
    --cfg PoseTrack/configs/DensePose_ResNet50_FPN_s1x-e2e.yaml \
    TEST.WEIGHTS https://dl.fbaipublicfiles.com/densepose/DensePose_ResNet50_FPN_s1x-e2e.pkl \
    NUM_GPUS 1
```
The evaluation of this baseline network should yield `Bounding Box AP: 0.4438` and `DensePose AP: 0.2698`.

---

### Overview (`challenge/2018_COCO_DensePose/readme.md`)

# COCO 2018 DensePose Task



## Overview

The COCO DensePose Task requires dense estimation of human pose in challenging,
uncontrolled conditions. The DensePose task involves simultaneously detecting
people, segmenting their bodies and mapping all image pixels that belong to a
human body to the 3D surface of the body. For full details of this task please
see the [DensePose evaluation](evaluation.md) page.

This task is part of the
[Joint COCO and Mapillary Recognition Challenge Workshop](http://cocodataset.org/workshop/coco-mapillary-eccv-2018.html)
at ECCV 2018. For further details about the joint workshop please
visit the workshop page. Please also see the related COCO
[detection](http://cocodataset.org/workshop/coco-mapillary-eccv-2018.html#coco-detection),
[panoptic](http://cocodataset.org/workshop/coco-mapillary-eccv-2018.html#coco-panoptic),
[keypoints](http://cocodataset.org/workshop/coco-mapillary-eccv-2018.html#coco-keypoints)
and [stuff](http://cocodataset.org/#stuff-2018) tasks.

The COCO train, validation, and test sets, containing more than 39,000 images
and 56,000 person instances labeled with DensePose annotations are available
for [download](http://cocodataset.org/#download).
Annotations on train (
[train 1](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_train.json),
[train 2](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_valminusminival.json)
) and [val](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_minival.json)
with over 48,000 people are publicly available.
[Test set](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_test.json)
with the list of images is also available for download.

Evaluation server for the 2018 task is
[open](https://competitions.codalab.org/competitions/19636).

## Dates

[]() | []()
---- | -----
**August 17, 2018** | Submission deadline (23:59 PST)
August 26, 2018   | Challenge winners notified
September 9, 2018 | Winners present at ECCV 2018 Workshop

## Organizers

Riza Alp Güler (INRIA, CentraleSupélec)

Natalia Neverova (Facebook AI Research)

Iasonas Kokkinos (Facebook AI Research)

## Task Guidelines

Participants are recommended but not restricted to train
their algorithms on COCO DensePose train and val sets.
The [download](http://cocodataset.org/#download) page has
links to all COCO data. When participating in this task,
please specify any and all external data used for training
in the "method description" when uploading results to the
evaluation server. A more thorough explanation of all these
details is available on the
[guidelines](http://cocodataset.org/#guidelines) page,
please be sure to review it carefully prior to participating.
Results in the [correct format](results_format.md) must be
[uploaded](upload.md) to the
[evaluation server](https://competitions.codalab.org/competitions/19636).
The [evaluation](evaluation.md) page lists detailed information
regarding how results will be evaluated. Challenge participants
with the most successful and innovative methods will be invited
to present at the workshop.

## Tools and Instructions

We provide extensive API support for the COCO images,
annotations, and evaluation code. To download the COCO DensePose API,
please visit our
[GitHub repository](https://github.com/facebookresearch/DensePose/).
Due to the large size of COCO and the complexity of this task,
the process of participating may not seem simple. To help, we provide
explanations and instructions for each step of the process:
[download](http://cocodataset.org/#download),
[data format](data_format.md),
[results format](results_format.md),
[upload](upload.md) and [evaluation](evaluation.md) pages.
For additional questions, please contact info@cocodataset.org.

---

### Overview (`challenge/2018_PoseTrack_DensePose/readme.md`)

# ECCV 2018 PoseTrack DensePose Task



## Overview

The PoseTrack DensePose Task requires dense estimation of human pose through time
in challenging, uncontrolled conditions. The task involves processing video frames
to simultaneously detect people, segment their bodies and map all image pixels
that belong to a human body to the 3D surface of the body. For full details on
this task please see the [evaluation](evaluation.md) page.

This task is part of the
[PoseTrack Challenge Workshop](https://posetrack.net/workshops/eccv2018/)
at ECCV 2018. For further details about the workshop please
visit the workshop page. Please also see the related PoseTrack
[Articulated Human Pose Estimation and Tracking](https://posetrack.net/workshops/eccv2018/#challenges)
and 
[3D Human Pose Estimation](https://posetrack.net/workshops/eccv2018/#challenges)
tasks.

The PoseTrack DensePose train, validation, and test sets, containing more
than 5,000 images
and 27,000 person instances labeled with DensePose annotations are available
for [download](https://posetrack.net/users/download.php).
Annotations on
[train](https://www.dropbox.com/s/tpbaemzvlojo2iz/densepose_only_posetrack_train2017.json?dl=1)
and
[val](https://www.dropbox.com/s/43h43s0t3hkuogr/densepose_only_posetrack_val2017.json?dl=1)
with over 13,000 people are publicly available.

Evaluation server for the 2018 task is
[open](https://competitions.codalab.org/competitions/19650).

## Dates

[]() | []()
---- | -----
**August 18, 2018** | Submission deadline (23:59 PST)
September 2, 2018   | Challenge winners notified
September 8, 2018 | Winners present at ECCV 2018 Workshop

## Organizers

Riza Alp Güler (INRIA, CentraleSupélec)

Natalia Neverova (Facebook AI Research)

Iasonas Kokkinos (Facebook AI Research)

## Task Guidelines

Participants are recommended but not restricted to train
their algorithms on PoseTrack DensePose train and val sets.
The [download](https://posetrack.net/users/download.php) page has
links to the image data. When participating in this task,
please specify any and all external data used for training
in the "method description" when uploading results to the
evaluation server. **Listing external data used is mandatory.**
We emphasize that any form of **annotation or use of the test sets
for supervised or unsupervised training is strictly forbidden**.
A more thorough explanation of all these
details is available on the
[upload](upload.md) page,
please be sure to review it carefully prior to participating.
Results in the [correct format](results_format.md) must be
[uploaded](upload.md) to the
[evaluation server](https://competitions.codalab.org/competitions/19650).
The [evaluation](evaluation.md) page lists detailed information
regarding how results will be evaluated. Challenge participants
with the most successful and innovative methods will be invited
to present at the workshop.

## Tools and Instructions

We provide extensive API support for the images, annotations,
and evaluation code. To download the COCO DensePose API,
please visit our
[GitHub repository](https://github.com/facebookresearch/DensePose/).
Due to the complexity of this task, the process of participating
may not seem simple. To help, we provide explanations and
instructions for each step of the process:
[download](https://posetrack.net/users/download.php),
[data format](data_format.md),
[results format](results_format.md),
[upload](upload.md) and [evaluation](evaluation.md) pages.

---

### Overview (`challenge/2019_COCO_DensePose/readme.md`)

# COCO 2019 DensePose Task



## Overview

The COCO DensePose Task requires dense estimation of human pose in challenging,
uncontrolled conditions. The DensePose task involves simultaneously detecting
people, segmenting their bodies and mapping all image pixels that belong to a
human body to the 3D surface of the body. For full details of this task please
see the [DensePose evaluation](evaluation.md) page.

This task is part of the
[COCO+Mapillary Joint Recognition Challenge Workshop](http://cocodataset.org/workshop/coco-mapillary-iccv-2019.html)
at ICCV 2019. For further details about the joint workshop, as well as **new rules regarding technical reports and awards**, please
visit the workshop page. 
Please also see the related COCO
[detection](http://cocodataset.org/workshop/coco-mapillary-iccv-2019.html#coco-detection),
[panoptic](http://cocodataset.org/workshop/coco-mapillary-iccv-2019.html#coco-panoptic)
and
[keypoints](http://cocodataset.org/workshop/coco-mapillary-iccv-2019.html#coco-keypoints)
tasks.

The COCO train, validation, and test sets, containing more than 39,000 images
and 56,000 person instances labeled with DensePose annotations are available
for [download](http://cocodataset.org/#download).
Annotations on train (
[train 1](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_train.json),
[train 2](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_valminusminival.json)
) and [val](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_minival.json)
with over 48,000 people are publicly available.
[Test set](https://dl.fbaipublicfiles.com/densepose/densepose_coco_2014_test.json)
with the list of images is also available for download.

Evaluation server for the 2019 task is
[open](https://competitions.codalab.org/competitions/20660).

## Dates

[]() | []()
---- | -----
**October 4, 2019** | Submission deadline (23:59 PST)
October 11, 2019  | Technical report submission deadline
October 18, 2019  | Challenge winners notified
October 27, 2019  | Winners present at ICCV 2019 Workshop

## Organizers

Vasil Khalidov (Facebook AI Research)

Natalia Neverova (Facebook AI Research)

Riza Alp Güler (Imperial College London / Ariel AI)

Iasonas Kokkinos (UCL / Ariel AI)

## Task Guidelines

Participants are recommended but not restricted to train
their algorithms on COCO DensePose train and val sets.
The [download](http://cocodataset.org/#download) page has
links to all COCO data. When participating in this task,
please specify any and all external data used for training
in the "method description" when uploading results to the
evaluation server. A more thorough explanation of all these
details is available on the
[guidelines](http://cocodataset.org/#guidelines) page,
please be sure to review it carefully prior to participating.
Results in the [correct format](results_format.md) must be
[uploaded](upload.md) to the
[evaluation server](https://competitions.codalab.org/competitions/20660).
The [evaluation](evaluation.md) page lists detailed information
regarding how results will be evaluated. Challenge participants
with the most successful and innovative methods will be invited
to present at the workshop.

## Tools and Instructions

We provide extensive API support for the COCO images,
annotations, and evaluation code. To download the COCO DensePose API,
please visit our
[GitHub repository](https://github.com/facebookresearch/DensePose/).
Due to the large size of COCO and the complexity of this task,
the process of participating may not seem simple. To help, we provide
explanations and instructions for each step of the process:
[download](http://cocodataset.org/#download),
[data format](data_format.md),
[results format](results_format.md),
[upload](upload.md) and [evaluation](evaluation.md) pages.
For additional questions, please contact vkhalidov@fb.com and nneverova@fb.com.

---

### Overview (`detectron/datasets/data/README.md`)

# Setting Up Datasets

This directory contains symlinks to data locations.

## Creating Symlinks for COCO

Symlink the COCO dataset:

```
ln -s /path/to/coco $DETECTRON/detectron/datasets/data/coco
```

We assume that your local COCO dataset copy at `/path/to/coco` has the following directory structure:

```
coco
|_ coco_train2014
|  |_ <im-1-name>.jpg
|  |_ ...
|  |_ <im-N-name>.jpg
|_ coco_val2014
|_ ...
|_ annotations
   |_ instances_train2014.json
   |_ ...
```

If that is not the case, you may need to do something similar to:

```
mkdir -p $DETECTRON/detectron/datasets/data/coco
ln -s /path/to/coco_train2014 $DETECTRON/detectron/datasets/data/coco/
ln -s /path/to/coco_val2014 $DETECTRON/detectron/datasets/data/coco/
ln -s /path/to/json/annotations $DETECTRON/detectron/datasets/data/coco/annotations
```

### COCO Minival Annotations

Our custom `minival` and `valminusminival` annotations are available for download [here](https://dl.fbaipublicfiles.com/detectron/coco/coco_annotations_minival.tgz).
Please note that `minival` is exactly equivalent to the recently defined 2017 `val` set.
Similarly, the union of `valminusminival` and the 2014 `train` is exactly equivalent to the 2017 `train` set. To complete installation of the COCO dataset, you will need to copy the `minival` and `valminusminival` json annotation files to the `coco/annotations` directory referenced above.

## Creating Symlinks for PASCAL VOC

We assume that your symlinked `detectron/datasets/data/VOC<year>` directory has the following structure:

```
VOC<year>
|_ JPEGImages
|  |_ <im-1-name>.jpg
|  |_ ...
|  |_ <im-N-name>.jpg
|_ annotations
|  |_ voc_<year>_train.json
|  |_ voc_<year>_val.json
|  |_ ...
|_ VOCdevkit<year>
```

Create symlinks for `VOC<year>`:

```
mkdir -p $DETECTRON/detectron/datasets/data/VOC<year>
ln -s /path/to/VOC<year>/JPEGImages $DETECTRON/detectron/datasets/data/VOC<year>/JPEGImages
ln -s /path/to/VOC<year>/json/annotations $DETECTRON/detectron/datasets/data/VOC<year>/annotations
ln -s /path/to/VOC<year>/devkit $DETECTRON/detectron/datasets/data/VOC<year>/VOCdevkit<year>
```

### PASCAL VOC Annotations in COCO Format

We expect PASCAL VOC annotations converted to COCO json format, which are available for download [here](https://storage.googleapis.com/coco-dataset/external/PASCAL_VOC.zip ).

## Creating Symlinks for Cityscapes:

We assume that your symlinked `detectron/datasets/data/cityscapes` directory has the following structure:

```
cityscapes
|_ images
|  |_ <im-1-name>.jpg
|  |_ ...
|  |_ <im-N-name>.jpg
|_ annotations
|  |_ instanceonly_gtFile_train.json
|  |_ ...
|_ raw
   |_ gtFine
   |_ ...
   |_ README.md
```

Create symlinks for `cityscapes`:

```
mkdir -p $DETECTRON/detectron/datasets/data/cityscapes
ln -s /path/to/cityscapes/images $DETECTRON/detectron/datasets/data/cityscapes/images
ln -s /path/to/cityscapes/json/annotations $DETECTRON/detectron/datasets/data/cityscapes/annotations
ln -s /path/to/cityscapes/root $DETECTRON/detectron/datasets/data/cityscapes/raw
```

### Cityscapes Annotations in COCO Format

We expect Cityscapes annotations converted to COCO json format, which we will make available for download soon.

---

--- METRICS ---
- Files Extracted: 6
- Estimated Token Budget: ~5398 tokens
- Canonical Reference: https://codewiki.google/github.com/facebookresearch/DensePose
