def load_categories(file_name):
    """
    Loads the category index from file. Each category label is
    the name of a class specified on a separate line. The entry order
    is the index of the class.
    """
    labels = []
    with open(file_name) as f:
        labels = f.read().splitlines()
    categories = {}
    for category in labels:
        categories[category] = len(categories)
    return categories