SkillAgentSearch skills...

Powerboxes

utility functions to manipulate and compute metrics on boxes

Install / Use

/learn @Smirkey/Powerboxes
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

CI Coverage Crates.io pypi versions

<div align="center"> PowerBoxes </div>

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 bounding boxes in xyxy format
boxes = np.array([[0, 0, 1, 1], [2, 2, 3, 3]], dtype=np.float64)

# Compute areas
areas = pb.boxes_areas(boxes)

# Compute pairwise IoU distance matrix
iou = pb.iou_distance(boxes, boxes)

# Non-maximum suppression
scores = np.array([0.9, 0.8])
keep = pb.nms(boxes, scores, iou_threshold=0.5, score_threshold=0.3)

# Draw boxes on an image (CHW format, uint8)
image = np.zeros((3, 100, 100), dtype=np.uint8)
draw_boxes = np.array([[10.0, 10.0, 50.0, 50.0]])
result = pb.draw_boxes(image, draw_boxes, filled=True, opacity=0.35)

# Draw rotated boxes in cxcywha format
rotated_boxes = np.array([[50.0, 50.0, 30.0, 20.0, 30.0]])
rotated = pb.draw_rotated_boxes(image, rotated_boxes)

Use it in Rust

All core functions use a slice-based API. ndarray wrappers are available behind the ndarray feature (enabled by default).

use powerboxesrs::iou::iou_distance_slice;

let boxes1 = vec![0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0];
let boxes2 = vec![0.5, 0.5, 1.5, 1.5, 2.5, 2.5, 3.5, 3.5];
let iou = iou_distance_slice(&boxes1, &boxes2, 2, 2);

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

View on GitHub
GitHub Stars32
CategoryDevelopment
Updated18d ago
Forks3

Languages

Rust

Security Score

95/100

Audited on Mar 13, 2026

No findings