class_docstr: Dataset class for the ADE20K dataset
  
  The structure of the dataset should be something like this: ::
  
  ADEChallengeData2016/annotations/training/*.png
  ADEChallengeData2016/annotations/validation/*.png
  
  ADEChallengeData2016/images/training/*.jpg
  ADEChallengeData2016/images/validation/*.jpg
  
  Args:
      opts: Command-line arguments
class_docstr_tok: ["Dataset","class","for","the","ADE20K","dataset","The","structure","of","the","dataset","should","be","something","like","this",":",":",":","ADEChallengeData2016\/annotations\/training\/","*",".png","ADEChallengeData2016\/annotations\/validation\/","*",".png","ADEChallengeData2016\/images\/training\/","*",".jpg","ADEChallengeData2016\/images\/validation\/","*",".jpg","Args",":","opts",":","Command-line","arguments"]
code: def __init__(self, opts: argparse.Namespace, *args, **kwargs) -> None:
      super().__init__(opts=opts, *args, **kwargs)
      root = self.root
  
      image_dir = os.path.join(
          root,
          "images",
          "training" if self.is_training else "validation",
      )
      annotation_dir = os.path.join(
          root,
          "annotations",
          "training" if self.is_training else "validation",
      )
  
      images = []
      masks = []
      for file_name in os.listdir(image_dir):
          if file_name.endswith(".jpg"):
              img_f_name = "{}/{}".format(image_dir, file_name)
              mask_f_name = "{}/{}".format(
                  annotation_dir, file_name.replace("jpg", "png")
              )
  
              if os.path.isfile(img_f_name) and os.path.isfile(
                  mask_f_name
              ):
                  images.append(img_f_name)
                  masks.append(mask_f_name)
  
      self.images = images
      self.masks = masks
      self.ignore_label = 255
      self.background_idx = 0
      self.check_dataset()
  
file_path: ml-cvnets/data/datasets/segmentation/ade20k.py
imports: import argparse
  import os
  from typing import List
  import numpy
  from data.datasets import DATASET_REGISTRY
  from data.datasets.segmentation.base_segmentation import BaseImageSegmentationDataset
label_desc: Use image node_id 1 to create a new ADE20KDataset object from inherited base classes: BaseImageSegmentationDataset with example: obj = ADE20KDataset(opts)