iFDO工具
项目描述
ifdo-py
ifdo-py是iFDO文件格式的Python库。
安装
pip install ifdo
用法
读写iFDO文件
from ifdo import iFDO
# Read from YAML file
ifdo_object = iFDO.load("path/to/ifdo.yaml")
# Write to YAML
ifdo_object.save("path/to/ifdo.yaml")
创建图像注释
from datetime import datetime
from ifdo.models import ImageAnnotation, AnnotationCoordinate, AnnotationLabel
# Create a bounding box
coordinates = [
AnnotationCoordinate(x=0, y=0),
AnnotationCoordinate(x=1, y=0),
AnnotationCoordinate(x=1, y=1),
AnnotationCoordinate(x=0, y=1),
]
# Create a label for it
label = AnnotationLabel(id="fish", annotator="kevin", created_at=datetime.now(), confidence=0.9)
# Pack it into an annotation
annotation = ImageAnnotation(coordinates=coordinates, labels=[label], shape='rectangle')
# Print it as a dictionary
print(annotation.to_dict())
{
'coordinates': [
{'x': 0, 'y': 0},
{'x': 1, 'y': 0},
{'x': 1, 'y': 1},
{'x': 0, 'y': 1}
],
'labels': [
{
'id': 'fish',
'annotator': 'kevin',
'created-at': datetime.datetime(2023, 2, 28, 16, 39, 46, 451290),
'confidence': 0.9
}
],
'shape': 'rectangle'
}
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源分布
ifdo-1.1.3.tar.gz (6.1 kB 查看哈希值)
构建分布
ifdo-1.1.3-py3-none-any.whl (6.9 kB 查看哈希值)