diff --git a/birdnet_analyzer/evaluation/assessment/plotting.py b/birdnet_analyzer/evaluation/assessment/plotting.py index a4833cffa..69fc42039 100644 --- a/birdnet_analyzer/evaluation/assessment/plotting.py +++ b/birdnet_analyzer/evaluation/assessment/plotting.py @@ -284,8 +284,8 @@ def plot_metrics_across_thresholds_per_class( n_cols, figsize=(n_cols * 5, n_rows * 4), num=MATPLOTLIB_ACROSS_METRICS_THRESHOLDS_PER_CLASS_FIGURE_NUM, + clear=True, ) - fig.clear() fig.tight_layout(pad=0) fig.set_dpi(300) @@ -376,7 +376,9 @@ def plot_confusion_matrices( confusion_matrix=conf_mat, display_labels=["Negative", "Positive"] ) fig, ax = plt.subplots( - num=MATPLOTLIB_BINARY_CONFUSION_MATRIX_FIGURE_NUM, figsize=(6, 6) + num=MATPLOTLIB_BINARY_CONFUSION_MATRIX_FIGURE_NUM, + figsize=(6, 6), + clear=True, ) fig.tight_layout() @@ -407,6 +409,7 @@ def plot_confusion_matrices( n_cols, figsize=(4 * n_cols, 4 * n_rows), num=MATPLOTLIB_MULTICLASS_CONFUSION_MATRIX_FIGURE_NUM, + clear=True, ) fig.set_dpi(300) axes = axes.flatten() if hasattr(axes, "flatten") else [axes] diff --git a/birdnet_analyzer/gui/utils.py b/birdnet_analyzer/gui/utils.py index e1af98ae2..db7b92323 100644 --- a/birdnet_analyzer/gui/utils.py +++ b/birdnet_analyzer/gui/utils.py @@ -288,7 +288,7 @@ def build_settings(): "light", ), ], - value=lambda: settings.theme(), # noqa: PLW0108 + value=settings.theme, label=loc.localize("settings-tab-theme-dropdown-label"), info="⚠️" + loc.localize("settings-tab-theme-dropdown-info"), interactive=True, diff --git a/birdnet_analyzer/model.py b/birdnet_analyzer/model.py index 99fbfa0fc..dac8c0568 100644 --- a/birdnet_analyzer/model.py +++ b/birdnet_analyzer/model.py @@ -752,6 +752,13 @@ def basic(inputs): tf.saved_model.save(combined_model, model_path, signatures=signatures) + #resave to fix for raven import compatibility. + loaded = tf.saved_model.load(model_path) + all_sigs = list(loaded.signatures.keys()) + SKIP_SIGS = {"__saved_model_init_op"} + inference_sigs = {k: loaded.signatures[k] for k in all_sigs if k not in SKIP_SIGS} + tf.saved_model.save(loaded, model_path, signatures=inference_sigs) + if mode == "append": labels = [*original_labels, *labels] @@ -881,7 +888,6 @@ def focal_loss(y_true, y_pred, gamma=2.0, alpha=0.25, epsilon=1e-7): return tf.reduce_sum(focal_loss, axis=-1) - def custom_loss(y_true, y_pred, epsilon=1e-7): positive_loss = -tf.reduce_sum( y_true * tf.math.log(tf.clip_by_value(y_pred, epsilon, 1.0 - epsilon)), axis=-1