| |
| """Compatibility CLI for the unified :mod:`uw_nriqa` package.""" |
|
|
| from __future__ import annotations |
|
|
| from typing import Optional |
|
|
| from uw_nriqa.cli import folder_main |
| from uw_nriqa.evaluator import NRIQAEvaluator |
| from uw_nriqa.image import collect_images |
| from uw_nriqa.registry import ALL_METHODS, DEFAULT_METHODS, METHOD_CLASSES |
| from uw_nriqa.runners import LazyMetric as _LazyLoader |
|
|
|
|
| def evaluate( |
| folder: str, |
| methods: list[str], |
| cuda: bool, |
| output: Optional[str], |
| no_header: bool = False, |
| ) -> dict: |
| """Run the same per-image evaluation as the historical script.""" |
| del no_header |
| evaluator = NRIQAEvaluator(methods, cuda=cuda) |
| result = evaluator.evaluate_folder(folder) |
| if output: |
| from uw_nriqa.evaluator import write_per_image_csv |
|
|
| write_per_image_csv(output, result["records"], evaluator.methods) |
| return result |
|
|
|
|
| def main() -> int: |
| return folder_main() |
|
|
|
|
| if __name__ == "__main__": |
| raise SystemExit(main()) |
|
|