File size: 2,104 Bytes
23e73f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Aggregate gradient_intensity.json across scenes/methods → Table 5 expansion."""
import os, json, argparse
import numpy as as np if False else None
import numpy as np


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--methods", nargs="+", default=["vanilla_logged", "vanillasgf_logged"])
    ap.add_argument("--scenes", nargs="+", default=["francis","m60","panther","bonsai","bicycle","garden"])
    ap.add_argument("--outputs_root", default="/root/autodl-tmp/SplatAtlas/outputs")
    args = ap.parse_args()

    print(f"{'Method':<22} {'Scene':<10} {'Edge grad':>11} {'Flat grad':>11} {'Edge/Flat':>10}")
    print("-"*68)
    summary = {}
    for method in args.methods:
        ae, af = [], []
        for scene in args.scenes:
            log_path = os.path.join(args.outputs_root, f"{method}_{scene}", "gradient_intensity.json")
            if not os.path.exists(log_path):
                print(f"{method:<22} {scene:<10} (missing)"); continue
            with open(log_path) as f: entries = json.load(f)
            ev = [e["edge_mean"] for e in entries if e.get("edge_mean", 0) > 0]
            fv = [e["flat_mean"] for e in entries if e.get("flat_mean", 0) > 0]
            if not ev or not fv:
                print(f"{method:<22} {scene:<10} (empty)"); continue
            em, fm = float(np.mean(ev)), float(np.mean(fv))
            r = em / max(fm, 1e-9)
            print(f"{method:<22} {scene:<10} {em:>11.3e} {fm:>11.3e} {r:>10.2f}")
            ae.append(em); af.append(fm)
        if ae and af:
            mep, mfp = float(np.mean(ae)), float(np.mean(af))
            mr = mep / max(mfp, 1e-9)
            print(f"{method:<22} {'AVERAGE':<10} {mep:>11.3e} {mfp:>11.3e} {mr:>10.2f}")
            print("-"*68)
            summary[method] = {"edge": mep, "flat": mfp, "ratio": mr}
    if "vanilla_logged" in summary and "vanillasgf_logged" in summary:
        print(f"\nEdge/Flat grad ratio shift: baseline {summary['vanilla_logged']['ratio']:.2f}x"
              f" → SGF {summary['vanillasgf_logged']['ratio']:.2f}x")


if __name__ == "__main__":
    main()