Download scripts/build_grand_table.py from KCBtheone/SplatAtlas: direct link, hf CLI and curl.
- Browser
- Download file 2.71 kB
-
https://huggingface.co/KCBtheone/SplatAtlas/resolve/main/scripts/build_grand_table.py
- Command line
-
hf download hf://KCBtheone/SplatAtlas/scripts/build_grand_table.py
-
curl -L -o build_grand_table.py https://huggingface.co/KCBtheone/SplatAtlas/resolve/main/scripts/build_grand_table.py
2.71 kB
| import os | |
| import json | |
| import pandas as pd | |
| def main(): | |
| outputs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "outputs")) | |
| data = [] | |
| for folder in os.listdir(outputs_dir): | |
| method_dir = os.path.join(outputs_dir, folder) | |
| if not os.path.isdir(method_dir) or folder == "pathology_archive": | |
| continue | |
| # 优先寻找批量管线的终点文件 | |
| metrics_file = os.path.join(method_dir, "metrics_test_iter30000.json") | |
| if not os.path.exists(metrics_file): | |
| metrics_file = os.path.join(method_dir, "metrics.json") | |
| train_metrics_file = os.path.join(method_dir, "metrics_train_iter30000.json") | |
| physics_file = os.path.join(method_dir, "offline_physics_30000.json") | |
| row = {"Method": folder.split('_')[0], "Scene": folder.split('_')[1] if '_' in folder else "unknown"} | |
| if os.path.exists(metrics_file): | |
| with open(metrics_file, 'r') as f: | |
| m = json.load(f) | |
| row["PSNR_Test"] = m.get("photometric", {}).get("PSNR", 0) | |
| row["SSIM"] = m.get("photometric", {}).get("SSIM", 0) | |
| row["Prior"] = m.get("prior_type", "none") | |
| row["Flags"] = len(m.get("pathology_flags", [])) | |
| # 提取 Train PSNR 并计算你的核心主张:Delta PSNR | |
| if os.path.exists(train_metrics_file): | |
| with open(train_metrics_file, 'r') as tf: | |
| tm = json.load(tf) | |
| row["PSNR_Train"] = tm.get("photometric", {}).get("PSNR", 0) | |
| row["Delta_PSNR"] = row["PSNR_Train"] - row["PSNR_Test"] | |
| if os.path.exists(physics_file): | |
| with open(physics_file, 'r') as f: | |
| p = json.load(f) | |
| # 修正了旧版错误的字典查找,完美对齐新数据 | |
| row["Gini"] = p.get("spatial_gini", 0) | |
| row["SH_Ratio"] = p.get("sh_energy_ratio", 0) | |
| row["Condition"] = p.get("scale_condition_mean", 0) | |
| row["Billboard_Bias"] = p.get("billboard_bias_ratio", 0) | |
| if len(row) > 2: | |
| data.append(row) | |
| if not data: | |
| return | |
| df = pd.DataFrame(data).round(3) | |
| csv_path = os.path.join(outputs_dir, "grand_leaderboard.csv") | |
| df.to_csv(csv_path, index=False) | |
| latex_str = df.to_latex(index=False, float_format="%.3f") | |
| with open(os.path.join(outputs_dir, "grand_leaderboard.tex"), "w") as f: | |
| f.write(latex_str) | |
| print(f"📊 [GrandTable] 大榜单生成完毕!共收录 {len(data)} 个模型数据。") | |
| if __name__ == "__main__": | |
| main() | |