code: def load(
      data_dir,
      data_name,
      min_shorter_side=None,
      max_longer_side=1000,
      batch_size=1,
      total_num=None,
  ):
      assert cv2 is not None, "`load` requires `cv2`."
      _, files = get_files(data_dir, data_name, total_num)
      total_num = len(files)
  
      for batch_start in range(0, total_num, batch_size):
          x = cv2.imread(
              "%s/%s/%s" % (data_dir, data_name, files[batch_start])
          )
          if min_shorter_side is not None:
              scale = float(min_shorter_side) / np.min(x.shape[:2])
          else:
              scale = 1.0
          if round(scale * np.max(x.shape[:2])) > max_longer_side:
              scale = float(max_longer_side) / np.max(x.shape[:2])
          x = cv2.resize(
              x,
              None,
              None,
              fx=scale,
              fy=scale,
              interpolation=cv2.INTER_LINEAR,
          )
          x = np.array([x], dtype=np.float32)
          scale = np.array([scale], dtype=np.float32)
          yield x, scale
          del x
  
file_path: tensornets/tensornets/datasets/coco.py
imports: from __future__ import division
  import os
  import json
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: load(data_dir, data_name, min_shorter_side, max_longer_side, batch_size, total_num) without return types