address all linting errors from rule NPY201

This commit is contained in:
mbsantiago 2024-11-10 19:13:30 +00:00
parent 95bb0985e7
commit 9e0ad7fd78

View File

@ -8,6 +8,11 @@ import pandas as pd
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
try:
from numpy.exceptions import AxisError
except ImportError:
from numpy import AxisError
import batdetect2.detector.compute_features as feats import batdetect2.detector.compute_features as feats
import batdetect2.detector.post_process as pp import batdetect2.detector.post_process as pp
import batdetect2.utils.audio_utils as au import batdetect2.utils.audio_utils as au
@ -242,7 +247,7 @@ def format_single_result(
) )
class_name = class_names[np.argmax(class_overall)] class_name = class_names[np.argmax(class_overall)]
annotations = get_annotations_from_preds(predictions, class_names) annotations = get_annotations_from_preds(predictions, class_names)
except (np.AxisError, ValueError): except (AxisError, ValueError):
# No detections # No detections
class_overall = np.zeros(len(class_names)) class_overall = np.zeros(len(class_names))
class_name = "None" class_name = "None"