def get_imagenet_mini_foldername_to_classname(metadata_file):
    """Returns a dictionary mapping from ImageNet mini-foldername to classname."""
    with open(metadata_file) as f:
        data = f.readlines()

    assert len(data) == 1000
    data = {x.split(" ")[0]:x.split(" ")[2].split("\n")[0] for x in data}
    data = {k:v.replace("_", " ") for k, v in data.items()}

    return data