| 95 | return pd.DataFrame(stats) |
| 96 | |
| 97 | def extract_comp_df(results_dir, dataset): |
| 98 | resultsdir = os.path.join(results_dir, dataset, "comparison") |
| 99 | results = os.listdir(resultsdir) |
| 100 | runs = [os.path.join(resultsdir, r) for r in results if os.path.isdir(os.path.join(resultsdir, r))] |
| 101 | stats = [] |
| 102 | for run in runs: |
| 103 | if len(os.path.basename(run).split("-")) != 3: |
| 104 | continue |
| 105 | |
| 106 | pe, min_radius_str, polystr = os.path.basename(run).split("-") |
| 107 | poly = int(polystr.replace("poly", "")) |
| 108 | min_radius = int(min_radius_str.replace("minr", "")) |
| 109 | |
| 110 | with open(os.path.join(run, f"{pe:1.8}-{NN:1.6}.json")) as f: |
| 111 | stat = json.load(f) |
| 112 | stats.append( |
| 113 | dict( |
| 114 | accuracy=stat["accuracy"], |
| 115 | testloss=stat["testloss"], |
| 116 | iou=stat["iou"], |
| 117 | harmonics_calculation=stat["harmonics_calculation"], |
| 118 | test_duration=stat["test_duration"], |
| 119 | train_duration=stat["train_duration"], |
| 120 | mean_dist=stat["mean_dist"], |
| 121 | embedding_dim=stat["embedding_dim"], |
| 122 | min_radius=min_radius, |
| 123 | poly=poly, |
| 124 | nn=NN, |
| 125 | pe=pe |
| 126 | ) |
| 127 | ) |
| 128 | return pd.DataFrame(stats) |
| 129 | |
| 130 | |
| 131 | def plot_sh(df, ydim="test_duration"): |