powerboxesrs

Crates.iopowerboxesrs
lib.rspowerboxesrs
version0.2.3
sourcesrc
created_at2023-11-13 20:59:20.700578
updated_at2024-05-27 20:20:35.697722
descriptionUtility functions to manipulate and compute metrics on boxes
homepagehttps://github.com/Smirkey/powerboxes
repositoryhttps://github.com/Smirkey/powerboxes
max_upload_size
id1034033
size83,746
Guillaume Bertrand (Smirkey)

documentation

README

CI Coverage Crates.io

PowerBoxesrs

Powerboxes is a package containing utility functions for transforming bounding boxes and computing metrics.

Installation

cargo add powerboxesrs

Functions available

Box Transformations and utilities

  • box_areas: Compute the area of list of boxes
  • box_convert: Convert a box from one format to another. Supported formats are xyxy, xywh, cxcywh.
  • remove_small_boxes: Remove boxes with area smaller than a threshold
  • mask_to_boxes: Convert a mask to a list of boxes

Box Metrics

  • iou_distance: Compute the intersection over union matrix of two sets of boxes
  • parallel_iou_distance: Compute the intersection over union matrix of two sets of boxes in parallel
  • giou_distance: Compute the generalized intersection over union matrix of two sets of boxes
  • parallel_giou_distance: Compute the generalized intersection over union matrix of two sets of boxes in parallel
  • tiou_distance: Compute the tracking intersection over union matrix of two sets of boxes

Rotated Box Metrics

  • rotated_iou_distance: Compute the intersection over union matrix of two sets of rotated boxes in cxcywha format
  • rotated_giou_distance: Compute the generalized intersection over union matrix of two sets of rotated boxes in cxcywha format

Box NMS

  • nms: Non-maximum suppression, returns the indices of the boxes to keep

  • rtree_nms: Non-maximum suppression, returns the indices of the boxes to keep, uses a r-tree internally to avoid quadratic complexity, useful when having many boxes.

Use it in Rust

See the documentation for more details. 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.]);
Commit count: 94

cargo fmt