class_docstr: Constructs a Deformable DETR image processor.
  
  Args:
      format (`str`, *optional*, defaults to `"coco_detection"`):
          Data format of the annotations. One of "coco_detection" or "coco_panoptic".
      do_resize (`bool`, *optional*, defaults to `True`):
          Controls whether to resize the image's (height, width) dimensions to the specified `size`. Can be
          overridden by the `do_resize` parameter in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 800, "longest_edge": 1333}`):
          Size of the image's (height, width) dimensions after resizing. Can be overridden by the `size` parameter in
          the `preprocess` method.
      resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`):
          Resampling filter to use if resizing the image.
      do_rescale (`bool`, *optional*, defaults to `True`):
          Controls whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the
          `do_rescale` parameter in the `preprocess` method.
      rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
          Scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter in the
          `preprocess` method.
      do_normalize:
          Controls whether to normalize the image. Can be overridden by the `do_normalize` parameter in the
          `preprocess` method.
      image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_MEAN`):
          Mean values to use when normalizing the image. Can be a single value or a list of values, one for each
          channel. Can be overridden by the `image_mean` parameter in the `preprocess` method.
      image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_STD`):
          Standard deviation values to use when normalizing the image. Can be a single value or a list of values, one
          for each channel. Can be overridden by the `image_std` parameter in the `preprocess` method.
      do_pad (`bool`, *optional*, defaults to `True`):
          Controls whether to pad the image to the largest image in a batch and create a pixel mask. Can be
          overridden by the `do_pad` parameter in the `preprocess` method.
class_docstr_tok: ["Constructs","a","Deformable","DETR","image","processor",".","Args",":","format","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","coco_detection","''","`",")",":","Data","format","of","the","annotations",".","One","of","``","coco_detection","''","or","``","coco_panoptic","''",".","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Controls","whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","the","specified","`","size","`",".","Can","be","overridden","by","the","`","do_resize","`","parameter","in","the","`","preprocess","`","method",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","shortest_edge","''",":","800",",","``","longest_edge","''",":","1333","}","`",")",":","Size","of","the","image","'s","(","height",",","width",")","dimensions","after","resizing",".","Can","be","overridden","by","the","`","size","`","parameter","in","the","`","preprocess","`","method",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","PILImageResampling.BILINEAR","`",")",":","Resampling","filter","to","use","if","resizing","the","image",".","do_rescale","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Controls","whether","to","rescale","the","image","by","the","specified","scale","`","rescale_factor","`",".","Can","be","overridden","by","the","`","do_rescale","`","parameter","in","the","`","preprocess","`","method",".","rescale_factor","(","`","int","`","or","`","float","`",",","*","optional","*",",","defaults","to","`","1\/255","`",")",":","Scale","factor","to","use","if","rescaling","the","image",".","Can","be","overridden","by","the","`","rescale_factor","`","parameter","in","the","`","preprocess","`","method",".","do_normalize",":","Controls","whether","to","normalize","the","image",".","Can","be","overridden","by","the","`","do_normalize","`","parameter","in","the","`","preprocess","`","method",".","image_mean","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_DEFAULT_MEAN","`",")",":","Mean","values","to","use","when","normalizing","the","image",".","Can","be","a","single","value","or","a","list","of","values",",","one","for","each","channel",".","Can","be","overridden","by","the","`","image_mean","`","parameter","in","the","`","preprocess","`","method",".","image_std","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_DEFAULT_STD","`",")",":","Standard","deviation","values","to","use","when","normalizing","the","image",".","Can","be","a","single","value","or","a","list","of","values",",","one","for","each","channel",".","Can","be","overridden","by","the","`","image_std","`","parameter","in","the","`","preprocess","`","method",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Controls","whether","to","pad","the","image","to","the","largest","image","in","a","batch","and","create","a","pixel","mask",".","Can","be","overridden","by","the","`","do_pad","`","parameter","in","the","`","preprocess","`","method","."]
docstr: Converts the raw output of [`DeformableDetrForObjectDetection`] into final bounding boxes in (top_left_x,
  top_left_y, bottom_right_x, bottom_right_y) format. Only supports PyTorch.
  
  Args:
      outputs ([`DetrObjectDetectionOutput`]):
          Raw outputs of the model.
      threshold (`float`, *optional*):
          Score threshold to keep object detection predictions.
      target_sizes (`torch.Tensor` or `List[Tuple[int, int]]`, *optional*):
          Tensor of shape `(batch_size, 2)` or list of tuples (`Tuple[int, int]`) containing the target size
          (height, width) of each image in the batch. If left to None, predictions will not be resized.
      top_k (`int`, *optional*, defaults to 100):
          Keep only top k bounding boxes before filtering by thresholding.
  
  Returns:
      `List[Dict]`: A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
      in the batch as predicted by the model.
docstr_tok: ["Converts","the","raw","output","of","[","`","DeformableDetrForObjectDetection","`","]","into","final","bounding","boxes","in","(","top_left_x",",","top_left_y",",","bottom_right_x",",","bottom_right_y",")","format",".","Only","supports","PyTorch",".","Args",":","outputs","(","[","`","DetrObjectDetectionOutput","`","]",")",":","Raw","outputs","of","the","model",".","threshold","(","`","float","`",",","*","optional","*",")",":","Score","threshold","to","keep","object","detection","predictions",".","target_sizes","(","`","torch.Tensor","`","or","`","List","[","Tuple","[","int",",","int","]","]","`",",","*","optional","*",")",":","Tensor","of","shape","`","(","batch_size",",","2",")","`","or","list","of","tuples","(","`","Tuple","[","int",",","int","]","`",")","containing","the","target","size","(","height",",","width",")","of","each","image","in","the","batch",".","If","left","to","None",",","predictions","will","not","be","resized",".","top_k","(","`","int","`",",","*","optional","*",",","defaults","to","100",")",":","Keep","only","top","k","bounding","boxes","before","filtering","by","thresholding",".","Returns",":","`","List","[","Dict","]","`",":","A","list","of","dictionaries",",","each","dictionary","containing","the","scores",",","labels","and","boxes","for","an","image","in","the","batch","as","predicted","by","the","model","."]
code: def post_process_object_detection(
      self,
      outputs,
      threshold: float = 0.5,
      target_sizes: Union[TensorType, List[Tuple]] = None,
      top_k: int = 100,
  ):
      """
      Converts the raw output of [`DeformableDetrForObjectDetection`] into final bounding boxes in (top_left_x,
      top_left_y, bottom_right_x, bottom_right_y) format. Only supports PyTorch.
  
      Args:
          outputs ([`DetrObjectDetectionOutput`]):
              Raw outputs of the model.
          threshold (`float`, *optional*):
              Score threshold to keep object detection predictions.
          target_sizes (`torch.Tensor` or `List[Tuple[int, int]]`, *optional*):
              Tensor of shape `(batch_size, 2)` or list of tuples (`Tuple[int, int]`) containing the target size
              (height, width) of each image in the batch. If left to None, predictions will not be resized.
          top_k (`int`, *optional*, defaults to 100):
              Keep only top k bounding boxes before filtering by thresholding.
  
      Returns:
          `List[Dict]`: A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
          in the batch as predicted by the model.
      """
      out_logits, out_bbox = outputs.logits, outputs.pred_boxes
  
      if target_sizes is not None:
          if len(out_logits) != len(target_sizes):
              raise ValueError(
                  "Make sure that you pass in as many target sizes as the batch dimension of the logits"
              )
  
      prob = out_logits.sigmoid()
      prob = prob.view(out_logits.shape[0], -1)
      k_value = min(top_k, prob.size(1))
      topk_values, topk_indexes = torch.topk(prob, k_value, dim=1)
      scores = topk_values
      topk_boxes = torch.div(
          topk_indexes, out_logits.shape[2], rounding_mode="floor"
      )
      labels = topk_indexes % out_logits.shape[2]
      boxes = center_to_corners_format(out_bbox)
      boxes = torch.gather(
          boxes, 1, topk_boxes.unsqueeze(-1).repeat(1, 1, 4)
      )
  
      # and from relative [0, 1] to absolute [0, height] coordinates
      if isinstance(target_sizes, List):
          img_h = torch.Tensor([i[0] for i in target_sizes])
          img_w = torch.Tensor([i[1] for i in target_sizes])
      else:
          img_h, img_w = target_sizes.unbind(1)
      scale_fct = torch.stack([img_w, img_h, img_w, img_h], dim=1).to(
          boxes.device
      )
      boxes = boxes * scale_fct[:, None, :]
  
      results = []
      for s, l, b in zip(scores, labels, boxes):
          score = s[s > threshold]
          label = l[s > threshold]
          box = b[s > threshold]
          results.append(
              {"scores": score, "labels": label, "boxes": box}
          )
  
      return results
  
imports: import io
  import pathlib
  from collections import defaultdict
  from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Union
  import numpy
  from ...feature_extraction_utils import BatchFeature
  from ...image_processing_utils import BaseImageProcessor, get_size_dict
  from ...image_transforms import PaddingMode, center_to_corners_format, corners_to_center_format, id_to_rgb, pad, rescale, resize, rgb_to_id, to_channel_dimension_format
  from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, AnnotationType, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, make_list_of_images, to_numpy_array, valid_images, validate_annotations
  from ...utils import TensorType, is_flax_available, is_jax_tensor, is_scipy_available, is_tf_available, is_tf_tensor, is_torch_available, is_torch_tensor, is_vision_available, logging
label_desc: Use image node_id 16 for calling the DeformableDetrImageProcessor obj's underlying member method code with example usage: obj.post_process_object_detection(outputs, threshold, target_sizes, top_k) and returns: results