code: def create_image_mb_source(
      map_file, mean_file, train, total_number_of_samples
  ):
      if not os.path.exists(map_file) or not os.path.exists(mean_file):
          raise RuntimeError(
              "File '%s' or '%s' does not exist. Please run install_cifar10.py from DataSets/CIFAR-10 to fetch them"
              % (map_file, mean_file)
          )
  
      # transformation pipeline for the features has jitter/crop only when training
      transforms = []
      if train:
          transforms += [
              xforms.crop(
                  crop_type="randomside",
                  side_ratio=(0.8, 1.0),
                  jitter_type="uniratio",
              )  # train uses jitter
          ]
      transforms += [
          xforms.scale(
              width=image_width,
              height=image_height,
              channels=num_channels,
              interpolations="linear",
          ),
          xforms.mean(mean_file),
      ]
      # 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=train,
          max_samples=total_number_of_samples,
          multithreaded_deserializer=True,
      )
  
file_path: CNTK/Examples/Image/Classification/ResNet/Python/TrainResNet_CIFAR10.py
imports: from __future__ import print_function
  import os
  import argparse
  import cntk
  import numpy
  from cntk import cross_entropy_with_softmax, classification_error, reduce_mean
  from cntk import Trainer, cntk_py
  from cntk.io import MinibatchSource, ImageDeserializer, StreamDef, StreamDefs
  from cntk.learners import momentum_sgd, learning_parameter_schedule_per_sample, momentum_schedule
  from cntk.debugging import *
  from cntk.logging import *
  from resnet_models import *
  import cntk.io.transforms
label_desc: Use image node_id 1 for calling a global function with example usage: create_image_mb_source(map_file, mean_file, train, total_number_of_samples) and returns: MinibatchSource