Metadata-Version: 2.1
Name: anyboxes
Version: 0.1.0
Summary: Lightweight package for managing bounding boxes that works seamlessly with most computing frameworks.
Author-email: Vincent Duchauffour <vincent.duchauffour@proton.me>
License: MIT License
        
        Copyright (c) 2023 Vincent Duchauffour
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/VDuchauffour/anyboxes
Project-URL: Source, https://github.com/VDuchauffour/anyboxes
Project-URL: Tracker, https://github.com/VDuchauffour/anyboxes/issues
Keywords: computer vision,machine learning,bounding boxes
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Framework :: Pytest
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (>=1.21)
Provides-Extra: all
Requires-Dist: anyboxes[torch] ; extra == 'all'
Requires-Dist: anyboxes[jax] ; extra == 'all'
Requires-Dist: anyboxes[tensorflow] ; extra == 'all'
Provides-Extra: dev
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: ruff ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: pyright ; extra == 'dev'
Requires-Dist: docformatter ; extra == 'dev'
Requires-Dist: interrogate ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Provides-Extra: jax
Requires-Dist: jax ; extra == 'jax'
Provides-Extra: tensorflow
Requires-Dist: tensorflow ; extra == 'tensorflow'
Provides-Extra: torch
Requires-Dist: torch ; extra == 'torch'

<div align="center">

![Logo](.github/assets/logo.png)

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

|         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CI/CD   | [![CI Pipeline](https://github.com/VDuchauffour/anyboxes/actions/workflows/ci.yml/badge.svg)](https://github.com/VDuchauffour/anyboxes/actions/workflows/ci.yml) [![Release](https://github.com/VDuchauffour/anyboxes/actions/workflows/release.yml/badge.svg)](https://github.com/VDuchauffour/anyboxes/actions/workflows/release.yml) [![interrogate](.github/assets/badges/interrogate_badge.svg)](https://interrogate.readthedocs.io/en/latest/) [![codecov](https://codecov.io/gh/VDuchauffour/anyboxes/branch/main/graph/badge.svg)](https://codecov.io/gh/VDuchauffour/anyboxes)                                                                                     |
| Package | [![PyPI - Version](https://img.shields.io/pypi/v/anyboxes.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/anyboxes/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anyboxes.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/anyboxes/)                                                                                                                                                                                                                                                                                                                                                                         |
| Meta    | [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff) [![code style - Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![imports - isort](https://img.shields.io/badge/imports-isort-ef8336.svg)](https://github.com/pycqa/isort) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![License](https://img.shields.io/github/license/VDuchauffour/anyboxes?color=blueviolet)](https://spdx.org/licenses/) |

</div>

______________________________________________________________________

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.

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

Install the package from the latest commit of the repository.

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

## ⚡ Usage

In a nutshell, the common workflow involve 3 stages:

- Instantiate a `Boxes` object with one of the following classmethod: `from_top_left_corner`, `from_bottom_left_corner`, `from_two_corners`, `from_center`
- Apply a transformation with a `to` inplace method: `to_top_left_corner`, `to_bottom_left_corner`, `to_two_corners`, `to_center`
- Retrieve the modified data with one of the property: `as_dict`, `as_tuple`, `as_array`, `as_numpy`, `as_tensor`

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

- `corners_coordinates` attribute (a tuple from top to bottom and from left to right).
- `center_coordinates` attribute
- `shape` attribute (width and height)
- `origin` attribute (which can be equal to `top-left` or `bottom-left`, modify this attribute will rearrange the coordinates)

## ⛏️ Development

Clone the project

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

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

```shell
pip install -e ".[dev]"
```

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

```shell
pre-commit install
```
