Spaces:
No application file
No application file
| import os | |
| import numpy as np | |
| from PIL import Image | |
| data_directory = "/vol/data/histo_datasets/NuClick/IHC_nuclick/IHC/" | |
| splits = ["Train", "Validation"] | |
| for s in splits: | |
| masks_list = os.listdir(data_directory + "masks/" + s) | |
| for m in masks_list: | |
| mask = np.load(data_directory + "masks/" + s + "/" + m) | |
| mask = mask.astype(np.uint8) | |
| Image.fromarray(mask).save(data_directory + "masks_png/" + s + "/" + m[:-4] + ".png") | |