class_docstr: Base DensePose sampler to produce DensePose data from DensePose predictions.
  Samples for each class are drawn according to some distribution over all pixels estimated
  to belong to that class.
docstr: Convert DensePose predictions (an instance of `DensePoseChartPredictorOutput`)
  into DensePose annotations data (an instance of `DensePoseList`)
docstr_tok: ["Convert","DensePose","predictions","(","an","instance","of","`","DensePoseChartPredictorOutput","`",")","into","DensePose","annotations","data","(","an","instance","of","`","DensePoseList","`",")"]
code: def __call__(self, instances: Instances) -> DensePoseList:
      """
      Convert DensePose predictions (an instance of `DensePoseChartPredictorOutput`)
      into DensePose annotations data (an instance of `DensePoseList`)
      """
      boxes_xyxy_abs = instances.pred_boxes.tensor.clone().cpu()
      boxes_xywh_abs = BoxMode.convert(
          boxes_xyxy_abs, BoxMode.XYXY_ABS, BoxMode.XYWH_ABS
      )
      dp_datas = []
      for i in range(len(boxes_xywh_abs)):
          annotation_i = self._sample(
              instances[i], make_int_box(boxes_xywh_abs[i])
          )
          annotation_i[
              DensePoseDataRelative.S_KEY
          ] = self._resample_mask(  # pyre-ignore[6]
              instances[i].pred_densepose
          )
          dp_datas.append(DensePoseDataRelative(annotation_i))
      # create densepose annotations on CPU
      dp_list = DensePoseList(
          dp_datas, boxes_xyxy_abs, instances.image_size
      )
      return dp_list
  
file_path: detectron2/projects/DensePose/densepose/data/samplers/densepose_base.py
imports: from typing import Any, Dict, List, Tuple
  import torch
  from torch.nn import functional
  from detectron2.structures import BoxMode, Instances
  from densepose.converters import ToChartResultConverter
  from densepose.converters.base import IntTupleBox, make_int_box
  from densepose.structures import DensePoseDataRelative, DensePoseList
label_desc: Use image node_id 2 for calling the DensePoseBaseSampler obj's underlying member method code with example usage: obj.__call__(instances) and returns: dp_list