def load_fine2coarse_map(map_filename):
    """ Load mapping of fine to coarse tags """

    fine2coarse, coarse2fine = dict(), dict()
    with open(map_filename) as f:
        for line in f:
            fine, coarse = line.strip().split()
            fine2coarse[fine] = coarse
            if coarse in coarse2fine:
                coarse2fine[coarse].add(fine)
            else:
                coarse2fine[coarse] = {fine}
    return fine2coarse, coarse2fine