class_docstr: A custom dataset class for loading images from a directory structure.
  This class inherits from torch.utils.data.Dataset.
class_docstr_tok: ["A","custom","dataset","class","for","loading","images","from","a","directory","structure",".","This","class","inherits","from","torch.utils.data.Dataset","."]
code: def __init__(self, path: str, transform: Optional[Callable] = None):
      super(DirectoryBasedDataset, self).__init__()
  
      self._transform = transform
      self._samples = self._get_files(
          path, "nsfw", 1
      ) + self._get_files(path, "safe", 0)
  
file_path: NeMo/nemo/collections/multimodal/data/nsfw/nsfw_dataset.py
imports: import pathlib
  from typing import Callable, List, Optional, Tuple
  import torch
  from omegaconf.dictconfig import DictConfig
  from PIL import Image
  from nemo.collections.multimodal.data.clip.augmentations.augmentations import image_transform
label_desc: Use image node_id 1 to create a new DirectoryBasedDataset object from inherited base classes: torch.utils.data with example: obj = DirectoryBasedDataset(path, transform)