| 66 | |
| 67 | |
| 68 | def extract_sh_df(results_dir, dataset): |
| 69 | resultsdir = os.path.join(results_dir, dataset) |
| 70 | results = os.listdir(resultsdir) |
| 71 | runs = [os.path.join(resultsdir, r) for r in results if os.path.isdir(os.path.join(resultsdir, r))] |
| 72 | stats = [] |
| 73 | for run in runs: |
| 74 | if len(os.path.basename(run).split("-")) != 3: |
| 75 | continue |
| 76 | |
| 77 | calc, pe, polystr = os.path.basename(run).split("-") |
| 78 | poly = int(polystr.replace("poly", "")) |
| 79 | with open(os.path.join(run, f"{pe:1.8}-{NN:1.6}.json")) as f: |
| 80 | stat = json.load(f) |
| 81 | stats.append( |
| 82 | dict( |
| 83 | accuracy=stat["accuracy"], |
| 84 | testloss=stat["testloss"], |
| 85 | iou=stat["iou"], |
| 86 | harmonics_calculation=stat["harmonics_calculation"], |
| 87 | test_duration=stat["test_duration"], |
| 88 | train_duration=stat["test_duration"], |
| 89 | mean_dist=stat["mean_dist"], |
| 90 | poly=poly, |
| 91 | nn=NN, |
| 92 | pe=pe |
| 93 | ) |
| 94 | ) |
| 95 | return pd.DataFrame(stats) |
| 96 | |
| 97 | def extract_comp_df(results_dir, dataset): |
| 98 | resultsdir = os.path.join(results_dir, dataset, "comparison") |