code: def inference(image_path, model_path, batch_size, sc):
      imageDF = NNImageReader.readImages(
          image_path, sc, resizeH=300, resizeW=300, image_codec=1
      )
      getName = udf(lambda row: row[0], StringType())
      transformer = ChainedPreprocessing(
          [
              RowToImageFeature(),
              ImageResize(256, 256),
              ImageCenterCrop(224, 224),
              ImageChannelNormalize(123.0, 117.0, 104.0),
              ImageMatToTensor(),
              ImageFeatureToTensor(),
          ]
      )
  
      model = Model.loadModel(model_path)
  
      est = Estimator.from_bigdl(
          model=model, feature_preprocessing=transformer
      )
  
      predictionDF = est.predict(
          data=imageDF, batch_size=batch_size, feature_cols="image"
      ).withColumn("name", getName(col("image")))
      return predictionDF
  
file_path: analytics-zoo/pyzoo/zoo/examples/orca/learn/bigdl/imageInference/imageInference.py
imports: from optparse import OptionParser
  from bigdl.nn.layer import Model
  from pyspark.sql.functions import col, udf
  from pyspark.sql.types import StringType, DoubleType
  from zoo.feature.image import *
  from zoo.pipeline.nnframes import *
  from zoo.orca.learn.bigdl.estimator import Estimator
  from zoo.orca import init_orca_context, stop_orca_context
label_desc: Use image node_id 1 for calling a global function with example usage: inference(image_path, model_path, batch_size, sc) and returns: predictionDF