Skip to main content

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


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.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

ifdo-1.2.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file ifdo-1.2.1.tar.gz.

File metadata

  • Download URL: ifdo-1.2.1.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-48-generic

File hashes

Hashes for ifdo-1.2.1.tar.gz
Algorithm Hash digest
SHA256 ecec17555b2d0b525923c6af0bbd026b8140a44050b8e3d694586ab2a6ea308c
MD5 d626bd30e547f1e45930c64b08f8b4fe
BLAKE2b-256 6515d0ae8ad85b458c0ce9e35300929c482aa4ae45f66d9a44b33f00ed0fd33d

See more details on using hashes here.

File details

Details for the file ifdo-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: ifdo-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.12 Linux/6.8.0-48-generic

File hashes

Hashes for ifdo-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0363f442d8cfa6af968a93f2e71676e1a030fdad62c2e0bf9ed444b0f11f4f5a
MD5 f37ee65b08f6a91b0be2c85aa72b40a6
BLAKE2b-256 c52600c08ad776aff2b32a1bec068a37b1b503acc5c68c8f4160905dcbd4ff8c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page