code: def create_map_file_from_folder(
      root_folder, class_mapping, include_unknown=False
  ):
      map_file_name = os.path.join(root_folder, "map.txt")
      lines = []
      for class_id in range(0, len(class_mapping)):
          folder = os.path.join(root_folder, class_mapping[class_id])
          if os.path.exists(folder):
              for entry in os.listdir(folder):
                  filename = os.path.join(folder, entry)
                  if (
                      os.path.isfile(filename)
                      and os.path.splitext(filename)[1] in file_endings
                  ):
                      lines.append(
                          "{0}\t{1}\n".format(filename, class_id)
                      )
  
      if include_unknown:
          for entry in os.listdir(root_folder):
              filename = os.path.join(root_folder, entry)
              if (
                  os.path.isfile(filename)
                  and os.path.splitext(filename)[1] in file_endings
              ):
                  lines.append("{0}\t-1\n".format(filename))
  
      lines.sort()
      with open(map_file_name, "w") as map_file:
          for line in lines:
              map_file.write(line)
  
      return map_file_name
  
file_path: CNTK/Examples/Image/TransferLearning/TransferLearning_Extended.py
imports: from __future__ import print_function
  import numpy
  import os
  from cntk import load_model
  from TransferLearning import *
label_desc: Use image node_id 1 for calling a global function with example usage: create_map_file_from_folder(root_folder, class_mapping, include_unknown) and returns: map_file_name