Spaces:
Paused
Paused
Add duplicate-view capture diagnostics
Browse files- tests/test_assess_capture.py +21 -0
tests/test_assess_capture.py
CHANGED
|
@@ -27,4 +27,25 @@ def test_assess_capture_reports_source_media_diagnostics(tmp_path):
|
|
| 27 |
assert report["view_count"] == 2
|
| 28 |
assert report["held_out_view_count"] == 1
|
| 29 |
assert len(report["views"]) == 2
|
|
|
|
|
|
|
| 30 |
assert "interpretation" in report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
assert report["view_count"] == 2
|
| 28 |
assert report["held_out_view_count"] == 1
|
| 29 |
assert len(report["views"]) == 2
|
| 30 |
+
assert report["duplicate_pair_count"] == 0
|
| 31 |
+
assert report["near_duplicate_pair_count"] == 0
|
| 32 |
assert "interpretation" in report
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def test_assess_capture_flags_duplicate_views(tmp_path):
|
| 36 |
+
root = Path(tmp_path) / "duplicate_capture_fixture"
|
| 37 |
+
image_dir = root / "images"
|
| 38 |
+
image_dir.mkdir(parents=True, exist_ok=True)
|
| 39 |
+
for name in ("a.png", "b.png"):
|
| 40 |
+
Image.new("RGB", (32, 32), (100, 120, 140)).save(image_dir / name)
|
| 41 |
+
matrix = [[20, 0, 16], [0, 20, 16], [0, 0, 1]]
|
| 42 |
+
pose = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
|
| 43 |
+
path = root / "capture.json"
|
| 44 |
+
path.write_text(json.dumps({"project": "Simam3D", "views": [
|
| 45 |
+
{"id": "a", "image": "images/a.png", "split": "train", "intrinsics": matrix, "extrinsics": pose},
|
| 46 |
+
{"id": "b", "image": "images/b.png", "split": "held_out", "intrinsics": matrix, "extrinsics": pose},
|
| 47 |
+
]}), encoding="utf-8")
|
| 48 |
+
report = assess_capture(path)
|
| 49 |
+
assert report["duplicate_pair_count"] == 1
|
| 50 |
+
assert report["views_with_warnings"] == 2
|
| 51 |
+
assert "duplicate_input" in report["views"][0]["warnings"]
|