Add Krea2 atlas coverage report

This commit is contained in:
2026-06-29 04:04:32 +02:00
parent 3a09210f71
commit 06525c42a3
3 changed files with 112 additions and 1 deletions
+21
View File
@@ -6878,6 +6878,27 @@ def smoke_krea2_tuning_report_policy() -> None:
any(str(path).endswith("ballsucking/101_ballsucking.png") for path in ballsucking_plan.get("reference_paths") or []),
"Ballsucking test plan lost atlas reference path",
)
with tempfile.TemporaryDirectory() as tmpdir:
atlas_root = Path(tmpdir)
for folder in ("doggy", "doggy_control", "custom_pose", "custom_pose_control", "bg", "woman", "doggy_bg"):
folder_path = atlas_root / folder
folder_path.mkdir()
(folder_path / f"{folder}_sample.png").write_bytes(b"")
atlas_rows = krea2_tuning_report.atlas_folder_rows(atlas_root=atlas_root)
atlas_by_folder = {row.get("folder"): row for row in atlas_rows}
_expect(atlas_by_folder.get("doggy", {}).get("mapped") is True, "Atlas report should mark catalog folders as mapped")
_expect(atlas_by_folder.get("custom_pose", {}).get("mapped") is False, "Atlas report should expose unmapped pose folders")
_expect("doggy_control" not in atlas_by_folder, "Atlas report should exclude control folders")
_expect("doggy_bg" not in atlas_by_folder, "Atlas report should exclude background folders")
_expect("bg" not in atlas_by_folder, "Atlas report should exclude shared bg folder")
_expect("woman" not in atlas_by_folder, "Atlas report should exclude non-pose woman folder")
atlas_summary = krea2_tuning_report.atlas_coverage_summary(atlas_root=atlas_root)
_expect(atlas_summary.get("pose_folder_count") == 2, "Atlas report should count only pose folders")
_expect(atlas_summary.get("mapped_folder_count") == 1, "Atlas report should count mapped pose folders")
_expect(atlas_summary.get("unmapped_folders") == ["custom_pose"], "Atlas report should identify unmapped pose folders")
atlas_markdown = krea2_tuning_report.markdown_report(atlas_root=atlas_root)
_expect("Atlas Folder Coverage" in atlas_markdown, "Krea2 tuning report markdown lost atlas coverage section")
_expect("custom_pose" in atlas_markdown, "Krea2 tuning report markdown lost unmapped atlas folder")
markdown = krea2_tuning_report.markdown_report()
_expect("pov_ballsucking_low_head" in markdown, "Krea2 tuning report markdown lost candidate variant")
_expect("needs_fixed_seed_tests" in markdown, "Krea2 tuning report markdown lost coverage state")