Spaces:
No application file
No application file
| import os | |
| from scipy.io import loadmat | |
| import numpy as np | |
| from PIL import Image | |
| from tqdm import tqdm | |
| data_directory = "/vol/data/histo_datasets/Kumar/" | |
| dirs = ["train/", "test_same/", "test_diff/"] | |
| for d in dirs: | |
| dir_list = os.listdir(data_directory + d + "Labels/") | |
| for i in dir_list: | |
| masks = loadmat(data_directory + d + "Labels/" + i)["inst_map"] | |
| os.makedirs(data_directory + d + "Labels_png_new/", exist_ok=True) | |
| Image.fromarray(masks).save(data_directory + d + "Labels_png_new/" + i[:-4] + ".png") |