code: def create_class_dict(data_folder):
      # get relative paths for map files
      img_file_paths = _get_image_paths(data_folder, True)
      train_classes = ["__background__"]
  
      for img_path in img_file_paths:
          abs_img_path = os.path.join(data_folder, img_path)
          labelsPaths = abs_img_path[:-4] + ".bboxes.labels.tsv"
          if not os.path.exists(labelsPaths):
              continue
          with open(labelsPaths, "rb") as f:
              lines = f.readlines()
          labels = [
              _removeLineEndCharacters(s).decode("utf-8") for s in lines
          ]
  
          for label in labels:
              if not label in train_classes:
                  train_classes.append(label)
  
      class_dict = {k: v for v, k in enumerate(train_classes)}
      class_list = [None] * len(class_dict)
      for k in class_dict:
          class_list[class_dict[k]] = k
      class_map_file_path = os.path.join(data_folder, "class_map.txt")
      with open(class_map_file_path, "w") as class_map_file:
          for i in range(len(class_list)):
              class_map_file.write("{}\t{}\n".format(class_list[i], i))
  
      return class_dict
  
file_path: CNTK/Examples/Image/Detection/utils/annotations/annotations_helper.py
imports: import numpy
  import os
label_desc: Use image node_id 6 for calling a global function with example usage: create_class_dict(data_folder) and returns: class_dict