anyboxes


Nameanyboxes JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryLightweight package for managing bounding boxes that works seamlessly with most computing frameworks.
upload_time2023-05-30 11:23:29
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT 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.
keywords computer vision machine learning bounding boxes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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)                                                                                     |
| 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/) |
| Package | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anyboxes.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/anyboxes/) [![PyPI - Version](https://img.shields.io/pypi/v/anyboxes.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/anyboxes/)                                                                                                                                                                                                                                                                                                                                                                         |

</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

### Example

```python
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`      |

<br />

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

<div align="center">

|       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` |

</div>

## ⛏️ 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 ".[all,dev]"
```

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

```shell
pre-commit install
```

## 🧭 Roadmap

- [ ] Implementations
  - [x] PyTorch
  - [ ] Numpy
  - [ ] JAX
  - [ ] Tensorflow
- [ ] Dispatch implementation using a metaclass

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "anyboxes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "computer vision,machine learning,bounding boxes",
    "author": "",
    "author_email": "Vincent Duchauffour <vincent.duchauffour@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/12/bb/f4bb52156bd818b76721576421aa9cb9fdc0f507b6f80c659d739ca9d1c5/anyboxes-0.1.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n![Logo](.github/assets/logo.png)\n\n_Lightweight package for managing bounding boxes that works seamlessly with most computing frameworks._\n\n|         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| 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)                                                                                     |\n| 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/) |\n| Package | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anyboxes.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/anyboxes/) [![PyPI - Version](https://img.shields.io/pypi/v/anyboxes.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/anyboxes/)                                                                                                                                                                                                                                                                                                                                                                         |\n\n</div>\n\n______________________________________________________________________\n\nThis 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.\n\n## \ufe0f\ufe0f\u2699\ufe0f Installation\n\nInstall the package from the PyPI registry. You may need to specify the framework that you want to managed. Numpy is enabled by default.\n\n```shell\npip install anyboxes\n# or\npip install \"anyboxes[torch]\" # or jax, tensorflow\n```\n\nInstall the package from the latest commit of the repository.\n\n```shell\npip install git+https://github.com/VDuchauffour/anyboxes\n```\n\n## \u26a1 Usage\n\n### Example\n\n```python\nfrom anyboxes import TorchBoxes\nimport torch\n\ndetections = torch.randint(0, 1000, (10, 4))\n\nboxes = TorchBoxes.from_bottom_left_corner(detections)\nboxes = boxes.to_center()\nboxes.as_tensor\n```\n\nIn a nutshell, using a `Boxes` involve 3 stages:\n\n| **#** |                              Stage                               |                               Methods that can be used                               |\n| :---: | :--------------------------------------------------------------: | :----------------------------------------------------------------------------------: |\n|   1   | Instantiate a `Boxes` object with one of the `from` classmethods | `from_top_left_corner`, `from_bottom_left_corner`, `from_two_corners`, `from_center` |\n|   2   |        Apply a transformation with a `to` inplace methods        |     `to_top_left_corner`, `to_bottom_left_corner`, `to_two_corners`, `to_center`     |\n|   3   |    Retrieve the modified data with one of the `as` properties    |      `as_dict`, `as_tuple`, `as_numpy`, `as_array`, `as_tf_tensor`, `as_tensor`      |\n\n<br />\n\nTo be more specific, when a `Boxes` is instantiated, the following attribute are created:\n\n<div align=\"center\">\n\n|       Attribute       |                                Purpose                                 |\n| :-------------------: | :--------------------------------------------------------------------: |\n| `corners_coordinates` |    A tuple of coordinates from top to bottom and from left to right    |\n| `center_coordinates`  |               A object that contains center coordinates                |\n|        `size`         |           A object that contains width and height attributes           |\n|       `origin`        | Origin of the coordinates, can be equal to `top-left` or `bottom-left` |\n\n</div>\n\n## \u26cf\ufe0f Development\n\nClone the project\n\n```shell\ngit clone https://github.com/VDuchauffour/anyboxes\n```\n\nIn order to install all development dependencies, run the following command:\n\n```shell\npip install -e \".[all,dev]\"\n```\n\nTo ensure that you follow the development workflow, please setup the pre-commit hooks:\n\n```shell\npre-commit install\n```\n\n## \ud83e\udded Roadmap\n\n- [ ] Implementations\n  - [x] PyTorch\n  - [ ] Numpy\n  - [ ] JAX\n  - [ ] Tensorflow\n- [ ] Dispatch implementation using a metaclass\n",
    "bugtrack_url": null,
    "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. ",
    "summary": "Lightweight package for managing bounding boxes that works seamlessly with most computing frameworks.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/VDuchauffour/anyboxes",
        "Source": "https://github.com/VDuchauffour/anyboxes",
        "Tracker": "https://github.com/VDuchauffour/anyboxes/issues"
    },
    "split_keywords": [
        "computer vision",
        "machine learning",
        "bounding boxes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d870de411de8b3708049f9035aa6e5c9b9849f7abf67548c4003637cdcce2f59",
                "md5": "8db07e9fc8a7b96182a672cf763a68d5",
                "sha256": "3b406ec86aa74036e004dc634b5fd7646031d1af5063b068c617c9271fa36013"
            },
            "downloads": -1,
            "filename": "anyboxes-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8db07e9fc8a7b96182a672cf763a68d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11568,
            "upload_time": "2023-05-30T11:23:27",
            "upload_time_iso_8601": "2023-05-30T11:23:27.559999Z",
            "url": "https://files.pythonhosted.org/packages/d8/70/de411de8b3708049f9035aa6e5c9b9849f7abf67548c4003637cdcce2f59/anyboxes-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12bbf4bb52156bd818b76721576421aa9cb9fdc0f507b6f80c659d739ca9d1c5",
                "md5": "f866060d9c7af08e1747fdb6ccd8c836",
                "sha256": "849ba3011865a118d53cac8879313dfd434fd38dcfdef6c0a07fc163e2cf1c88"
            },
            "downloads": -1,
            "filename": "anyboxes-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f866060d9c7af08e1747fdb6ccd8c836",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 43539,
            "upload_time": "2023-05-30T11:23:29",
            "upload_time_iso_8601": "2023-05-30T11:23:29.499592Z",
            "url": "https://files.pythonhosted.org/packages/12/bb/f4bb52156bd818b76721576421aa9cb9fdc0f507b6f80c659d739ca9d1c5/anyboxes-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-30 11:23:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VDuchauffour",
    "github_project": "anyboxes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "anyboxes"
}
        
Elapsed time: 0.07221s