From 68351d2224999fc7272e1f1aafb776c8dc286266 Mon Sep 17 00:00:00 2001 From: ccarrizosa Date: Sat, 9 Nov 2024 22:35:11 +0100 Subject: [PATCH 1/3] Fix numpy exception handling --- batdetect2/utils/detector_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batdetect2/utils/detector_utils.py b/batdetect2/utils/detector_utils.py index 8d6ca7f..d8942e0 100644 --- a/batdetect2/utils/detector_utils.py +++ b/batdetect2/utils/detector_utils.py @@ -242,7 +242,7 @@ def format_single_result( ) class_name = class_names[np.argmax(class_overall)] annotations = get_annotations_from_preds(predictions, class_names) - except (np.AxisError, ValueError): + except (np.exceptions.AxisError, ValueError): # No detections class_overall = np.zeros(len(class_names)) class_name = "None" From 2d8a7b67f8268a76e4a413960506746f18e015fe Mon Sep 17 00:00:00 2001 From: ccarrizosa Date: Sun, 10 Nov 2024 15:54:01 +0100 Subject: [PATCH 2/3] Revert support for newest numpy versions. --- batdetect2/utils/detector_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batdetect2/utils/detector_utils.py b/batdetect2/utils/detector_utils.py index d8942e0..8d6ca7f 100644 --- a/batdetect2/utils/detector_utils.py +++ b/batdetect2/utils/detector_utils.py @@ -242,7 +242,7 @@ def format_single_result( ) class_name = class_names[np.argmax(class_overall)] annotations = get_annotations_from_preds(predictions, class_names) - except (np.exceptions.AxisError, ValueError): + except (np.AxisError, ValueError): # No detections class_overall = np.zeros(len(class_names)) class_name = "None" From 8597ef0a1c0c6c58252fa6aaf92374761fe6aa80 Mon Sep 17 00:00:00 2001 From: ccarrizosa Date: Sun, 10 Nov 2024 15:54:16 +0100 Subject: [PATCH 3/3] Limit numpy versions to <2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9497d08..f1ac123 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ authors = [ dependencies = [ "librosa>=0.10.1", "matplotlib>=3.7.1", - "numpy>=1.23.5", + "numpy>=1.23.5,<2", "pandas>=1.5.3", "scikit-learn>=1.2.2", "scipy>=1.10.1",