class_docstr: Base Dataset class for loading images from Disk.
  Can load a predefined list of images or all images inside
  a folder. And also a json file containing the image path
  and the RoI annotation for the image.
  
  Inherits from QueueDataset class in VISSL to provide better
  handling of the invalid images by replacing them with the
  valid and seen images.
  
  Args:
      cfg (AttrDict): configuration defined by user
      data_source (string): data source either of "disk_filelist" or "disk_folder"
      path (string): can be either of the following
          1. A .npy file containing a list of filepaths.
             In this case `data_source = "disk_filelist"`
          2. A folder such that folder/split contains images.
             In this case `data_source = "disk_folder"`
          3. A .json file containing list of dictionary where
             each dictionary has "img_path" and "bbox" entry.
             In this case `data_source = "disk_roi_annotations"`
      split (string): specify split for the dataset.
                      Usually train/val/test.
                      Used to read images if reading from a folder `path` and retrieve
                      settings for that split from the config path.
      dataset_name (string): name of dataset. For information only.
  
  NOTE: This dataset class only returns images (not labels or other metdata).
  To load labels you must specify them in `LABEL_SOURCES` (See `ssl_dataset.py`).
  LABEL_SOURCES follows a similar convention as the dataset and can either be a filelist
  or a torchvision ImageFolder compatible folder -
  1. Store labels in a numpy file
  2. Store images in a nested directory structure so that torchvision ImageFolder
     dataset can infer the labels.
class_docstr_tok: ["Base","Dataset","class","for","loading","images","from","Disk",".","Can","load","a","predefined","list","of","images","or","all","images","inside","a","folder",".","And","also","a","json","file","containing","the","image","path","and","the","RoI","annotation","for","the","image",".","Inherits","from","QueueDataset","class","in","VISSL","to","provide","better","handling","of","the","invalid","images","by","replacing","them","with","the","valid","and","seen","images",".","Args",":","cfg","(","AttrDict",")",":","configuration","defined","by","user","data_source","(","string",")",":","data","source","either","of","``","disk_filelist","''","or","``","disk_folder","''","path","(","string",")",":","can","be","either","of","the","following","1",".","A",".npy","file","containing","a","list","of","filepaths",".","In","this","case","`","data_source","=","``","disk_filelist","''","`","2",".","A","folder","such","that","folder\/split","contains","images",".","In","this","case","`","data_source","=","``","disk_folder","''","`","3",".","A",".json","file","containing","list","of","dictionary","where","each","dictionary","has","``","img_path","''","and","``","bbox","''","entry",".","In","this","case","`","data_source","=","``","disk_roi_annotations","''","`","split","(","string",")",":","specify","split","for","the","dataset",".","Usually","train\/val\/test",".","Used","to","read","images","if","reading","from","a","folder","`","path","`","and","retrieve","settings","for","that","split","from","the","config","path",".","dataset_name","(","string",")",":","name","of","dataset",".","For","information","only",".","NOTE",":","This","dataset","class","only","returns","images","(","not","labels","or","other","metdata",")",".","To","load","labels","you","must","specify","them","in","`","LABEL_SOURCES","`","(","See","`","ssl_dataset.py","`",")",".","LABEL_SOURCES","follows","a","similar","convention","as","the","dataset","and","can","either","be","a","filelist","or","a","torchvision","ImageFolder","compatible","folder","-","1",".","Store","labels","in","a","numpy","file","2",".","Store","images","in","a","nested","directory","structure","so","that","torchvision","ImageFolder","dataset","can","infer","the","labels","."]
code: def _load_data(self, path):
      if self.data_source == "disk_filelist":
          if self.cfg["DATA"][self.split].MMAP_MODE:
              self.image_dataset = load_file(path, mmap_mode="r")
          else:
              self.image_dataset = load_file(path)
      elif self.data_source == "disk_folder":
          self.image_dataset = ImageFolder(path)
          logging.info(
              f"Loaded {len(self.image_dataset)} samples from folder {path}"
          )
  
          # mark as initialized.
          # Creating ImageFolder dataset can be expensive because of repeated os.listdir calls
          # Avoid creating it over and over again.
          self.is_initialized = True
      elif self.data_source == "disk_roi_annotations":
          # we load the annotations and then parse the image paths and the image roi
          self.image_dataset, self.image_roi_bbox = [], []
          json_annotations = load_file(path)
          self.image_dataset = [
              item["path"] for item in json_annotations
          ]
          self.image_roi_bbox = [
              item["bbox"] for item in json_annotations
          ]
  
file_path: vissl/vissl/data/disk_dataset.py
imports: import logging
  from iopath.common.file_io import g_pathmgr
  from PIL import Image
  from torchvision.datasets import ImageFolder
  from vissl.data.data_helper import get_mean_image, QueueDataset
  from vissl.utils.io import load_file
label_desc: Use image node_id 2 for calling the DiskImageDataset obj's underlying member method code with example usage: obj._load_data(path) without return types