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.4.0.tar.gz
(17.0 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.4.0-py3-none-any.whl
(17.4 kB
view details)
File details
Details for the file ifdo-1.4.0.tar.gz.
File metadata
- Download URL: ifdo-1.4.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
402d33c880fa74c7da1cc67a0594e23d99e7c87415ec294e3b689d76bdeca515
|
|
| MD5 |
3f4c02f3ee34a354c9efa6de8b24d628
|
|
| BLAKE2b-256 |
d3c8507080b5f313da261ea63d94cf841d1bce5d0aed2142fa43af87853bb2b9
|
File details
Details for the file ifdo-1.4.0-py3-none-any.whl.
File metadata
- Download URL: ifdo-1.4.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65eda0d3fb4897b9033f573445d126dc92a4a2d1f30f475a46ce095d6035d77b
|
|
| MD5 |
17a552a3f4deca232c452cb00180cc9f
|
|
| BLAKE2b-256 |
3881c28d598cceda4eff290e5db766b57371b58784cce97d9e697e82f66f4248
|