code: def inference(model, model_path, sintel_path):
      ds = SintelData(sintel_path)
  
      def nhwc2nchw(dp):
          return [
              dp[0].transpose(2, 0, 1),
              dp[1].transpose(2, 0, 1),
              dp[2].transpose(2, 0, 1),
          ]
  
      ds = MapData(ds, nhwc2nchw)
      ds = BatchData(ds, 1)
      ds.reset_state()
  
      # look at shape information (all images in Sintel has the same shape)
      h, w = next(ds.__iter__())[0].shape[2:]
  
      pred = PredictConfig(
          model=model(height=h, width=w),
          session_init=SmartInit(model_path),
          input_names=["left", "right", "gt_flow"],
          output_names=["epe", "prediction"],
      )
      pred = SimpleDatasetPredictor(pred, ds)
  
      avg_epe, count_epe = 0, 0
  
      for o in pred.get_result():
          avg_epe += o[0]
          count_epe += 1
  
      print(
          "average endpoint error (AEE): %f"
          % (float(avg_epe) / float(count_epe))
      )
  
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 2 for calling a global function with example usage: inference(model, model_path, sintel_path) and returns: list