code: def __init__(self, path: str, net_dim=(416, 416), train=True):
      if not os.path.isdir(path):
          raise NotADirectoryError("path is not a valid directory!!!")
  
      super().__init__()
  
      if train:
          path = os.path.join(path, "train")
      else:
          path = os.path.join(path, "validation")
  
      self.__net_width, self.__net_height = net_dim
      self.__images_paths = []
      self.shapes = []
      self.labels = []
      for img in os.listdir(os.path.join(path, "images")):
          p = os.path.join(path, "images", img)
          image = cv.imread(p)
          if isinstance(image, np.ndarray):
              l_p = self.__img_path2label_path(p)
              self.__images_paths.append(p)
              self.shapes.append((image.shape[1], image.shape[0]))
              self.labels.append(self.__load_raw_label(l_p))
  
      self.__nsamples = len(self.__images_paths)
      self.shapes = np.array(self.shapes)
  
imports: import os
  import warnings
  from typing import Tuple, List
  import cv2
  import numpy
  import torch
  from torch.utils.data import Dataset
  from torchvision import transforms
  from ....yolov3.utils import prepare_image
label_desc: Use image node_id 1 to create a new LoadImagesAndLabels object from inherited base classes: Dataset with example: obj = LoadImagesAndLabels(path, net_dim, train)