code: def image_preprocess(image, bgr=True):
      with tf.name_scope("image_preprocess"):
          if image.dtype.base_dtype != tf.float32:
              image = tf.cast(image, tf.float32)
  
          mean = cfg.PREPROC.PIXEL_MEAN
          std = np.asarray(cfg.PREPROC.PIXEL_STD)
          if bgr:
              mean = mean[::-1]
              std = std[::-1]
          image_mean = tf.constant(mean, dtype=tf.float32)
          image_invstd = tf.constant(1.0 / std, dtype=tf.float32)
          image = (image - image_mean) * image_invstd
          return image
  
imports: import numpy
  import tensorflow
  from contextlib import ExitStack, contextmanager
  from tensorpack import tfv1
  from tensorpack.models import BatchNorm, Conv2D, MaxPooling, layer_register
  from tensorpack.tfutils import argscope
  from tensorpack.tfutils.scope_utils import auto_reuse_variable_scope
  from tensorpack.tfutils.varreplace import custom_getter_scope, freeze_variables
  from config import config
label_desc: Use image node_id 5 for calling a global function with example usage: image_preprocess(image, bgr) and returns: image