projects/DensePose/doc/GETTING_STARTED.md
python apply_net.py show configs/densepose_rcnn_R_50_FPN_s1x.yaml densepose_rcnn_R_50_FPN_s1x.pkl image.jpg dp_contour,bbox --output image_densepose_contour.png
Please see Apply Net for more details on the tool.
First, prepare the dataset into the following structure under the directory you'll run training scripts:
<pre> datasets/coco/ annotations/ densepose_{train,minival,valminusminival}2014.json <a href="https://dl.fbaipublicfiles.com/detectron2/densepose/densepose_minival2014_100.json">densepose_minival2014_100.json </a> (optional, for testing only) {train,val}2014/ # image files that are mentioned in the corresponding json </pre>To train a model one can use the train_net.py script. This script was used to train all DensePose models in Model Zoo(IUV), Model Zoo(CSE). For example, to launch end-to-end DensePose-RCNN training with ResNet-50 FPN backbone on 8 GPUs following the s1x schedule, one can run
python train_net.py --config-file configs/densepose_rcnn_R_50_FPN_s1x.yaml --num-gpus 8
The configs are made for 8-GPU training. To train on 1 GPU, one can apply the linear learning rate scaling rule:
python train_net.py --config-file configs/densepose_rcnn_R_50_FPN_s1x.yaml \
SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025
Model testing can be done in the same way as training, except for an additional flag --eval-only and
model location specification through MODEL.WEIGHTS model.pth in the command line
python train_net.py --config-file configs/densepose_rcnn_R_50_FPN_s1x.yaml \
--eval-only MODEL.WEIGHTS model.pth
We provide tools which allow one to:
query_db is a tool to print or visualize DensePose data in a dataset.
Please refer to Query DB for more details on this tool
apply_net is a tool to print or visualize DensePose results.
Please refer to Apply Net for more details on this tool
DensePose can also be installed as a Python package for integration with other software.
The following dependencies are needed:
DensePose can then be installed from this repository with:
pip install git+https://github.com/facebookresearch/detectron2@main#subdirectory=projects/DensePose
After installation, the package will be importable as densepose.