labelme格式与yolo格式区别
Labelme格式和YOLO格式是两种用于图像标注的常见格式,主要用于目标检测和图像分割任务。
矩形标注:
矩形标注labelme文件格式(json):
{
{
"version": "2024.11.5.0",
"flags": {},
"shapes": [
{
"label": "猫",
"points": [
[
19.417808219178088,
59.86986301369862
],
[
132.29452054794524,
212.47260273972603
]
],
"group_id": null,
"description": "",
"shape_type": "rectangle",
"flags": {},
"mask": null
},
{
"label": "狗",
"points": [
[
132.02054794520546,
14.664383561643813
],
[
262.1575342465753,
236.85616438356163
]
],
"group_id": null,
"description": "",
"shape_type": "rectangle",
"flags": {},
"mask": null
}
],
"imagePath": "OIP.jpg",
"imageData": null,
"imageHeight": 277,
"imageWidth": 275
}
矩形标注yolo文件格式(.txt):
1 0.275840597758406 0.4915928984718857 0.41046077210460785 0.5509124177834924
0 0.7166874221668742 0.45400820928737445 0.47322540473225405 0.8021363928589091
多边形标注:
多边形标注labelme文件格式(json):
{
"version": "2024.11.5.0",
"flags": {},
"shapes": [
{
"label": "三角形",
"points": [
[
263.98019801980195,
18.316831683168317
],
[
53.58415841584159,
381.68316831683165
],
[
473.38613861386136,
382.1782178217822
]
],
"group_id": null,
"description": "",
"shape_type": "polygon",
"flags": {},
"mask": null
}
],
"imagePath": "R-C.jpg",
"imageData": null,
"imageHeight": 523,
"imageWidth": 524
}
多边形标注yolo文件格式(.txt):
0 0.5037790038545839 0.03502262272116313 0.1022598443050412 0.7297957329193722 0.9034086614768346 0.7307422902902145
Labelme格式:
- 以JSON文件格式存储每个标注的形状(如多边形、矩形等)的坐标信息,每个图像对应一个同名的json文件。
- 支持多边形、矩形、线条、圆、点等多种形状的标注。
- 坐标通常是绝对值,表示图像中标注形状的具体像素位置,一个多边形的坐标是一个包含多个点的数组。
- 提供图形用户界面(GUI),可以图像上进行标注,直接生成JSON文件。
YOLO格式:
-
以文件文本(.txt)存储,每个图像对应一个同名的.txt文件,文本内容每一行对应一个标签信息。
-
主要用于矩形框的标注,更适合目标检测任务。
-
坐标是相对值,通常是归一化到[0, 1]区间;
矩形框的表示形式为:<class_id> <x_center> <y_center> < width >< height>.
<class_id> :这是目标的类别编号,通常从0开始.
<x_center>:这是目标在图像中的中心点的x坐标,归一化到[0, 1]范围内.
<y_center>:这是目标在图像中的中心点的y坐标,归一化到[0, 1]范围内.
< width >:这是目标的宽度,归一化到[0, 1]范围内.
< height >:这是目标的高度,归一化到[0, 1]范围内.多边形的表示形式为:<class_id> < polygon Vertices>.
< polygon Vertices>:表示多边形的顶点数组,归一化后的x和y坐标.