Skip to main content

Logo

Lightweight package for managing bounding boxes that works seamlessly with most computing frameworks.

CI/CD CI Pipeline Release interrogate codecov
Meta linting - Ruff code style - Black imports - isort pre-commit License
Package PyPI - Python Version PyPI - Version

This package provides a simple API for managing bounding boxes. It allows you to perform transformation to your Numpy's ndarray, JAX's Array, PyTorch Tensor or Tensorflow Tensor from one orientation to another.

️️⚙️ Installation

Install the package from the PyPI registry. You may need to specify the framework that you want to managed. Numpy is enabled by default.

pip install anyboxes
# or
pip install "anyboxes[torch]" # or jax, tensorflow

Install the package from the latest commit of the repository.

pip install git+https://github.com/VDuchauffour/anyboxes

⚡ Usage

Example

from anyboxes import TorchBoxes
import torch

detections = torch.randint(0, 1000, (10, 4))

boxes = TorchBoxes.from_bottom_left_corner(detections)
boxes = boxes.to_center()
boxes.as_tensor

In a nutshell, using a Boxes involve 3 stages:

# Stage Methods that can be used
1 Instantiate a Boxes object with one of the from classmethods from_top_left_corner, from_bottom_left_corner, from_two_corners, from_center
2 Apply a transformation with a to inplace methods to_top_left_corner, to_bottom_left_corner, to_two_corners, to_center
3 Retrieve the modified data with one of the as properties as_dict, as_tuple, as_numpy, as_array, as_tf_tensor, as_tensor

To be more specific, when a Boxes is instantiated, the following attribute are created:

Attribute Purpose
corners_coordinates A tuple of coordinates from top to bottom and from left to right
center_coordinates A object that contains center coordinates
size A object that contains width and height attributes
origin Origin of the coordinates, can be equal to top-left or bottom-left

⛏️ Development

Clone the project

git clone https://github.com/VDuchauffour/anyboxes

In order to install all development dependencies, run the following command:

pip install -e ".[all,dev]"

To ensure that you follow the development workflow, please setup the pre-commit hooks:

pre-commit install

🧭 Roadmap

  • Implementations
    • PyTorch
    • Numpy
    • JAX
    • Tensorflow
  • Dispatch implementation using a metaclass

Metadata

Release files for anyboxes 0.1.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 anyboxes 0.1.1
File Size Uploaded Provenance Actions
anyboxes-0.1.1.tar.gz 43.5 kB Without provenance Details for anyboxes-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anyboxes 0.1.1
File Interpreter ABI Platform Actions
anyboxes-0.1.1-py3-none-any.whl Python 3 none any Details for anyboxes-0.1.1-py3-none-any.whl

Total release size: 55.1 kB

Release files / anyboxes-0.1.1.tar.gz

Download URL anyboxes-0.1.1.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
849ba3011865a118d53cac8879313dfd434fd38dcfdef6c0a07fc163e2cf1c88
BLAKE2b-256 checksum
How to use checksums
12bbf4bb52156bd818b76721576421aa9cb9fdc0f507b6f80c659d739ca9d1c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / anyboxes-0.1.1-py3-none-any.whl

Download URL anyboxes-0.1.1-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b406ec86aa74036e004dc634b5fd7646031d1af5063b068c617c9271fa36013
BLAKE2b-256 checksum
How to use checksums
d870de411de8b3708049f9035aa6e5c9b9849f7abf67548c4003637cdcce2f59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Security for anyboxes 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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