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.1

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.1
File Size Uploaded Provenance Actions
cv_benchkit-0.2.1.tar.gz 144.1 kB Without provenance Details for cv_benchkit-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 164.4 kB

Release files / cv_benchkit-0.2.1.tar.gz

Download URL cv_benchkit-0.2.1.tar.gz
Size 144.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4b52e9f2095d6239f5d0d17430849ac1cd3a5afaf6dfc27270d152681de26716
BLAKE2b-256 checksum
How to use checksums
2b9b855a27bfb9b2821060448d3c190f9e6401ae664349dd1f9c894501f260f8
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.1-py3-none-any.whl

Download URL cv_benchkit-0.2.1-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c39165f8ef4a33d02c9f9e0333ab1a93dc8ca7d863c1f6915079d87946c552b
BLAKE2b-256 checksum
How to use checksums
7a92b0e6b34a60db8537c592da977a2edce82e9ed3104ffa774872a4e92b934b
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.1

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