Skip to main content

Annotation tools for computer vision.

Project description

Annotstein

annotstein provides lightweight and modular endpoints to common annotation operations, like rebasing file paths, converting coordinates from absolute to relative, etc.

NOTE: this library is unstable and under active development.

Library

Currently, the lib allows to manipulate COCO, PASCAL-VOC and ultralytics YOLO datasets through object-oriented and functional APIs. The COCO format is used as the exchange format to manipulate annotations, i.e. most operations on VOC and YOLO datasets transform the dataset to COCO as an intermediate, in-memory step.

These APIs allow to perform multiple operations on a dataset, like converting from one format to another, merge multiple datasets, extract crops based on bboxes, etc.

Classes under annotstein.{coco,voc,yolo}.schemas provide validation using pydantic models. These classes can be sub-classed to add extra-validation (e.g. specific categories are expected) and still work with the functional APIs, see examples/subclassing.py.

CLI

Convert

The convert command allows to convert between annotation formats.

# Convert VOC to COCO
convert -s voc -t coco -i voc/ -o coco.json

# Convert COCO to VOC
convert -s coco -t voc -i coco.json -o voc/

# Convert YOLO-segment (https://docs.ultralytics.com/datasets/segment/) to COCO
convert -s yolo-segment-task -t coco -i dataset.yaml -o coco.json

# Convert COCO to YOLO-segment
convert -s coco -t yolo-segment-task -i coco.json -t dataset.yaml

# Convert YOLO-detect (https://docs.ultralytics.com/datasets/detect/) to COCO
convert -s yolo-detect-task -t coco -i dataset.yaml -o coco.json

# Convert COCO to YOLO-detect
convert -s coco -t yolo-detect-task -i coco.json -o dataset.yaml

Since VOC and YOLO require annotations to exist as individual text files along with the images they describe, the flags --symlink|--copy|--move in the convert command allow to select how images will be processed.

COCO operations

The following operations can be performed on COCO datasets, using the coco subcommand:

  • Transform coordinates from absolute to relative, and vice verse (coordinates)
  • Merge multiple COCO datasets into a single one (merge)
  • Extract image patches into a category_id-based file tree (crop)
  • Rebase a given dataset images' file_names (rebase)
  • Compute some stats (e.g. category instance count) (stats)
  • Split a COCO dataset into train and test datasets (split)

Uses

The aim of this project is to allow simple manipulation of CV datasets through the API or the CLI. Moreover, it can also be used in CI/CD or applications steps to validate that annotations are coherent (e.g. validate COCO dataset's bboxes and segmentations, validate annotations refer to existing images, etc).

Roadmap

  • Integration with CVOps tooling (e.g. CVAT, FiftyOne)
  • Add missing operations for YOLO datasets
  • Add more utility functions for COCO datasets

References

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

annotstein-0.2.0.tar.gz (145.4 kB view details)

Uploaded Source

Built Distribution

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

annotstein-0.2.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file annotstein-0.2.0.tar.gz.

File metadata

  • Download URL: annotstein-0.2.0.tar.gz
  • Upload date:
  • Size: 145.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for annotstein-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ab2526312428fd5c811c5c9cb9d258578ed38852f56ead63f3403c69a23ccda1
MD5 2feade6a7efbde894e99a2748421894f
BLAKE2b-256 b41ecacfd0f09ef680222d2f17f7a3ad46768b7ae9fc07edaef915b13f34f72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for annotstein-0.2.0.tar.gz:

Publisher: publish-pypi.yaml on CarMiranda/annotstein

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file annotstein-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: annotstein-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for annotstein-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f72a117d6b2c9fb139c94c8a6c0ac82519d6ab911a2bbf0b1862a024f1f1b636
MD5 7664f88516b03efe9511132ff0d07c7b
BLAKE2b-256 fef207c53ca93a1e449ff5e6514f44ce7a2b039718fae52e954e84ed37a603f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for annotstein-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yaml on CarMiranda/annotstein

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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