code: def create_image_mb_source(
      map_file, is_training, total_number_of_samples
  ):
      if not os.path.exists(map_file):
          raise RuntimeError("File '%s' does not exist." % map_file)
  
      # transformation pipeline for the features has jitter/crop only when training
      transforms = []
      if is_training:
          transforms += [
              xforms.crop(
                  crop_type="randomside",
                  side_ratio=(0.4375, 0.875),
                  jitter_type="uniratio",
              )  # train uses jitter
          ]
      else:
          transforms += [
              xforms.crop(
                  crop_type="center", side_ratio=0.5833333
              )  # test has no jitter
          ]
  
      transforms += [
          xforms.scale(
              width=image_width,
              height=image_height,
              channels=num_channels,
              interpolations="linear",
          ),
      ]
  
      # deserializer
      return MinibatchSource(
          ImageDeserializer(
              map_file,
              StreamDefs(
                  features=StreamDef(
                      field="image", transforms=transforms
                  ),  # first column in map file is referred to as 'image'
                  labels=StreamDef(field="label", shape=num_classes),
              ),
          ),  # and second as 'label'
          randomize=is_training,
          max_samples=total_number_of_samples,
          multithreaded_deserializer=True,
      )
  
file_path: CNTK/Examples/Image/Classification/VGG/Python/VGG19_ImageNet_Distributed.py
imports: from __future__ import print_function
  import os
  import math
  import argparse
  import numpy
  import cntk
  import _cntk_py
  import cntk.io.transforms
  from cntk.logging import *
  from cntk.ops import placeholder, minus, constant, relu
  from cntk.train.distributed import data_parallel_distributed_learner, Communicator
  from cntk.io import ImageDeserializer, MinibatchSource, StreamDef, StreamDefs, FULL_DATA_SWEEP
  from cntk.layers import Convolution2D, Activation, MaxPooling, Dense, Dropout, default_options, Sequential, For
  from cntk.initializer import normal
  from cntk.train.training_session import *
label_desc: Use image node_id 1 for calling a global function with example usage: create_image_mb_source(map_file, is_training, total_number_of_samples) and returns: MinibatchSource