Add evaluation config with match strategy

This commit is contained in:
mbsantiago 2025-08-11 12:02:30 +01:00
parent 65d13a32b7
commit 8aa2d0cd11
2 changed files with 32 additions and 1 deletions

View File

@ -1,9 +1,15 @@
from batdetect2.evaluate.config import (
EvaluationConfig,
load_evaluation_config,
)
from batdetect2.evaluate.match import (
match_predictions_and_annotations,
match_sound_events_and_raw_predictions,
)
__all__ = [
"match_sound_events_and_raw_predictions",
"EvaluationConfig",
"load_evaluation_config",
"match_predictions_and_annotations",
"match_sound_events_and_raw_predictions",
]

View File

@ -0,0 +1,25 @@
from typing import Optional
from pydantic import Field
from soundevent import data
from batdetect2.configs import BaseConfig, load_config
from batdetect2.evaluate.match import DEFAULT_MATCH_CONFIG, MatchConfig
__all__ = [
"EvaluationConfig",
"load_evaluation_config",
]
class EvaluationConfig(BaseConfig):
match: MatchConfig = Field(
default_factory=lambda: DEFAULT_MATCH_CONFIG.model_copy(),
)
def load_evaluation_config(
path: data.PathLike,
field: Optional[str] = None,
) -> EvaluationConfig:
return load_config(path, schema=EvaluationConfig, field=field)