code: def __init__(self, root: str, train: bool = True, transforms=None):
      assert os.path.exists(root), f"path '{root}' does not exist."
      if train:
          self.image_root = os.path.join(
              root, "DUTS-TR", "DUTS-TR-Image"
          )
          self.mask_root = os.path.join(root, "DUTS-TR", "DUTS-TR-Mask")
      else:
          self.image_root = os.path.join(
              root, "DUTS-TE", "DUTS-TE-Image"
          )
          self.mask_root = os.path.join(root, "DUTS-TE", "DUTS-TE-Mask")
      assert os.path.exists(
          self.image_root
      ), f"path '{self.image_root}' does not exist."
      assert os.path.exists(
          self.mask_root
      ), f"path '{self.mask_root}' does not exist."
  
      image_names = [
          p for p in os.listdir(self.image_root) if p.endswith(".jpg")
      ]
      mask_names = [
          p for p in os.listdir(self.mask_root) if p.endswith(".png")
      ]
      assert (
          len(image_names) > 0
      ), f"not find any images in {self.image_root}."
  
      # check images and mask
      re_mask_names = []
      for p in image_names:
          mask_name = p.replace(".jpg", ".png")
          assert (
              mask_name in mask_names
          ), f"{p} has no corresponding mask."
          re_mask_names.append(mask_name)
      mask_names = re_mask_names
  
      self.images_path = [
          os.path.join(self.image_root, n) for n in image_names
      ]
      self.masks_path = [
          os.path.join(self.mask_root, n) for n in mask_names
      ]
  
      self.transforms = transforms
  
file_path: deep-learning-for-image-processing/pytorch_segmentation/u2net/my_dataset.py
imports: import os
  import cv2
  import torch.utils.data
label_desc: Use image node_id 1 to create a new DUTSDataset object from inherited base classes: data with example: obj = DUTSDataset(root, train, transforms)