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.post0.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.post0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: annotstein-0.2.0.post0.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.post0.tar.gz
Algorithm Hash digest
SHA256 484b3d11147475f97997c9af889dd83376c96ce592f58fa82764b693cdb338bb
MD5 9f15811a9522c8883b587ef57458c3eb
BLAKE2b-256 045dcb0d582b96b24d7c367930f994ca70671f388d4747c8c18f36544851324e

See more details on using hashes here.

Provenance

The following attestation bundles were made for annotstein-0.2.0.post0.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.post0-py3-none-any.whl.

File metadata

File hashes

Hashes for annotstein-0.2.0.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1ff4a9fc807d5a0b40ef220c5f13b0e2643a6692809700c3f7432907acda6c0
MD5 7e214bcc058249710cbf9740b6fd26fd
BLAKE2b-256 5a926002da1c74019882dbde648bcfb068570850341f2a4bbe9b802b97204e86

See more details on using hashes here.

Provenance

The following attestation bundles were made for annotstein-0.2.0.post0-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