code: def create_mb_source(
      map_file,
      image_width,
      image_height,
      num_channels,
      num_classes,
      randomize=True,
  ):
      transforms = [
          xforms.scale(
              width=image_width,
              height=image_height,
              channels=num_channels,
              interpolations="linear",
          )
      ]
      return MinibatchSource(
          ImageDeserializer(
              map_file,
              StreamDefs(
                  features=StreamDef(
                      field="image", transforms=transforms
                  ),
                  labels=StreamDef(field="label", shape=num_classes),
              ),
          ),
          randomize=randomize,
      )
  
imports: from __future__ import print_function
  import numpy
  import cntk
  import os
  from PIL import Image
  from cntk.device import try_set_default_device, gpu
  from cntk import load_model, placeholder, Constant
  from cntk import Trainer
  from cntk.logging.graph import find_by_name, get_node_outputs
  from cntk.io import MinibatchSource, ImageDeserializer, StreamDefs, StreamDef
  import cntk.io.transforms
  from cntk.layers import Dense
  from cntk.learners import momentum_sgd, learning_parameter_schedule, momentum_schedule
  from cntk.ops import combine, softmax
  from cntk.ops.functions import CloneMethod
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from cntk.logging import log_number_of_parameters, ProgressPrinter
label_desc: Use image node_id 1 for calling a global function with example usage: create_mb_source(map_file, image_width, image_height, num_channels, num_classes, randomize) and returns: MinibatchSource