MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / main

Function main

experiments/exp_resolution.py:12–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10NN = ["linear", "siren"]
11
12def main():
13 for scale in SCALES:
14 for poly in POLYS:
15 for nn in NN:
16 pe = 'sphericalharmonics'
17 args = Namespace(dataset='checkerboard',
18 pe=pe,
19 nn=nn,
20 save_model=False,
21 log_wandb=False,
22 hparams='hparams.yaml',
23 results_dir='results/train',
24 expname=f'{pe}-{nn}-scale{scale}-{poly}poly',
25 seed=0,
26 resume_ckpt_from_results_dir=False,
27 matplotlib=True,
28 matplotlib_show=False,
29 checkerboard_scale=float(scale),
30 legendre_polys=poly,
31 use_expnamehps=False,
32 max_epochs=None,
33 accelerator="cpu",
34 gpus=-1,
35 harmonics_calculation="analytic",
36 min_radius=None)
37
38 fit(args)
39
40 resultsdir = os.path.join(args.results_dir, args.dataset)
41 results = os.listdir(resultsdir)
42 runs = [os.path.join(resultsdir, r) for r in results if os.path.isdir(os.path.join(resultsdir, r))]
43 stats = []
44 for run in runs:
45 if len(os.path.basename(run).split("-")) != 4:
46 continue
47
48 pe, nn, scalestr, polystr = os.path.basename(run).split("-")
49 scale = float(scalestr.replace("scale", ""))
50 poly = int(polystr.replace("poly", ""))
51 with open(os.path.join(run, f"{pe:1.8}-{nn:1.6}.json")) as f:
52 stat = json.load(f)
53 stats.append(
54 dict(
55 accuracy=stat["accuracy"],
56 testloss=stat["testloss"],
57 iou=stat["iou"],
58 mean_dist=stat["mean_dist"],
59 poly=poly,
60 scale=scale,
61 nn=nn,
62 pe=pe
63 )
64 )
65 df = pd.DataFrame(stats)
66
67 fig, ax = plt.subplots()
68
69 for nn in df.nn.unique():

Callers 1

exp_resolution.pyFile · 0.70

Calls 1

fitFunction · 0.90

Tested by

no test coverage detected