code: def reader(images, paths, shrink):
      """
      Preprocess to yield image.
  
      Args:
          images (list(numpy.ndarray)): images data, shape of each is [H, W, C], color space is BGR.
          paths (list[str]): paths to images.
          shrink (float): parameter to control the resize scale in preprocess.
  
      Yield:
          each (collections.OrderedDict): info of original image, preprocessed image.
      """
      component = list()
      if paths is not None:
          assert type(paths) is list, "paths should be a list."
          for im_path in paths:
              each = OrderedDict()
              assert os.path.isfile(
                  im_path
              ), "The {} isn't a valid file path.".format(im_path)
              im = cv2.imread(im_path)
              each["org_im"] = im
              each["org_im_path"] = im_path
              component.append(each)
      if images is not None:
          assert type(images) is list, "images should be a list."
          for im in images:
              each = OrderedDict()
              each["org_im"] = im
              each["org_im_path"] = "ndarray_time={}".format(
                  round(time.time(), 6) * 1e6
              )
              component.append(each)
  
      for element in component:
          (
              element["image"],
              element["image_height"],
              element["image_width"],
          ) = preprocess(element["org_im"], shrink)
          yield element
  
imports: import os
  import time
  from collections import OrderedDict
  import cv2
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: reader(images, paths, shrink) without return types