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.5.0.tar.gz
(18.1 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.5.0-py3-none-any.whl
(18.3 kB
view details)
File details
Details for the file ifdo-1.5.0.tar.gz.
File metadata
- Download URL: ifdo-1.5.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
274f159ba04d6730cab9f2ca56979448b58e587704f7cf2be403fc2cdd0238d6
|
|
| MD5 |
a64dd68e3c2484642395525874dc2554
|
|
| BLAKE2b-256 |
3dbdba4b557fb557c02847cc20c789a84c2384a01fb373bf3af3ccc61684400d
|
File details
Details for the file ifdo-1.5.0-py3-none-any.whl.
File metadata
- Download URL: ifdo-1.5.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9507e33fb0a94a8fdfda276a0154a5bcaa5065ebe3f86a7bccf39eb99f721ecb
|
|
| MD5 |
3396a3928ced026d1be49083d8a1eb3a
|
|
| BLAKE2b-256 |
6920e07521583ddde1ba63d412b5682560963723bcdc3e1e8cc699fcbc6681ef
|