Skip to main content

iFDO utilities

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ifdo-1.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4b8f3ac31adad93a4712a373adb103534e851fc5542f9dc2c3eed09c4be22ba2
MD5 9b58b3d22097c999d5ea77ffd2906c71
BLAKE2b-256 c06a2278e28083cd00694f72e3f94d7a13ea43fb50af51e50f8da6c921c4dca8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ifdo-1.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 700d788ad1195c66b3202822a3f2015224afdfb68ca1e867a58e90975f49ce39
MD5 c85fb2daf5e31e3d66464cff47ccf4e5
BLAKE2b-256 2fa8a1bb4ede382f4f7205368356f6735731e88b36d7c492a5ffdd1a5574253a

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