class_docstr: Constructs a MobileNetV2 image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
          `do_resize` in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 256}`):
          Size of the image after resizing. The shortest edge of the image is resized to size["shortest_edge"], with
          the longest edge resized to keep the input aspect ratio. Can be overridden by `size` in the `preprocess`
          method.
      resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`):
          Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
          `preprocess` method.
      do_center_crop (`bool`, *optional*, defaults to `True`):
          Whether to center crop the image. If the input size is smaller than `crop_size` along any edge, the image
          is padded with 0's and then center cropped. Can be overridden by the `do_center_crop` parameter in the
          `preprocess` method.
      crop_size (`Dict[str, int]`, *optional*, defaults to `{"height": 224, "width": 224}`):
          Desired output size when applying center-cropping. Only has an effect if `do_center_crop` is set to `True`.
          Can be overridden by the `crop_size` parameter in the `preprocess` method.
      do_rescale (`bool`, *optional*, defaults to `True`):
          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:
          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_STANDARD_MEAN`):
          Mean to use if normalizing the image. This is a float or list of floats the length of the number of
          channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method.
      image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`):
          Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
          number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
docstr: Converts the output of [`MobileNetV2ForSemanticSegmentation`] into semantic segmentation maps. Only supports PyTorch.
  
  Args:
      outputs ([`MobileNetV2ForSemanticSegmentation`]):
          Raw outputs of the model.
      target_sizes (`List[Tuple]` of length `batch_size`, *optional*):
          List of tuples corresponding to the requested final size (height, width) of each prediction. If unset,
          predictions will not be resized.
  
  Returns:
      semantic_segmentation: `List[torch.Tensor]` of length `batch_size`, where each item is a semantic
      segmentation map of shape (height, width) corresponding to the target_sizes entry (if `target_sizes` is
      specified). Each entry of each `torch.Tensor` correspond to a semantic class id.
code: def post_process_semantic_segmentation(
      self, outputs, target_sizes: List[Tuple] = None
  ):
      """
      Converts the output of [`MobileNetV2ForSemanticSegmentation`] into semantic segmentation maps. Only supports PyTorch.
  
      Args:
          outputs ([`MobileNetV2ForSemanticSegmentation`]):
              Raw outputs of the model.
          target_sizes (`List[Tuple]` of length `batch_size`, *optional*):
              List of tuples corresponding to the requested final size (height, width) of each prediction. If unset,
              predictions will not be resized.
  
      Returns:
          semantic_segmentation: `List[torch.Tensor]` of length `batch_size`, where each item is a semantic
          segmentation map of shape (height, width) corresponding to the target_sizes entry (if `target_sizes` is
          specified). Each entry of each `torch.Tensor` correspond to a semantic class id.
      """
      # TODO: add support for other frameworks
      logits = outputs.logits
  
      # Resize logits and compute semantic segmentation maps
      if target_sizes is not None:
          if len(logits) != len(target_sizes):
              raise ValueError(
                  "Make sure that you pass in as many target sizes as the batch dimension of the logits"
              )
  
          if is_torch_tensor(target_sizes):
              target_sizes = target_sizes.numpy()
  
          semantic_segmentation = []
  
          for idx in range(len(logits)):
              resized_logits = torch.nn.functional.interpolate(
                  logits[idx].unsqueeze(dim=0),
                  size=target_sizes[idx],
                  mode="bilinear",
                  align_corners=False,
              )
              semantic_map = resized_logits[0].argmax(dim=0)
              semantic_segmentation.append(semantic_map)
      else:
          semantic_segmentation = logits.argmax(dim=1)
          semantic_segmentation = [
              semantic_segmentation[i]
              for i in range(semantic_segmentation.shape[0])
          ]
  
      return semantic_segmentation
  
file_path: transformers/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py
imports: from typing import Dict, List, Optional, Tuple, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import get_resize_output_image_size, resize, to_channel_dimension_format
  from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_list_of_images, to_numpy_array, valid_images
  from ...utils import TensorType, is_torch_available, is_torch_tensor, logging
label_desc: Use image node_id 4 for calling the MobileNetV2ImageProcessor obj's underlying member method code with example usage: obj.post_process_semantic_segmentation(outputs, target_sizes) and returns: semantic_segmentation