ifdo


Nameifdo JSON
Version 1.2.2 PyPI version JSON
download
home_pageNone
SummaryPython iFDO implementation
upload_time2024-12-02 05:50:43
maintainerNone
docs_urlNone
authorKevin Barnard
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ifdo-py

ifdo-py is a Python library for the [iFDO](https://marine-imaging.com/fair/ifdos/iFDO-overview/) file format.

## Install

```bash
pip install ifdo
```

## Usage

### Read/write iFDO files
```python
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
```python
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())
```

```python
{
  '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'
}
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ifdo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Kevin Barnard",
    "author_email": "kbarnard@mbari.org",
    "download_url": "https://files.pythonhosted.org/packages/47/59/d5463e63c17a18898ecd25524d8fbe71603052b314b00e845e02949fb3b8/ifdo-1.2.2.tar.gz",
    "platform": null,
    "description": "# ifdo-py\n\nifdo-py is a Python library for the [iFDO](https://marine-imaging.com/fair/ifdos/iFDO-overview/) file format.\n\n## Install\n\n```bash\npip install ifdo\n```\n\n## Usage\n\n### Read/write iFDO files\n```python\nfrom ifdo import iFDO\n\n# Read from YAML file\nifdo_object = iFDO.load(\"path/to/ifdo.yaml\")\n\n# Write to YAML\nifdo_object.save(\"path/to/ifdo.yaml\")\n```\n\n### Create image annotations\n```python\nfrom datetime import datetime\nfrom ifdo.models import ImageAnnotation, AnnotationCoordinate, AnnotationLabel\n\n# Create a bounding box\ncoordinates = [\n    AnnotationCoordinate(x=0, y=0),\n    AnnotationCoordinate(x=1, y=0),\n    AnnotationCoordinate(x=1, y=1),\n    AnnotationCoordinate(x=0, y=1),\n]\n\n# Create a label for it\nlabel = AnnotationLabel(id=\"fish\", annotator=\"kevin\", created_at=datetime.now(), confidence=0.9)\n\n# Pack it into an annotation\nannotation = ImageAnnotation(coordinates=coordinates, labels=[label], shape='rectangle')\n\n# Print it as a dictionary\nprint(annotation.to_dict())\n```\n\n```python\n{\n  'coordinates': [\n    {'x': 0, 'y': 0}, \n    {'x': 1, 'y': 0}, \n    {'x': 1, 'y': 1}, \n    {'x': 0, 'y': 1}\n  ], \n  'labels': [\n    {\n      'id': 'fish', \n      'annotator': 'kevin', \n      'created-at': datetime.datetime(2023, 2, 28, 16, 39, 46, 451290), \n      'confidence': 0.9\n    }\n  ], \n  'shape': 'rectangle'\n}\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python iFDO implementation",
    "version": "1.2.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36c3044f0912f763392e6fcbe3dfcbd797ac2a7aae2b67c4aaae5687e4f85d6a",
                "md5": "93f240665ee9bb1b58bd498941e86406",
                "sha256": "840470de8c5553bba90f20b4784f96f1059e4d5f791d5a6e03500e18405fb596"
            },
            "downloads": -1,
            "filename": "ifdo-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93f240665ee9bb1b58bd498941e86406",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 13648,
            "upload_time": "2024-12-02T05:50:41",
            "upload_time_iso_8601": "2024-12-02T05:50:41.187138Z",
            "url": "https://files.pythonhosted.org/packages/36/c3/044f0912f763392e6fcbe3dfcbd797ac2a7aae2b67c4aaae5687e4f85d6a/ifdo-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4759d5463e63c17a18898ecd25524d8fbe71603052b314b00e845e02949fb3b8",
                "md5": "a91522e41f4275d8dcada67addd128cd",
                "sha256": "c9ce64d8a12b2c7a0f1aefc2b9956b78a9d47d09ccd117f550f9b7db49a6ddee"
            },
            "downloads": -1,
            "filename": "ifdo-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a91522e41f4275d8dcada67addd128cd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 13495,
            "upload_time": "2024-12-02T05:50:43",
            "upload_time_iso_8601": "2024-12-02T05:50:43.116849Z",
            "url": "https://files.pythonhosted.org/packages/47/59/d5463e63c17a18898ecd25524d8fbe71603052b314b00e845e02949fb3b8/ifdo-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 05:50:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ifdo"
}
        
Elapsed time: 0.41581s