GithubHelp home page GithubHelp logo

smirkey / powerboxes Goto Github PK

View Code? Open in Web Editor NEW
28.0 1.0 2.0 1.23 MB

utility functions to manipulate and compute metrics on boxes

Home Page: https://smirkey.github.io/powerboxes/

License: MIT License

Rust 73.32% Python 26.68%
giou iou pyo3 python rust nms rotated-bounding-boxes diou

powerboxes's Introduction

CI Coverage Crates.io pypi versions

PowerBoxes

Powerboxes is a package containing utility functions for transforming bounding boxes and computing metrics. It is implemented in both Python and Rust. It shows a significant speedup over the equivalent numpy implementations in Python, or other libraries such as shapely or torchvision.

Checkout out the documentation !

๐Ÿฆ€ Rust documentation

๐Ÿ Python documentation

Installation

Python

pip install powerboxes

Rust

cargo add powerboxesrs

Python Usage

import powerboxes as pb
import numpy as np

# Create a bounding box
box = np.array([[0, 0, 1, 1]])

# Compute the area of the box
area = pb.box_areas(box)

# Compute the intersection of the box with itself
intersection = pb.iou_distance(box, box)

Use it in Rust

Here is a simple example:

use ndarray::array;
use powerboxesrs::boxes::box_areas;
let boxes = array![[1., 2., 3., 4.], [0., 0., 10., 10.]];
let areas = box_areas(&boxes);
assert_eq!(areas, array![4., 100.]);

Benchmarks

Some benchmarks of powerboxes against various open source alternatives, not all functions are benchmarked. Notice that we use log scales, all differences are major ! Benchmarks can be found in this google colab notebook

Box area

Here it's torchvision vs powerboxes vs numpy

Box area

Box convert

Here it's torchvision vs powerboxes

Box convert

Box IoU matrix

Torchvision vs numpy vs powerboxes

Box IoU

NMS

Torchvision vs powerboxes vs lsnms vs numpy

Large image (10000x10000 pixels)

Box NMS

Normal image (1000x1000 pixels)

Box NMS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.