Files
Aislo/utils/verify_masks.py
T
2026-07-05 14:05:22 +09:00

37 lines
1.1 KiB
Python

import os
from pathlib import Path
import numpy as np
# 현재 런타임이 바라보는 작업 절대 경로 출력
cwd = Path(".").resolve()
print(f"Current Runtime CWD: {cwd}")
# instance 하위에 존재하는 모든 파일 리스트업
instance_dir = cwd / "instance"
if instance_dir.exists():
print("Files found in instance/ directory:")
for p in instance_dir.rglob("*.npy"):
print(f" - {p.relative_to(cwd)}")
else:
print("instance/ directory does NOT exist in CWD.")
print("\n==========================================")
print("Mask Internal Ground Count Verification")
print("==========================================")
proj_dir = instance_dir / "sample"
for fn in ["mask_grid_min_z.npy", "mask_csf.npy", "mask_pmf.npy", "mask_ransac.npy"]:
path = proj_dir / fn
if path.is_file():
mask = np.load(path)
total = len(mask)
true_cnt = np.sum(mask)
pct = (true_cnt / total) * 100 if total else 0
print(f"{fn:<22} : Total {total:,} pts | Ground {true_cnt:,} pts ({pct:.2f}%)")
else:
print(f"{fn:<22} : File NOT found.")
print("==========================================")