PaddleSeg
PaddleSeg copied to clipboard
我将每一张图片进行标注后分别生成json文件,这个方式方便我管理文件,现在我想将各自的json文件合并成为coco文件进行训练,但是我不知道有什么方法,请指教
我将每一张图片进行标注后分别生成json文件,这个方式方便我管理文件,现在我想将各自的json文件合并成为coco文件进行训练,但是我不知道有什么方法,请指教
我将每一张图片进行标注后分别生成json文件,这个方式方便我管理文件,现在我想将各自的json文件合并成为coco文件进行训练,但是我不知道有什么方法,请指教
请问你这分别生成json文件是指使用eiseg保存json的功能保存的吗?然后这个意识实现有一个脚本将这些json合并成一个coco格式的json吗
对的,我是用EISeg抠图完成后,单独保存为json的格式,我现在想将各自的json文件合并成为一个coco文件,但是现在EISeg没有这个功能,能不能提供一个python的py,或者在EISeg里面加入这个功能,因为我想将我挑选出来的图片进行各自的json合并,而不是每次都全部重新标注一次组成coco文件,这样太浪费时间了。请指教。
对的,我是用EISeg抠图完成后,单独保存为json的格式,我现在想将各自的json文件合并成为一个coco文件,但是现在EISeg没有这个功能,能不能提供一个python的py,或者在EISeg里面加入这个功能,因为我想将我挑选出来的图片进行各自的json合并,而不是每次都全部重新标注一次组成coco文件,这样太浪费时间了。请指教。
收到,下面会完善这个功能
@lm1978lm 您好
eiseg加入json格式的保存是我们加入coco格式保存之前的一个过渡功能。我们的json格式只保存了一些基础的标签和多边形信息而且和主流框架的pipeline没有兼容,后期维护的话会增加很多工作量。我们这边是倾向于在下一个版本将这个功能删除。
可不可以描述一下您这边想每个图像保存一个标签是什么原因。我们考虑一下这个功能要不要保留🤔如果是方便后面划分训练验证和测试集,paddlex提供了将coco格式进行划分的功能,可以参考这里
您好,我仔细描述一下,我有5个细胞的分类,而且我标记的细胞会被划分到不同的病种,比如一开始是贫血患者,但这个患者也可能是某种肿瘤的患者,所以需要不停的变化类别,而且我的数据每天都有跟新,我还要考虑患者的其他数据,如果一开始我就合并成coco数据我就无法还原每个数据,也就没有办法更新患者的其他数据,或者重新划分类别。如果要更新只有重新标注一次。如果说json的文件有信息丢失,那么我单独保存json文件也就有信息丢失是这样吗?所以我建议保留这个功能,并且补全json信息,能够合并到coco文件,就像labelme一样。谢谢!
收到,我们尽量research一个单个文件的通用格式,如果实在找不到后期会完善我们这边的json
@lm1978lm 我们这边的计划是后期采用labelme格式,labelme是一个图像一个标签。会提供从现在的json到labelme的转换脚本,软件也支持直接打开现在的json格式但保存成labelme。labelme好转coco,网上脚本不少我们也会出教程。 最近比较忙估计有个一周左右能实现。
收到,谢谢
最近我有一个前半部分是保存成了coco, 后面保存成了json的标注结果, 这是一个简单的转换脚本, 供人参考:
# %%
import json
from pathlib import Path
from PIL import Image
root = Path('/标注/数据/的/根目录')
label_root = (root / 'label')
assert label_root.exists()
# %%
annotations = json.load(open(label_root / 'annotations.json'))
for json_path in label_root.glob("*[!annotations].json"):
name = json_path.stem
curr_json = json.load(open(json_path))
curr_image_id = annotations['images'][-1]['id'] + 1
image_file_path = next(root.glob(f'{name}*'))
width, height = Image.open(image_file_path).size
annotations['images'].append({
'id': curr_image_id,
'width': width,
'height': height,
'file_name': image_file_path.name,
'license': '',
'flickr_url': '',
'coco_url': '',
'date_captured': ''
})
for item in curr_json:
last_anno_id = annotations['annotations'][-1]['id']
annotations['annotations'].append({
'id': last_anno_id + 1,
'image_id': curr_image_id,
'category_id': item['labelIdx'],
'segmentation': [[i for p in item['points'] for i in p]],
'area': 0,
'bbox': [0] * 4
})
json.dump(annotations, open(label_root / 'annotations.json.new', 'w'))
https://blog.csdn.net/baidu_40840693/article/details/103732070 这个博主写的可以将多个coco合并成一个,亲测有效
你好,您的这个eiseg的json转labelme的json文件到哪里可以下载,我现在用eiseg标注了200图片用不了!
最近我有一个前半部分是保存成了coco, 后面保存成了json的标注结果, 这是一个简单的转换脚本, 供人参考:
# %% import json from pathlib import Path from PIL import Image root = Path('/标注/数据/的/根目录') label_root = (root / 'label') assert label_root.exists() # %% annotations = json.load(open(label_root / 'annotations.json')) for json_path in label_root.glob("*[!annotations].json"): name = json_path.stem curr_json = json.load(open(json_path)) curr_image_id = annotations['images'][-1]['id'] + 1 image_file_path = next(root.glob(f'{name}*')) width, height = Image.open(image_file_path).size annotations['images'].append({ 'id': curr_image_id, 'width': width, 'height': height, 'file_name': image_file_path.name, 'license': '', 'flickr_url': '', 'coco_url': '', 'date_captured': '' }) for item in curr_json: last_anno_id = annotations['annotations'][-1]['id'] annotations['annotations'].append({ 'id': last_anno_id + 1, 'image_id': curr_image_id, 'category_id': item['labelIdx'], 'segmentation': [[i for p in item['points'] for i in p]], 'area': 0, 'bbox': [0] * 4 }) json.dump(annotations, open(label_root / 'annotations.json.new', 'w'))
你好,请问这个脚本是哪个格式转那个
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
你好,您的这个eiseg的json转labelme的json文件到哪里可以下载,我现在用eiseg标注了200图片用不了!
请问解决了么
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
