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
- COCO challenge and dataset
- Pascal-VOC challenge and dataset
- Ultralytics YOLO-detect and YOLO-segment
hiddendocs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
484b3d11147475f97997c9af889dd83376c96ce592f58fa82764b693cdb338bb
|
|
| MD5 |
9f15811a9522c8883b587ef57458c3eb
|
|
| BLAKE2b-256 |
045dcb0d582b96b24d7c367930f994ca70671f388d4747c8c18f36544851324e
|
Provenance
The following attestation bundles were made for annotstein-0.2.0.post0.tar.gz:
Publisher:
publish-pypi.yaml on CarMiranda/annotstein
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
annotstein-0.2.0.post0.tar.gz -
Subject digest:
484b3d11147475f97997c9af889dd83376c96ce592f58fa82764b693cdb338bb - Sigstore transparency entry: 1274539543
- Sigstore integration time:
-
Permalink:
CarMiranda/annotstein@e2288d492c496aa0cbcc6caee5f01858f7278928 -
Branch / Tag:
refs/tags/0.2.0.post0 - Owner: https://github.com/CarMiranda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@e2288d492c496aa0cbcc6caee5f01858f7278928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file annotstein-0.2.0.post0-py3-none-any.whl.
File metadata
- Download URL: annotstein-0.2.0.post0-py3-none-any.whl
- Upload date:
- Size: 41.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1ff4a9fc807d5a0b40ef220c5f13b0e2643a6692809700c3f7432907acda6c0
|
|
| MD5 |
7e214bcc058249710cbf9740b6fd26fd
|
|
| BLAKE2b-256 |
5a926002da1c74019882dbde648bcfb068570850341f2a4bbe9b802b97204e86
|
Provenance
The following attestation bundles were made for annotstein-0.2.0.post0-py3-none-any.whl:
Publisher:
publish-pypi.yaml on CarMiranda/annotstein
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
annotstein-0.2.0.post0-py3-none-any.whl -
Subject digest:
c1ff4a9fc807d5a0b40ef220c5f13b0e2643a6692809700c3f7432907acda6c0 - Sigstore transparency entry: 1274539565
- Sigstore integration time:
-
Permalink:
CarMiranda/annotstein@e2288d492c496aa0cbcc6caee5f01858f7278928 -
Branch / Tag:
refs/tags/0.2.0.post0 - Owner: https://github.com/CarMiranda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@e2288d492c496aa0cbcc6caee5f01858f7278928 -
Trigger Event:
push
-
Statement type: