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 actual instance segmentation predictions. Only supports
  PyTorch.
  
  Args:
      results (`List[Dict]`):
          Results list obtained by [`~DetrFeatureExtractor.post_process`], to which "masks" results will be
          added.
      outputs ([`DetrSegmentationOutput`]):
          Raw outputs of the model.
      orig_target_sizes (`torch.Tensor` of shape `(batch_size, 2)`):
          Tensor containing the size (h, w) of each image of the batch. For evaluation, this must be the original
          image size (before any data augmentation).
      max_target_sizes (`torch.Tensor` of shape `(batch_size, 2)`):
          Tensor containing the maximum size (h, w) of each image of the batch. For evaluation, this must be the
          original image size (before any data augmentation).
      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, boxes and masks for an
      image in the batch as predicted by the model.
docstr_tok: ["Converts","the","output","of","[","`","DetrForSegmentation","`","]","into","actual","instance","segmentation","predictions",".","Only","supports","PyTorch",".","Args",":","results","(","`","List","[","Dict","]","`",")",":","Results","list","obtained","by","[","`","~DetrFeatureExtractor.post_process","`","]",",","to","which","``","masks","''","results","will","be","added",".","outputs","(","[","`","DetrSegmentationOutput","`","]",")",":","Raw","outputs","of","the","model",".","orig_target_sizes","(","`","torch.Tensor","`","of","shape","`","(","batch_size",",","2",")","`",")",":","Tensor","containing","the","size","(","h",",","w",")","of","each","image","of","the","batch",".","For","evaluation",",","this","must","be","the","original","image","size","(","before","any","data","augmentation",")",".","max_target_sizes","(","`","torch.Tensor","`","of","shape","`","(","batch_size",",","2",")","`",")",":","Tensor","containing","the","maximum","size","(","h",",","w",")","of","each","image","of","the","batch",".","For","evaluation",",","this","must","be","the","original","image","size","(","before","any","data","augmentation",")",".","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",",","boxes","and","masks","for","an","image","in","the","batch","as","predicted","by","the","model","."]
code: def post_process_instance(
      self,
      results,
      outputs,
      orig_target_sizes,
      max_target_sizes,
      threshold=0.5,
  ):
      """
      Converts the output of [`DetrForSegmentation`] into actual instance segmentation predictions. Only supports
      PyTorch.
  
      Args:
          results (`List[Dict]`):
              Results list obtained by [`~DetrFeatureExtractor.post_process`], to which "masks" results will be
              added.
          outputs ([`DetrSegmentationOutput`]):
              Raw outputs of the model.
          orig_target_sizes (`torch.Tensor` of shape `(batch_size, 2)`):
              Tensor containing the size (h, w) of each image of the batch. For evaluation, this must be the original
              image size (before any data augmentation).
          max_target_sizes (`torch.Tensor` of shape `(batch_size, 2)`):
              Tensor containing the maximum size (h, w) of each image of the batch. For evaluation, this must be the
              original image size (before any data augmentation).
          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, boxes and masks for an
          image in the batch as predicted by the model.
      """
      warnings.warn(
          "`post_process_instance` is deprecated and will be removed in v5 of Transformers, please use"
          " `post_process_instance_segmentation`.",
          FutureWarning,
      )
  
      if len(orig_target_sizes) != len(max_target_sizes):
          raise ValueError(
              "Make sure to pass in as many orig_target_sizes as max_target_sizes"
          )
      max_h, max_w = max_target_sizes.max(0)[0].tolist()
      outputs_masks = outputs.pred_masks.squeeze(2)
      outputs_masks = nn.functional.interpolate(
          outputs_masks,
          size=(max_h, max_w),
          mode="bilinear",
          align_corners=False,
      )
      outputs_masks = (outputs_masks.sigmoid() > threshold).cpu()
  
      for i, (cur_mask, t, tt) in enumerate(
          zip(outputs_masks, max_target_sizes, orig_target_sizes)
      ):
          img_h, img_w = t[0], t[1]
          results[i]["masks"] = cur_mask[:, :img_h, :img_w].unsqueeze(1)
          results[i]["masks"] = nn.functional.interpolate(
              results[i]["masks"].float(),
              size=tuple(tt.tolist()),
              mode="nearest",
          ).byte()
  
      return results
  
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 14 for calling the DetrFeatureExtractor obj's underlying member method code with example usage: obj.post_process_instance(results, outputs, orig_target_sizes, max_target_sizes, threshold) and returns: results