Skip to main content

cv-benchkit

CI PyPI Python License Good First Issues

Contributing: Looking to contribute? Check out our good first issues! To claim an issue, post a short comment on the issue before or when opening your PR, and include Closes #<issue-number> in your PR description. First-time contributors (0 prior merged PRs) are prioritized for good first issue tickets to give newcomers a fair start.

Unified computer vision annotation converter and model benchmarking toolkit for PyTorch and NumPy.


Quickstart & Installation

Install cv-benchkit via pip:

pip install cv-benchkit

Or using uv:

uv add cv-benchkit

Or run directly without installation via uvx:

uvx --from cv-benchkit cv-benchkit --help

Features

  • Format Converters: Seamless, vectorized conversions between xyxy, xywh (COCO), cxcywh, and normalized (YOLO) bounding-box representations.
  • Dataset Translators: Two-way translations between COCO JSON, YOLO txt, and Pascal VOC XML.
  • Vectorized Evaluation Metrics: Fast NumPy implementations of pairwise IoU, GIoU, and multiclass confusion matrix calculations with background handling.
  • CLI Utility: Command-line interface for fast dataset conversion and validation.
  • Strictly Typed & Tested: 100% typed with PEP 561 marker, passing mypy --strict, with 95%+ unit test coverage.

Bounding-box coordinate formats

All converter functions use four-value boxes. Choose the format that matches the dataset or model you are integrating with:

Format Coordinate order Units Common source
xyxy x_min, y_min, x_max, y_max Absolute pixels Internal canonical format
xywh x_min, y_min, width, height Absolute pixels COCO annotations
cxcywh center_x, center_y, width, height Absolute pixels Center-based model APIs
normalized center_x, center_y, width, height Relative values in [0, 1] YOLO label files

Use xyxy_to_normalized() and normalized_to_xyxy() when converting between absolute pixel coordinates and normalized YOLO coordinates; pass the image width and height so the conversion can scale each axis correctly.


Python API Usage

import numpy as np
from cv_benchkit import compute_iou, xyxy_to_normalized, validate_coco_file

# Compute pairwise IoU
boxes_a = np.array([[0, 0, 100, 100], [50, 50, 150, 150]])
boxes_b = np.array([[20, 20, 120, 120]])
iou_matrix = compute_iou(boxes_a, boxes_b)
print(iou_matrix)

# Validate and parse COCO annotations
dataset = validate_coco_file("path/to/annotations.json")

CLI Usage

# Validate COCO dataset
cv-benchkit validate annotations.json

# Summarize a COCO dataset (add --json for machine-readable output)
cv-benchkit stats annotations.json

# Convert COCO to YOLO format
cv-benchkit convert --from coco --to yolo --input annotations.json --output ./yolo_labels

# Convert YOLO to COCO format
cv-benchkit convert --from yolo --to coco --input ./yolo_labels --output ./coco_out --image-width 640 --image-height 480 --categories person car bicycle

Contributing & Good First Issues

We welcome first-time open-source contributors! 🚀

We have curated and actively maintain modular, beginner-friendly issues with clear acceptance criteria and verification commands:

👉 Browse All Open Good First Issues (15+ Available)

How to Claim an Issue:

  1. Find an issue labeled good first issue that is not yet assigned.
  2. Comment on the issue: I'd like to work on this! Plan: [one sentence approach].
  3. Read CONTRIBUTING.md and CODE_OF_CONDUCT.md for local setup, community standards, and pull request guidelines.
  4. Also see our Good First Issues Catalog for a comprehensive catalog of upcoming tasks across documentation, converters, and metrics.

Local Development Setup:

git clone https://github.com/udayraj1238/cv-benchkit.git
cd cv-benchkit
uv sync --extra dev
uv run pytest
uv run ruff check .
uv run mypy src/

Security

See SECURITY.md for vulnerability reporting and responsible disclosure.


License

Apache-2.0. See LICENSE for details.

Metadata

Release files for cv-benchkit 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cv-benchkit 0.2.3
File Size Uploaded Provenance Actions
cv_benchkit-0.2.3.tar.gz 153.0 kB Without provenance Details for cv_benchkit-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cv-benchkit 0.2.3
File Interpreter ABI Platform Actions
cv_benchkit-0.2.3-py3-none-any.whl Python 3 none any Details for cv_benchkit-0.2.3-py3-none-any.whl

Total release size: 176.2 kB

Release files / cv_benchkit-0.2.3.tar.gz

Download URL cv_benchkit-0.2.3.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f58eaa04dec1aa973f372205aeb9fe059759c2c4aed7913a87b3c1c201dcc996
BLAKE2b-256 checksum
How to use checksums
c864b4f517189172005722d64d95acc8f3472fa0d006faa67c847892a719af87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / cv_benchkit-0.2.3-py3-none-any.whl

Download URL cv_benchkit-0.2.3-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34fea309343917dc20ef9e1499f3a4fa144ff022575a0a9593eade7c69f4cf38
BLAKE2b-256 checksum
How to use checksums
ab7c15439dbd895b96bd6b64c5b354bd5adaa22c7458e21ea5d05b4475c3ec49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for cv-benchkit 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page