代码和论文网址:
https://github.com/PaddlePaddle/PaddleSeg
EISeg: Effective interactive segmentation
pip install opencv-python==4.5.5.64
pip install opencv-contrib-python==4.5.5.64
pip install opencv-python-headless==4.5.5.64
pip install eiseg
参考:百度智能语义分割开源软件EIseg新手安装指南
我是安装的PaddlePaddle-gpu、
终端输入:eiseg打开:
下载模型:
我下载的是:高精度模型,通用图像标注场景,EdgeFlow,static_edgeflow_cocolvis。
然后加载的时候:
出现错误:OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
不管许多,上解决方式:
代码前加入两行如下代码即可:
import os
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
之后载入一段时间:
可以正常使用。
因为我需要的是yolo格式的标签文件,但是该eiseg只支持coco和json格式,所以有一个json2txt的python代码参考:
#处理labelme多边形矩阵的标注 json转化txt
#!/usr/bin/ python
# -*- encoding: utf-8 -*-
import json
import cv2
import numpy as np
import glob
def totxt():
# 第二列:中心归一化横坐标(x)
# 第三列:中心归一化纵坐标(y)
# 第四列:归一化宽度(w)
# 第五列:归一化高度(h)
height,width = img.shape[0],img.shape[1]
dw = 1 / width
dh = 1/ height
with open(out_txt_file, "w+") as f:
for shape in data:
points = shape["points"]
cls_id = shape["labelIdx"]-1
xmin, ymin, w, h = cv2.boundingRect(np.array(points, dtype=np.int))
xmax = xmin+w
ymax = ymin+h
x = (xmin + xmax) / 2.0 - 1
y = (ymin + ymax) / 2.0 - 1
w = xmax - xmin
h = ymax - ymin
if w < 50 or h < 50:
continue
x = x * dw
w = w * dw
y = y * dh
h = h * dh
f.write("%s %s %s %s %s\n"%(cls_id,x, y, w, h))
if __name__=="__main__":
# 文件列表
json_list = glob.glob("Annotations/*.json")
for file in json_list:
basename = file.split("\\")[-1].split(".")[0]
# 读取图片
img = cv2.imread("images/"+basename+".png")
if img is None:
continue
# 读取json文件
data = ""
with open(file, 'r', encoding='utf-8') as f:
data = json.load(f)
# yololabels
out_txt_file = "labels/" + basename + ".txt"
totxt()
参考:
使用EISeg自动标注数据,yolov5训练模型(保姆教程)
PaddlePaddle/PaddleSeg
PaddleLabel机器学习辅助标注后端
EISeg分割标注软件使用
网址:https://www.makesense.ai/
很好上手:
标注结束,多边形支持导出VGG Json和COCO Json格式,矩形框支持导出yolo、csv和VOC xml格式。
LabelImg 标注工具:https://github.com/heartexlabs/labelImg
安装LabelImg之前需要安装:
pip install lxml -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install PyQt5_tools -i https://pypi.tuna.tsinghua.edu.cn/simple
LabelImg 的界面如下所示:
只能正方形,适合做分类,不太适合做实例分割的数据集标注。LabelImg 可以保存三种数据格式:PASCAL VOC: voc 的xml 格式,yolo 格式和ML格式。
而labelme可以直接安装:
pip install labelme
打开:
labelme支持多边形操作,只能导出json格式,需要的话,还要进行xml或者txt转换。
Python+Matlab+Halcon语言的转换文件合集