powerboxesrs/
lib.rs

1#![crate_name = "powerboxesrs"]
2
3//! Powerboxes is a package containing utility functions for transforming bounding boxes and computing metrics from them.
4//! # Powerboxesrs
5//!
6//! `powerboxesrs` is a Rust package containing utility functions for transforming bounding boxes and computing metrics from them.
7//!
8//! ## Installation
9//!
10//! Add the following to your `Cargo.toml` file:
11//!
12//! ```toml
13//! [dependencies]
14//! powerboxesrs = "0.2.3"
15//! ```
16//!
17//! ## Usage
18//!
19//! ```rust
20//! use ndarray::array;
21//! use powerboxesrs::iou::iou_distance;
22//!
23//! let boxes1 = array![[0.0, 0.0, 1.0, 1.0], [2.0, 2.0, 3.0, 3.0]];
24//! let boxes2 = array![[0.5, 0.5, 1.5, 1.5], [2.5, 2.5, 3.5, 3.5]];
25//! let iou = iou_distance(&boxes1, &boxes2);
26//! assert_eq!(iou, array![[0.8571428571428572, 1.],[1., 0.8571428571428572]]);
27//! ```
28//!
29//! ### Functions available
30//! warning: **all functions expect the boxes to be in the format `xyxy` (top left and bottom right corners)** (not box conversion functions, of course)
31//!
32//! #### Box Transformations and utilities
33//! - `box_areas`: Compute the area of list of boxes
34//! - `box_convert`: Convert a box from one format to another. Supported formats are `xyxy`, `xywh`, `cxcywh`.
35//! - `remove_small_boxes`: Remove boxes with area smaller than a threshold
36//! - `mask_to_boxes`: Convert a mask to a list of boxes
37//!
38//! #### Box Metrics
39//! - `iou_distance`: Compute the intersection over union matrix of two sets of boxes
40//! - `parallel_iou_distance`: Compute the intersection over union matrix of two sets of boxes in parallel
41//! - `giou_distance`: Compute the generalized intersection over union matrix of two sets of boxes
42//! - `parallel_giou_distance`: Compute the generalized intersection over union matrix of two sets of boxes in parallel
43//!
44//! #### Box NMS
45//! - `nms`: Non-maximum suppression, returns the indices of the boxes to keep
46//! - `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.
47//!
48pub mod boxes;
49pub mod diou;
50pub mod giou;
51pub mod iou;
52pub mod nms;
53pub mod rotation;
54pub mod tiou;
55mod utils;