Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anyboxes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anyboxes

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

  • 0.1.1
  • Source
  • PyPI
  • Socket score

Maintainers
1

Logo

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

CI/CDCI Pipeline Release interrogate codecov
Metalinting - Ruff code style - Black imports - isort pre-commit License
PackagePyPI - 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:

#StageMethods that can be used
1Instantiate a Boxes object with one of the from classmethodsfrom_top_left_corner, from_bottom_left_corner, from_two_corners, from_center
2Apply a transformation with a to inplace methodsto_top_left_corner, to_bottom_left_corner, to_two_corners, to_center
3Retrieve the modified data with one of the as propertiesas_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:

AttributePurpose
corners_coordinatesA tuple of coordinates from top to bottom and from left to right
center_coordinatesA object that contains center coordinates
sizeA object that contains width and height attributes
originOrigin 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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc