语义分割数据集制作(借助labelme)

1、安装labelme

在虚拟环境中输入下述命令:

# 安装pyqt:
conda install pyqt
# 安装labelme:
pip install labelme -i https://pypi.tuna.tsinghua.edu.cn/simple

2、标注

使用labelme进行标注


标注图

3、获取掩码图像

在当前虚拟环境中运行如下代码


数据目录示例
"""最后得到的文件如上图 b_json 目录所示"""
import glob
import os

data_folder = r"datasets"  # 如上图所示

for json_file in glob.glob(data_folder + "\*.json"):
    os.system("labelme_json_to_dataset " + json_file)

可获得分割数据集数据,如下所示:


PNG图像

注:
若出现 【TypeError: only integer scalar arrays can be converted to a scalar index】 错误,可在PIL / Image.py Line:1712 data = bytes(data) 上面添加代码:data = data.tolist() 解决

参考
深度学习图像标注工具-Labelme - 知乎 (zhihu.com)
语义分割数据集(多分类)制作 - (jianshu.com)
TypeError: only integer scalar arrays can be converted to a scalar index · Issue #453 · wkentaro/labelme (github.com)

你可能感兴趣的:(语义分割数据集制作(借助labelme))