一、数据集标注:Labelme
安装后labelme后,在C:\Users\xxx\Anaconda3\Lib\site-packages\labelme\utils下修改_io.py
def lblsave(filename, lbl):
if osp.splitext(filename)[1] != '.png':
filename += '.png'
# Assume label ranses [-1, 254] for int32,
# and [0, 255] for uint8 as VOC.
if lbl.min() >= -1 and lbl.max() < 255:
lbl_pil = PIL.Image.fromarray(lbl.astype(np.uint8), mode='L')
# colormap = label_colormap(255)
# lbl_pil.putpalette((colormap * 255).astype(np.uint8).flatten())
lbl_pil.save(filename)
else:
logger.warn(
'[%s] Cannot save the pixel-wise class label as PNG, '
'so please use the npy file.' % filename
)
原来的labelme版本程序是生成8位彩色的label.png,按照上面代码修改程序得到8位全部为黑色的label.png文件。这个黑色的图片才