code: def load_train_data(dir_path="/tmp/malaria", resize_size=(128, 128)):
      dir_path = check_dataset_exist(dirpath=dir_path)
      path_train_label_1 = os.path.join(
          dir_path, "training_set/Parasitized"
      )
      path_train_label_0 = os.path.join(
          dir_path, "training_set/Uninfected"
      )
      train_label_1 = load_image_path(os.listdir(path_train_label_1))
      train_label_0 = load_image_path(os.listdir(path_train_label_0))
      labels = []
      Images = np.empty(
          (
              len(train_label_1) + len(train_label_0),
              3,
              resize_size[0],
              resize_size[1],
          ),
          dtype=np.uint8,
      )
      for i in range(len(train_label_0)):
          image_path = os.path.join(
              path_train_label_0, train_label_0[i]
          )
          temp_image = np.array(
              Image.open(image_path).resize(resize_size).convert("RGB")
          ).transpose(2, 0, 1)
          Images[i] = temp_image
          labels.append(0)
      for i in range(len(train_label_1)):
          image_path = os.path.join(
              path_train_label_1, train_label_1[i]
          )
          temp_image = np.array(
              Image.open(image_path).resize(resize_size).convert("RGB")
          ).transpose(2, 0, 1)
          Images[i + len(train_label_0)] = temp_image
          labels.append(1)
  
      Images = np.array(Images, dtype=np.float32)
      labels = np.array(labels, dtype=np.int32)
      return Images, labels
  
file_path: singa/examples/malaria_cnn/data/malaria.py
imports: import numpy
  import os
  import sys
  from PIL import Image
label_desc: Use image node_id 1 for calling a global function with example usage: load_train_data(dir_path, resize_size) and returns: Images,  labels