class_docstr: Base Dataset class for Image Segmentation datasets. Sub-classes must define `ignore_label`
  and `background_idx` variable.
  
  Args:
      opts: Command-line arguments
class_docstr_tok: ["Base","Dataset","class","for","Image","Segmentation","datasets",".","Sub-classes","must","define","`","ignore_label","`","and","`","background_idx","`","variable",".","Args",":","opts",":","Command-line","arguments"]
code: def add_arguments(
      cls, parser: argparse.ArgumentParser
  ) -> argparse.ArgumentParser:
      if cls != BaseImageSegmentationDataset:
          # Don't re-register arguments in subclasses that don't override `add_arguments()`.
          return parser
  
      group = parser.add_argument_group(cls.__name__)
  
      # segmentation evaluation related arguments
      group.add_argument(
          "--evaluation.segmentation.apply-color-map",
          action="store_true",
          default=False,
          help="Apply color map to different classes in segmentation masks. Useful in visualization "
          "+ some competitions (e.g, PASCAL VOC) accept submissions with colored segmentation masks."
          "Defaults to False.",
      )
      group.add_argument(
          "--evaluation.segmentation.save-overlay-rgb-pred",
          action="store_true",
          default=False,
          help="Enable this flag to visualize predicted masks on top of input image. "
          "Defaults to False.",
      )
      group.add_argument(
          "--evaluation.segmentation.save-masks",
          action="store_true",
          default=False,
          help="Save predicted masks without colormaps. Useful for submitting to "
          "competitions like Cityscapes. Defaults to False.",
      )
      group.add_argument(
          "--evaluation.segmentation.overlay-mask-weight",
          default=0.5,
          type=float,
          help="Contribution of mask when overlaying on top of RGB image. Defaults to 0.5.",
      )
      group.add_argument(
          "--evaluation.segmentation.mode",
          type=str,
          default="validation_set",
          choices=["single_image", "image_folder", "validation_set"],
          help="Contribution of mask when overlaying on top of RGB image. Defaults to validation_set.",
      )
      group.add_argument(
          "--evaluation.segmentation.path",
          type=str,
          default=None,
          help="Path of the image or image folder (only required for single_image and image_folder modes). "
          "Defaults to None.",
      )
      group.add_argument(
          "--evaluation.segmentation.resize-input-images",
          action="store_true",
          default=False,
          help="Enable resizing input images while maintaining aspect ratio during segmentation evaluation."
          "Defaults to False.",
      )
  
      group.add_argument(
          "--evaluation.segmentation.resize-input-images-fixed-size",
          action="store_true",
          default=False,
          help="Enable resizing input images to fixed size during segmentation evaluation. "
          "Defaults to False.",
      )
      return parser
  
imports: import argparse
  import os
  from typing import List, Mapping, Optional, Tuple, Union
  import numpy
  import torch
  from PIL import Image
  from torch import Tensor
  from data.datasets.dataset_base import BaseImageDataset
  from data.transforms import image_pil
  from data.transforms.common import Compose
  from utils import logger
  from utils.color_map import Colormap
label_desc: Use image node_id 2 for calling the BaseImageSegmentationDataset obj's underlying member method code with example usage: obj.add_arguments(cls, parser) and returns: parser, parser