class_docstr: Constructs a YOLOS feature extractor.
  
  This feature extractor inherits from [`FeatureExtractionMixin`] which contains most of the main methods. Users
  should refer to this superclass for more information regarding those methods.
  
  
  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`):
          Whether to resize the input to a certain `size`.
      size (`int`, *optional*, defaults to 800):
          Resize the input to the given size. Only has an effect if `do_resize` is set to `True`. If size is a
          sequence like `(width, height)`, output size will be matched to this. If size is an int, smaller edge of
          the image will be matched to this number. i.e, if `height > width`, then image will be rescaled to `(size *
          height / width, size)`.
      max_size (`int`, *optional*, defaults to `1333`):
          The largest size an image dimension can have (otherwise it's capped). Only has an effect if `do_resize` is
          set to `True`.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether or not to normalize the input with mean and standard deviation.
      image_mean (`int`, *optional*, defaults to `[0.485, 0.456, 0.406]`):
          The sequence of means for each channel, to be used when normalizing images. Defaults to the ImageNet mean.
      image_std (`int`, *optional*, defaults to `[0.229, 0.224, 0.225]`):
          The sequence of standard deviations for each channel, to be used when normalizing images. Defaults to the
          ImageNet std.
class_docstr_tok: ["Constructs","a","YOLOS","feature","extractor",".","This","feature","extractor","inherits","from","[","`","FeatureExtractionMixin","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","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","`",")",":","Whether","to","resize","the","input","to","a","certain","`","size","`",".","size","(","`","int","`",",","*","optional","*",",","defaults","to","800",")",":","Resize","the","input","to","the","given","size",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","If","size","is","a","sequence","like","`","(","width",",","height",")","`",",","output","size","will","be","matched","to","this",".","If","size","is","an","int",",","smaller","edge","of","the","image","will","be","matched","to","this","number",".","i.e",",","if","`","height",">","width","`",",","then","image","will","be","rescaled","to","`","(","size","*","height","\/","width",",","size",")","`",".","max_size","(","`","int","`",",","*","optional","*",",","defaults","to","`","1333","`",")",":","The","largest","size","an","image","dimension","can","have","(","otherwise","it","'s","capped",")",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","to","normalize","the","input","with","mean","and","standard","deviation",".","image_mean","(","`","int","`",",","*","optional","*",",","defaults","to","`","[","0.485",",","0.456",",","0.406","]","`",")",":","The","sequence","of","means","for","each","channel",",","to","be","used","when","normalizing","images",".","Defaults","to","the","ImageNet","mean",".","image_std","(","`","int","`",",","*","optional","*",",","defaults","to","`","[","0.229",",","0.224",",","0.225","]","`",")",":","The","sequence","of","standard","deviations","for","each","channel",",","to","be","used","when","normalizing","images",".","Defaults","to","the","ImageNet","std","."]
docstr: Converts the output of [`YolosForObjectDetection`] into the format expected by the COCO api. Only supports
  PyTorch.
  
  Args:
      outputs ([`YolosObjectDetectionOutput`]):
          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*, defaults to `None`):
          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.
  
  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","output","of","[","`","YolosForObjectDetection","`","]","into","the","format","expected","by","the","COCO","api",".","Only","supports","PyTorch",".","Args",":","outputs","(","[","`","YolosObjectDetectionOutput","`","]",")",":","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","*",",","defaults","to","`","None","`",")",":","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",".","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,
  ):
      """
      Converts the output of [`YolosForObjectDetection`] into the format expected by the COCO api. Only supports
      PyTorch.
  
      Args:
          outputs ([`YolosObjectDetectionOutput`]):
              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*, defaults to `None`):
              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.
  
      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 = nn.functional.softmax(out_logits, -1)
      scores, labels = prob[..., :-1].max(-1)
  
      # Convert to [x0, y0, x1, y1] format
      boxes = center_to_corners_format(out_bbox)
  
      # Convert from relative [0, 1] to absolute [0, height] coordinates
      if target_sizes is not None:
          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)
          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 pathlib
  import warnings
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  from PIL import Image
  from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
  from ...image_utils import ImageFeatureExtractionMixin, is_torch_tensor
  from ...utils import TensorType, is_torch_available, logging
label_desc: Use image node_id 13 for calling the YolosFeatureExtractor obj's underlying member method code with example usage: obj.post_process_object_detection(outputs, threshold, target_sizes) and returns: results