From 8f4dfd7a3cb34eaee4c97ef35e35e3106adfa721 Mon Sep 17 00:00:00 2001 From: cangonin Date: Mon, 5 Jan 2026 12:02:25 +0100 Subject: [PATCH] fix bug and update classes hyena config --- .gitignore | 6 +++--- configs/hyenas/finetune_mixup_100.yaml | 2 +- scripts/get_ap_scores_from_predictions.py | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0eabecd..2185b08 100644 --- a/.gitignore +++ b/.gitignore @@ -127,8 +127,7 @@ data-bin/ scripts/libPeak/_peak_detection.cpp # VSCODE -.vscode/ftp-sync.json -.vscode/settings.json +.vscode/ # Experimental Folder experimental/* @@ -143,4 +142,5 @@ outputs # Other results -logs \ No newline at end of file +logs +data/ \ No newline at end of file diff --git a/configs/hyenas/finetune_mixup_100.yaml b/configs/hyenas/finetune_mixup_100.yaml index eacb6fe..7029caf 100644 --- a/configs/hyenas/finetune_mixup_100.yaml +++ b/configs/hyenas/finetune_mixup_100.yaml @@ -22,7 +22,7 @@ task: min_sample_size: 1000 min_label_size: 2936 # Empty label files have Bytesize 2936, so to exclude them set this to 2936 normalize: true - unique_labels: "['groan', 'oth', 'whoop', 'alarm_rumble', 'squitter', 'squeal', 'feeding', 'giggle', 'growl', 'focal']" + unique_labels: "['groan', 'oth', 'whoop', 'alarm_rumble', 'squitter', 'squeal', 'feeding', 'giggle', 'growl', 'snore', 'focal']" with_labels: true conv_feature_layers: '[(127, 63, 1)] +[(512, 10, 5)] + [(512, 3, 4)] + [(512, 3, 3)] + [(512, 3, 2)] + [(512, 3, 1)] + [(512, 2, 1)] * 2' sample_rate: 24000 diff --git a/scripts/get_ap_scores_from_predictions.py b/scripts/get_ap_scores_from_predictions.py index 1fd1c43..eb1a7ae 100644 --- a/scripts/get_ap_scores_from_predictions.py +++ b/scripts/get_ap_scores_from_predictions.py @@ -33,7 +33,11 @@ def remove_empty_rows( Tuple[NDArray, NDArray]: Filtered predictions and targets with empty rows removed. """ - non_empty_indices = np.where(targets.sum(axis=1) != 0)[0] + empty_indices_targets = np.where(targets.sum(axis=1) == 0)[0] + empty_indices_pred = np.where(predictions.sum(axis=1) == 0)[0] + empty_indices = np.intersect1d(empty_indices_pred, empty_indices_targets) + all_indices = np.arange(len(targets)) + non_empty_indices = np.setdiff1d(all_indices, empty_indices) return predictions[non_empty_indices], targets[non_empty_indices]