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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ifdo-1.2.4-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ifdo-1.2.4.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

Hashes for ifdo-1.2.4.tar.gz
Algorithm Hash digest
SHA256 33314f43e4e624259f9a02648a68490fe598c13c03746a4678e8f68cc186c6b0
MD5 2b9386812793735d3353d5b83ec21d5b
BLAKE2b-256 c5009c8988e79a6404f72607a86e589a9b2016c718937f927243a69a573900a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ifdo-1.2.4-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

Hashes for ifdo-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 17e4a5400296300a108e54c7004cff4cf66f2197768fb01416862dedb7eea4a0
MD5 ce9c62df83d890a6c9a81d8746e338d8
BLAKE2b-256 4534c7bbe3ae9f1123625ca2fe87a5456e779cc27906ffd0a0c9e9c9293074dc

See more details on using hashes here.

Supported by

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