code: def sample(self):
      if self.index >= len(self.path_label_list):
          random.shuffle(self.path_label_list)
          self.index = 0
      if self.dataset_with_label:
          path_label = self.path_label_list[self.index]
          rel_image_path, label = path_label.split("\t")
      else:
          rel_image_path = self.path_label_list[self.index]
          label = None
      img_path = "{}/{}".format(self.image_home, rel_image_path)
      image = cv2.imread(img_path)
      origin_height = image.shape[0]
      ratio = self.height / origin_height
      width = int(image.shape[1] * ratio)
      height = int(image.shape[0] * ratio)
      image = cv2.resize(image, (width, height))
  
      self.index += 1
      if label:
          return {"image": image, "label": label}
      else:
          return {"image": image}
  
file_path: PaddleOCR/StyleText/engine/style_samplers.py
imports: import numpy
  import random
  import cv2
label_desc: Use image node_id 2 for calling the DatasetSampler obj's underlying member method code with example usage: obj.sample() and returns: dict, dict