9 releases
0.2.3 | May 27, 2024 |
---|---|
0.2.2 | Feb 24, 2024 |
0.2.1 | Jan 15, 2024 |
0.2.0 | Dec 28, 2023 |
0.1.3 | Nov 22, 2023 |
#921 in Algorithms
578 downloads per month
82KB
1.5K
SLoC
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 boxesbox_convert
: Convert a box from one format to another. Supported formats arexyxy
,xywh
,cxcywh
.remove_small_boxes
: Remove boxes with area smaller than a thresholdmask_to_boxes
: Convert a mask to a list of boxes
Box Metrics
iou_distance
: Compute the intersection over union matrix of two sets of boxesparallel_iou_distance
: Compute the intersection over union matrix of two sets of boxes in parallelgiou_distance
: Compute the generalized intersection over union matrix of two sets of boxesparallel_giou_distance
: Compute the generalized intersection over union matrix of two sets of boxes in paralleltiou_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 formatrotated_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 keeprtree_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.]);
Dependencies
~4MB
~77K SLoC