Skip to content

Commit 595bf07

Browse files
fix numpy 1.24 errors
Reasons: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
1 parent faadf03 commit 595bf07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: effdet/evaluation/metrics.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def compute_precision_recall(scores, labels, num_gt):
1818
if not isinstance(labels, np.ndarray) or len(labels.shape) != 1:
1919
raise ValueError("labels must be single dimension numpy array")
2020

21-
if labels.dtype != np.float and labels.dtype != np.bool:
21+
if labels.dtype != np.float_ and labels.dtype != np.bool_:
2222
raise ValueError("labels type must be either bool or float")
2323

2424
if not isinstance(scores, np.ndarray) or len(scores.shape) != 1:
@@ -64,7 +64,7 @@ def compute_average_precision(precision, recall):
6464

6565
if not isinstance(precision, np.ndarray) or not isinstance(recall, np.ndarray):
6666
raise ValueError("precision and recall must be numpy array")
67-
if precision.dtype != np.float or recall.dtype != np.float:
67+
if precision.dtype != np.float_ or recall.dtype != np.float_:
6868
raise ValueError("input must be float numpy array.")
6969
if len(precision) != len(recall):
7070
raise ValueError("precision and recall must be of the same size.")

0 commit comments

Comments
 (0)