Closed MrLinNing closed 4 years ago
I would start with:
Example code (not tested):
import numpy as np
from PIL import Image
colors = [(255, 0, 0), (0, 255, 0), ...]
img = np.array(Image.open(file))
label = np.zeros(img[:-1])
for anno, c in enumerate(colors):
label[img == c] = anno
label = Image.fromarray(label).astype(np.uint8))
label.save(save_file)
Hello, I want to train the model by big resolution CamVid dataset, and I find the big image can be download here https://github.com/mostafaizz/camvid, but its label image is not consistent with small (480x360) https://github.com/alexgkendall/SegNet-Tutorial/tree/master/CamVid . I am a new segmentation player, I don't know how to convert the color label image to the annotation image. Can you give me some advice about it? Thank you!