apply_net is a tool to print or visualize DensePose results on a set of images.
It has two modes: dump to save DensePose model results to a pickle file
and show to visualize them on images.
The general command form is:
python apply_net.py dump [-h] [-v] [--output <dump_file>] <config> <model> <input>
There are three mandatory arguments:
<config>, configuration file for a given model;<model>, model file with trained parameters<input>, input image file name, pattern or folderOne can additionally provide --output argument to define the output file name,
which defaults to output.pkl.
Examples:
images to file dump.pkl:python apply_net.py dump configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl images --output dump.pkl -v
image*.jpg to file results.pkl:python apply_net.py dump configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl "image*.jpg" --output results.pkl -v
The general command form is:
python apply_net.py show [-h] [-v] [--min_score <score>] [--nms_thresh <threshold>] [--output <image_file>] <config> <model> <input> <visualizations>
There are four mandatory arguments:
<config>, configuration file for a given model;<model>, model file with trained parameters<input>, input image file name, pattern or folder<visualizations>, visualizations specifier; currently available visualizations are:
bbox - bounding boxes of detected persons;dp_segm - segmentation masks for detected persons;dp_u - each body part is colored according to the estimated values of thedp_v - each body part is colored according to the estimated values of thedp_contour - plots contours with color-coded U and V coordinatesOne can additionally provide the following optional arguments:
--min_score to only show detections with sufficient scores that are not lower than provided value--nms_thresh to additionally apply non-maximum suppression to detections at a given threshold--output to define visualization file name template, which defaults to output.png.The following examples show how to output results of a DensePose model
with ResNet-50 FPN backbone using different visualizations for image image.jpg:
python apply_net.py show configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl image.jpg bbox,dp_segm -v
python apply_net.py show configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl image.jpg bbox,dp_u -v
python apply_net.py show configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl image.jpg bbox,dp_v -v
python apply_net.py show configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl image.jpg dp_contour,bbox -v