def load_label(maindir, idx, split):
"""
Load label image as 1 x height x width integer array of label indices.
The leading singleton dimension is required by the loss.
"""
if split=='train':
im = Image.open('{}/GDI/gd_imp_train/{}.png'.format(maindir, idx))
else:
im = Image.open('{}/GDI/gd_imp_val/{}.png'.format(maindir, idx))
label = np.array(im, dtype=np.uint8)
label = label/255.0
label = label[np.newaxis, ...]
return label
评论列表
文章目录