You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

TOOL_APPLY_NET.md 3.9 kB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Apply Net
  2. `apply_net` is a tool to print or visualize DensePose results on a set of images.
  3. It has two modes: `dump` to save DensePose model results to a pickle file
  4. and `show` to visualize them on images.
  5. ## Dump Mode
  6. The general command form is:
  7. ```bash
  8. python apply_net.py dump [-h] [-v] [--output <dump_file>] <config> <model> <input>
  9. ```
  10. There are three mandatory arguments:
  11. - `<config>`, configuration file for a given model;
  12. - `<model>`, model file with trained parameters
  13. - `<input>`, input image file name, pattern or folder
  14. One can additionally provide `--output` argument to define the output file name,
  15. which defaults to `output.pkl`.
  16. Examples:
  17. 1. Dump results of a DensePose model with ResNet-50 FPN backbone for images
  18. in a folder `images` to file `dump.pkl`:
  19. ```bash
  20. python apply_net.py dump configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl images --output dump.pkl -v
  21. ```
  22. 2. Dump results of a DensePose model with ResNet-50 FPN backbone for images
  23. with file name matching a pattern `image*.jpg` to file `results.pkl`:
  24. ```bash
  25. 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
  26. ```
  27. ## Visualization Mode
  28. The general command form is:
  29. ```bash
  30. python apply_net.py show [-h] [-v] [--min_score <score>] [--nms_thresh <threshold>] [--output <image_file>] <config> <model> <input> <visualizations>
  31. ```
  32. There are four mandatory arguments:
  33. - `<config>`, configuration file for a given model;
  34. - `<model>`, model file with trained parameters
  35. - `<input>`, input image file name, pattern or folder
  36. - `<visualizations>`, visualizations specifier; currently available visualizations are:
  37. * `bbox` - bounding boxes of detected persons;
  38. * `dp_segm` - segmentation masks for detected persons;
  39. * `dp_u` - each body part is colored according to the estimated values of the
  40. U coordinate in part parameterization;
  41. * `dp_v` - each body part is colored according to the estimated values of the
  42. V coordinate in part parameterization;
  43. * `dp_contour` - plots contours with color-coded U and V coordinates
  44. One can additionally provide the following optional arguments:
  45. - `--min_score` to only show detections with sufficient scores that are not lower than provided value
  46. - `--nms_thresh` to additionally apply non-maximum suppression to detections at a given threshold
  47. - `--output` to define visualization file name template, which defaults to `output.png`.
  48. To distinguish output file names for different images, the tool appends 1-based entry index,
  49. e.g. output.0001.png, output.0002.png, etc...
  50. The following examples show how to output results of a DensePose model
  51. with ResNet-50 FPN backbone using different visualizations for image `image.jpg`:
  52. 1. Show bounding box and segmentation:
  53. ```bash
  54. 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
  55. ```
  56. ![Bounding Box + Segmentation Visualization](images/res_bbox_dp_segm.jpg)
  57. 2. Show bounding box and estimated U coordinates for body parts:
  58. ```bash
  59. 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
  60. ```
  61. ![Bounding Box + U Coordinate Visualization](images/res_bbox_dp_u.jpg)
  62. 3. Show bounding box and estimated V coordinates for body parts:
  63. ```bash
  64. 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
  65. ```
  66. ![Bounding Box + V Coordinate Visualization](images/res_bbox_dp_v.jpg)
  67. 4. Show bounding box and estimated U and V coordinates via contour plots:
  68. ```bash
  69. 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
  70. ```
  71. ![Bounding Box + Contour Visualization](images/res_bbox_dp_contour.jpg)

No Description