code: def fbresnet_augmentor(isTrain):
      """
      Augmentor used in fb.resnet.torch, for BGR images in range [0,255].
      """
      interpolation = cv2.INTER_CUBIC
      # linear seems to have more stable performance.
      # but we keep cubic for compatibility with old models
      if isTrain:
          augmentors = [
              imgaug.GoogleNetRandomCropAndResize(interp=interpolation),
              imgaug.ToFloat32(),  # avoid frequent casting in each color augmentation
              # It's OK to remove the following augs if your CPU is not fast enough.
              # Removing brightness/contrast/saturation does not have a significant effect on accuracy.
              # Removing lighting leads to a tiny drop in accuracy.
              imgaug.RandomOrderAug(
                  [
                      imgaug.BrightnessScale((0.6, 1.4)),
                      imgaug.Contrast((0.6, 1.4), rgb=False),
                      imgaug.Saturation(0.4, rgb=False),
                      # rgb-bgr conversion for the constants copied from fb.resnet.torch
                      imgaug.Lighting(
                          0.1,
                          eigval=np.asarray(
                              [0.2175, 0.0188, 0.0045][::-1]
                          )
                          * 255.0,
                          eigvec=np.array(
                              [
                                  [-0.5675, 0.7192, 0.4009],
                                  [-0.5808, -0.0045, -0.8140],
                                  [-0.5836, -0.6948, 0.4203],
                              ],
                              dtype="float32",
                          )[::-1, ::-1],
                      ),
                  ]
              ),
              imgaug.ToUint8(),
              imgaug.Flip(horiz=True),
          ]
      else:
          augmentors = [
              imgaug.ResizeShortestEdge(256, interp=interpolation),
              imgaug.CenterCrop((224, 224)),
          ]
      return augmentors
  
imports: import multiprocessing
  import numpy
  import os
  from abc import abstractmethod
  import cv2
  import tqdm
  from tensorpack import tfv1
  from tensorpack import ModelDesc
  from tensorpack.dataflow import AugmentImageComponent, BatchData, MultiThreadMapData, MultiProcessRunnerZMQ, dataset, imgaug
  from tensorpack.input_source import QueueInput, StagingInput
  from tensorpack.models import regularize_cost, l2_regularizer
  from tensorpack.predict import FeedfreePredictor, PredictConfig
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.tfutils.optimizer import AccumGradOptimizer
  from tensorpack.utils import logger
  from tensorpack.utils.stats import RatioCounter
label_desc: Use image node_id 1 for calling a global function with example usage: fbresnet_augmentor(isTrain) and returns: augmentors