class_docstr: Constructs a DETR 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 [`DetrForSegmentation`] into image segmentation predictions. Only supports PyTorch.
  
  Args:
      outputs ([`DetrSegmentationOutput`]):
          Raw outputs of the model.
      target_sizes (`torch.Tensor` of shape `(batch_size, 2)` or `List[Tuple]` of length `batch_size`):
          Torch Tensor (or list) corresponding to the requested final size (h, w) of each prediction.
      threshold (`float`, *optional*, defaults to 0.9):
          Threshold to use to filter out queries.
      mask_threshold (`float`, *optional*, defaults to 0.5):
          Threshold to use when turning the predicted masks into binary values.
  
  Returns:
      `List[Dict]`: A list of dictionaries, each dictionary containing the scores, labels, and masks for an image
      in the batch as predicted by the model.
docstr_tok: ["Converts","the","output","of","[","`","DetrForSegmentation","`","]","into","image","segmentation","predictions",".","Only","supports","PyTorch",".","Args",":","outputs","(","[","`","DetrSegmentationOutput","`","]",")",":","Raw","outputs","of","the","model",".","target_sizes","(","`","torch.Tensor","`","of","shape","`","(","batch_size",",","2",")","`","or","`","List","[","Tuple","]","`","of","length","`","batch_size","`",")",":","Torch","Tensor","(","or","list",")","corresponding","to","the","requested","final","size","(","h",",","w",")","of","each","prediction",".","threshold","(","`","float","`",",","*","optional","*",",","defaults","to","0.9",")",":","Threshold","to","use","to","filter","out","queries",".","mask_threshold","(","`","float","`",",","*","optional","*",",","defaults","to","0.5",")",":","Threshold","to","use","when","turning","the","predicted","masks","into","binary","values",".","Returns",":","`","List","[","Dict","]","`",":","A","list","of","dictionaries",",","each","dictionary","containing","the","scores",",","labels",",","and","masks","for","an","image","in","the","batch","as","predicted","by","the","model","."]
code: def post_process_segmentation(
      self, outputs, target_sizes, threshold=0.9, mask_threshold=0.5
  ):
      """
      Converts the output of [`DetrForSegmentation`] into image segmentation predictions. Only supports PyTorch.
  
      Args:
          outputs ([`DetrSegmentationOutput`]):
              Raw outputs of the model.
          target_sizes (`torch.Tensor` of shape `(batch_size, 2)` or `List[Tuple]` of length `batch_size`):
              Torch Tensor (or list) corresponding to the requested final size (h, w) of each prediction.
          threshold (`float`, *optional*, defaults to 0.9):
              Threshold to use to filter out queries.
          mask_threshold (`float`, *optional*, defaults to 0.5):
              Threshold to use when turning the predicted masks into binary values.
  
      Returns:
          `List[Dict]`: A list of dictionaries, each dictionary containing the scores, labels, and masks for an image
          in the batch as predicted by the model.
      """
      warnings.warn(
          "`post_process_segmentation` is deprecated and will be removed in v5 of Transformers, please use"
          " `post_process_semantic_segmentation`.",
          FutureWarning,
      )
      out_logits, raw_masks = outputs.logits, outputs.pred_masks
      preds = []
  
      def to_tuple(tup):
          if isinstance(tup, tuple):
              return tup
          return tuple(tup.cpu().tolist())
  
      for cur_logits, cur_masks, size in zip(
          out_logits, raw_masks, target_sizes
      ):
          # we filter empty queries and detection below threshold
          scores, labels = cur_logits.softmax(-1).max(-1)
          keep = labels.ne(outputs.logits.shape[-1] - 1) & (
              scores > threshold
          )
          cur_scores, cur_classes = cur_logits.softmax(-1).max(-1)
          cur_scores = cur_scores[keep]
          cur_classes = cur_classes[keep]
          cur_masks = cur_masks[keep]
          cur_masks = nn.functional.interpolate(
              cur_masks[:, None], to_tuple(size), mode="bilinear"
          ).squeeze(1)
          cur_masks = (cur_masks.sigmoid() > mask_threshold) * 1
  
          predictions = {
              "scores": cur_scores,
              "labels": cur_classes,
              "masks": cur_masks,
          }
          preds.append(predictions)
      return preds
  
imports: import io
  import pathlib
  import warnings
  from collections import defaultdict
  from typing import Dict, List, Optional, Set, 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 DetrFeatureExtractor obj's underlying member method code with example usage: obj.post_process_segmentation(outputs, target_sizes, threshold, mask_threshold) and returns: preds, tuple, tup