一个自由转换图像标注格式的工具
Project description
图像标注格式转换器(image-annotations)
使用方法
标注文件说明
| 标注格式 | 文件类型 | 一张图片对应 | 一个检测框对应 |
|---|---|---|---|
| YOLO | txt | 一个txt文件 | txt文件中的一行 |
| VOC | xml | 一个xml文件 | xml文件中的一个object标签 |
| COCO | json | json文件中images的一项 | json文件中annotations的一项 |
YOLO格式
YOLO格式的目标检测标注文件通常以txt文件给出,一个txt标注文件对应一张图片,txt文件的一行对应一个目标检测框。标注格式如下:class_id x_center/width y_center/height w/width h/height其中,class_id表示类别ID,x_center表示标注框中心点x坐标,y_center表示标注框中心点y坐标,w表示标注框宽度,h表示标注框高度,width表示图片宽度,height表示图片高度。
txt标注文件示例如下:
2 0.079166666 0.6759259 0.090625 0.11666667 1 0.22552083 0.67314816 0.015625 0.048148148 1 0.21484375 0.6759259 0.0140625 0.04074074 1 0.1890625 0.6726852 0.016666668 0.047222223 1 0.17916666 0.67083335 0.014583333 0.049074072 1 0.15520833 0.6712963 0.015625 0.05
VOC格式
VOC格式的目标检测文件通常以xml文件给出,一个xml标注文件对应一张图片,xml文件的一个object标签对应一个目标检测框。xml标注文件示例如下:
<annotation> <folder>Desktop</folder> <filename>test.jpg</filename> <path>/home/DrZon/test.jpg</path> <source> <database>Unknown</database> </source> <size> <width>194</width> <height>259</height> <depth>3</depth> </size> <segmented>0</segmented> <object> <name>categoryName</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>56</xmin> <ymin>22</ymin> <xmax>132</xmax> <ymax>229</ymax> </bndbox> </object> </annotation>
COCO格式
COCO格式的目标检测标注文件通常以json文件给出,将所有图片的所有标注写在同一个文件里面,示例格式如下:{
"info": {
"year": 2024,
"version": "1.0",
"description": "目标检测训练数据集",
"contributor": "Your Name",
"url": "",
"date_created": "2024-06-15"
},
"licenses": [{
"id": 1,
"name": "Academic Use Only",
"url": ""
}],
"images": [
{
"id": 1,
"license": 1,
"file_name": "000001.jpg",
"height": 600,
"width": 800,
"date_captured": "2024-06-15 10:30:00"
},
{
"id": 2,
"license": 1,
"file_name": "000002.jpg",
"height": 480,
"width": 640,
"date_captured": "2024-06-15 10:31:00"
}
],
"annotations": [
{
"id": 1,
"image_id": 1,
"category_id": 1,
"bbox": [120, 150, 80, 120],
"area": 9600,
"segmentation": [],
"iscrowd": 0
},
{
"id": 2,
"image_id": 1,
"category_id": 2,
"bbox": [350, 200, 100, 60],
"area": 6000,
"segmentation": [],
"iscrowd": 0
},
{
"id": 3,
"image_id": 2,
"category_id": 1,
"bbox": [50, 80, 60, 100],
"area": 6000,
"segmentation": [],
"iscrowd": 0
}
],
"categories": [
{
"id": 1,
"name": "person",
"supercategory": "human"
},
{
"id": 2,
"name": "car",
"supercategory": "vehicle"
}
]
}
更新日志
| 版本 | 更新内容 | 更新日期 |
|---|---|---|
| 0.1.0 | 实现YOLO、COCO、VOC三种格式的目标检测标注文件相互转换 | 2026年1月6日 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_annotations-0.1.0-py3-none-any.whl.
File metadata
- Download URL: image_annotations-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
115b9ace2cadd5293bb7c9a7135b4ca93eaaef3779aea4e2552adbf5673ea12c
|
|
| MD5 |
b90c72da057626f1f53b142f04d8e9e4
|
|
| BLAKE2b-256 |
fdfb5da48f7bbc6380f4b331fa7d3385f95aadd1500e846ca5ec00722111caa5
|