Python iFDO implementation
Project description
ifdo-py
ifdo-py is a Python library for the iFDO file format.
Install
pip install ifdo
Usage
Read/write iFDO files
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")
Create image annotations
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'
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ifdo-1.2.5.tar.gz
(13.5 kB
view details)
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
ifdo-1.2.5-py3-none-any.whl
(13.7 kB
view details)
File details
Details for the file ifdo-1.2.5.tar.gz.
File metadata
- Download URL: ifdo-1.2.5.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.12 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
add671b0f645538c9d0acbd4f5e0cce98bdb82f618f301d622137e653629fbbd
|
|
| MD5 |
f306b79468335bfec654adf5c76dd9fd
|
|
| BLAKE2b-256 |
f54886d667fe0c78921a4714691daae6f2ad128aa3785a89db6f94cee1b2b69d
|
File details
Details for the file ifdo-1.2.5-py3-none-any.whl.
File metadata
- Download URL: ifdo-1.2.5-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.12 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1808e4963dbd25568b1fc8bce1ed99817803ccd5daaa9fac6ff1d61ccc3d2c97
|
|
| MD5 |
7eb333a61d279b77716e80c0fd96fd60
|
|
| BLAKE2b-256 |
69979b1021be1646cf84cfb61623de93defb834de45c18be09086babaa70fbb9
|