Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into experimental/nalgebra
Browse files Browse the repository at this point in the history
  • Loading branch information
Smirkey committed Oct 22, 2024
2 parents 93f963a + f18079d commit 4922be1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codespeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: cd powerboxesrs && cargo codspeed build

- name: Run benchmarks
uses: CodSpeedHQ/action@v1
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest bindings/tests/ --codspeed && cd powerboxesrs && cargo codspeed run
2 changes: 1 addition & 1 deletion bindings/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ description = "Utility functions to manipulate and compute metrics on boxes"
homepage = "https://smirkey.github.io/powerboxes/"
documentation = "https://smirkey.github.io/powerboxes/"
repository = "https://github.com/Smirkey/powerboxes"
version = "0.2.2"
version = "0.2.3"
dependencies = ["numpy"]

[tool.maturin]
Expand Down
20 changes: 10 additions & 10 deletions bindings/python/powerboxes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"uint32",
"uint64",
]
__version__ = "0.2.2"
__version__ = "0.2.3"

T = TypeVar(
"T",
Expand Down Expand Up @@ -136,7 +136,7 @@ def parallel_iou_distance(
raise TypeError(_BOXES_NOT_NP_ARRAY)
if boxes1.dtype == boxes2.dtype:
try:
return _dtype_to_func_parallel_iou_distance[boxes1.dtype](boxes1, boxes2)
return _dtype_to_func_parallel_iou_distance[boxes1.dtype](boxes1, boxes2) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes1.dtype} not in supported dtypes {supported_dtypes}"
Expand Down Expand Up @@ -167,7 +167,7 @@ def parallel_giou_distance(
raise TypeError(_BOXES_NOT_NP_ARRAY)
if boxes1.dtype == boxes2.dtype:
try:
return _dtype_to_func_parallel_giou_distance[boxes1.dtype](boxes1, boxes2)
return _dtype_to_func_parallel_giou_distance[boxes1.dtype](boxes1, boxes2) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes1.dtype} not in supported dtypes {supported_dtypes}"
Expand Down Expand Up @@ -198,7 +198,7 @@ def giou_distance(
raise TypeError(_BOXES_NOT_NP_ARRAY)
if boxes1.dtype == boxes2.dtype:
try:
return _dtype_to_func_giou_distance[boxes1.dtype](boxes1, boxes2)
return _dtype_to_func_giou_distance[boxes1.dtype](boxes1, boxes2) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes1.dtype} not in supported dtypes {supported_dtypes}"
Expand Down Expand Up @@ -229,7 +229,7 @@ def tiou_distance(
raise TypeError(_BOXES_NOT_NP_ARRAY)
if boxes1.dtype == boxes2.dtype:
try:
return _dtype_to_func_tiou_distance[boxes1.dtype](boxes1, boxes2)
return _dtype_to_func_tiou_distance[boxes1.dtype](boxes1, boxes2) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes1.dtype} not in supported dtypes {supported_dtypes}"
Expand Down Expand Up @@ -346,7 +346,7 @@ def remove_small_boxes(boxes: npt.NDArray[T], min_size: float) -> npt.NDArray[T]
if not isinstance(boxes, np.ndarray):
raise TypeError(_BOXES_NOT_NP_ARRAY)
try:
return _dtype_to_func_remove_small_boxes[boxes.dtype](boxes, min_size)
return _dtype_to_func_remove_small_boxes[boxes.dtype](boxes, min_size) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes.dtype} not in supported dtypes {supported_dtypes}"
Expand All @@ -365,7 +365,7 @@ def boxes_areas(boxes: npt.NDArray[T]) -> npt.NDArray[np.float64]:
if not isinstance(boxes, np.ndarray):
raise TypeError(_BOXES_NOT_NP_ARRAY)
try:
return _dtype_to_func_box_areas[boxes.dtype](boxes)
return _dtype_to_func_box_areas[boxes.dtype](boxes) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes.dtype} not in supported dtypes {supported_dtypes}"
Expand All @@ -391,7 +391,7 @@ def box_convert(boxes: npt.NDArray[T], in_fmt: str, out_fmt: str) -> npt.NDArray
if not isinstance(boxes, np.ndarray):
raise TypeError(_BOXES_NOT_NP_ARRAY)
try:
return _dtype_to_func_box_convert[boxes.dtype](boxes, in_fmt, out_fmt)
return _dtype_to_func_box_convert[boxes.dtype](boxes, in_fmt, out_fmt) # type: ignore
except KeyError:
raise TypeError(
f"Box dtype: {boxes.dtype} not in supported dtypes {supported_dtypes}"
Expand Down Expand Up @@ -438,7 +438,7 @@ def nms(
if not isinstance(boxes, np.ndarray) or not isinstance(scores, np.ndarray):
raise TypeError("Boxes and scores must be numpy arrays")
try:
return _dtype_to_func_nms[boxes.dtype](
return _dtype_to_func_nms[boxes.dtype]( # type: ignore
boxes, scores, iou_threshold, score_threshold
)
except KeyError:
Expand Down Expand Up @@ -473,7 +473,7 @@ def rtree_nms(
if not isinstance(boxes, np.ndarray) or not isinstance(scores, np.ndarray):
raise TypeError("Boxes and scores must be numpy arrays")
try:
return _dtype_to_func_rtree_nms[boxes.dtype](
return _dtype_to_func_rtree_nms[boxes.dtype]( # type: ignore
boxes, scores, iou_threshold, score_threshold
)
except KeyError:
Expand Down
5 changes: 3 additions & 2 deletions bindings/tests/test_boxes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from powerboxes import masks_to_boxes
import numpy as np
import os

import numpy as np
from PIL import Image
from powerboxes import masks_to_boxes


def test_masks_box():
Expand Down
4 changes: 2 additions & 2 deletions powerboxesrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//!
//! ```toml
//! [dependencies]
//! powerboxesrs = "0.2.2"
//! powerboxesrs = "0.2.3"
//! ```
//!
//! ## Usage
Expand Down Expand Up @@ -46,10 +46,10 @@
//! - `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.
//!
pub mod boxes;
pub mod diou;
pub mod giou;
pub mod iou;
pub mod nms;
pub mod rotation;
pub mod tiou;
mod utils;
pub mod diou;
1 change: 0 additions & 1 deletion powerboxesrs/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use num_traits::{Num, ToPrimitive};
use rstar::{RStarInsertionStrategy, RTreeNum, RTreeObject, RTreeParams, AABB};

pub const EPS: f64 = 1e-16;
pub const ONE: f64 = 1.0;
pub const ZERO: f64 = 0.0;

Expand Down

0 comments on commit 4922be1

Please sign in to comment.