code: def apply(model, model_path, images, ground_truth=None):
      left = cv2.imread(images[0])
      h, w = left.shape[:2]
      newh = (h // 64) * 64
      neww = (w // 64) * 64
      aug = imgaug.CenterCrop((newh, neww))
      left = aug.augment(left)
  
      predict_func = OfflinePredictor(
          PredictConfig(
              model=model(height=newh, width=neww),
              session_init=SmartInit(model_path),
              input_names=["left", "right"],
              output_names=["prediction"],
          )
      )
  
      for idx, right in enumerate(images[1:]):
          right = aug.augment(cv2.imread(right))
  
          left_input, right_input = [
              x.astype("float32").transpose(2, 0, 1)[None, ...]
              for x in [left, right]
          ]
          output = predict_func(left_input, right_input)[0].transpose(
              0, 2, 3, 1
          )
          flow = Flow()
  
          img = flow.visualize(output[0])
          patches = [left, right, img * 255.0]
          if ground_truth is not None:
              patches.append(
                  flow.visualize(Flow.read(ground_truth)) * 255.0
              )
          img = viz.stack_patches(patches, 2, 2)
  
          cv2.imshow("flow output", img)
          cv2.imwrite("flow_output{:03d}.png".format(idx), img)
          cv2.waitKey(0)
  
          left = right
  
file_path: tensorpack/examples/OpticalFlow/flownet2.py
imports: import argparse
  import glob
  import os
  import cv2
  from tensorpack import *
  from tensorpack.utils import viz
  import flownet_models
  from helper import Flow
label_desc: Use image node_id 1 for calling a global function with example usage: apply(model, model_path, images, ground_truth) without return types