Source code for recipes.icassp_2023.baseline.report_score
"""Run the dummy enhancement."""
import json
import logging
import hydra
import pandas as pd
from omegaconf import DictConfig
from recipes.icassp_2023.baseline.evaluate import make_scene_listener_list
logger = logging.getLogger(__name__)
[docs]
@hydra.main(config_path=".", config_name="config", version_base=None)
def report_score(cfg: DictConfig) -> None:
"""Run the dummy enhancement."""
with open(cfg.path.scenes_listeners_file, encoding="utf-8") as fp:
scenes_listeners = json.load(fp)
results_df = pd.read_csv("scores.csv")
# Make list of all scene listener pairs that are expected in results file
scene_listener_pairs = make_scene_listener_list(
scenes_listeners, cfg.evaluate.small_test
)
selection_df = pd.DataFrame(scene_listener_pairs, columns=["scene", "listener"])
# Select the expected scene listener pairs from the results file
selected_results_df = pd.merge(results_df, selection_df, on=["scene", "listener"])
if len(selected_results_df) != len(selection_df):
print("The following results were not found:")
difference = pd.concat(
[selected_results_df[["scene", "listener"]], selection_df]
).drop_duplicates(keep=False)
print(difference)
else:
# All expected results were found so report the mean score
print(f"Scores based on {len(selected_results_df)} scenes.")
print(selected_results_df[["haspi", "hasqi", "combined"]].mean(axis=0))
# pylint: disable=no-value-for-parameter
if __name__ == "__main__":
report_score()