|
a |
|
b/experiments/analysis.py |
|
|
1 |
from os import listdir |
|
|
2 |
from os.path import join |
|
|
3 |
|
|
|
4 |
import matplotlib.pyplot as plt |
|
|
5 |
import numpy as np |
|
|
6 |
import pandas as pd |
|
|
7 |
|
|
|
8 |
|
|
|
9 |
def get_predictorwise_distribution(experiment_path): |
|
|
10 |
mean_ious = [] |
|
|
11 |
for experiment in listdir(experiment_path): |
|
|
12 |
# mean_ious.append(np.load(join(experiment_path, experiment))) #cool |
|
|
13 |
mean_ious.append(np.mean(np.load(join(experiment_path, experiment)))) |
|
|
14 |
plt.hist(mean_ious, bins=np.linspace(min(mean_ious), max(mean_ious), 25)) |
|
|
15 |
plt.show() |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
def get_datawise_distribution(experiment_path): |
|
|
19 |
mean_ious = [] |
|
|
20 |
for experiment in listdir(experiment_path): |
|
|
21 |
# mean_ious.append(np.load(join(experiment_path, experiment))) #cool |
|
|
22 |
mean_ious = np.concatenate((mean_ious, np.mean(np.load(join(experiment_path, experiment))))) |
|
|
23 |
plt.hist(mean_ious, bins=np.linspace(min(mean_ious), max(mean_ious), 25)) |
|
|
24 |
plt.show() |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
def plot_training_progression(csv_name): |
|
|
28 |
df = pd.read_csv(csv_name) |
|
|
29 |
plt.plot(df["epoch"], df["iid_test_iou"], label="IID") |
|
|
30 |
plt.plot(df["epoch"], df["ood_iou"], label="OOD") |
|
|
31 |
plt.plot(df["epoch"], df["iid_test_iou"] - df["ood_iou"], label="Diff") |
|
|
32 |
plt.legend() |
|
|
33 |
plt.ylim((0, 1)) |
|
|
34 |
plt.xlim((0, 250)) |
|
|
35 |
plt.show() |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
if __name__ == '__main__': |
|
|
39 |
plot_training_progression("logs/consistency/DeepLab/0.csv") |
|
|
40 |
plot_training_progression("logs/consistency/DeepLab/1.csv") |
|
|
41 |
# df_iid = df["Augmented" not in df["name"]] |
|
|
42 |
# get_predictorwise_distribution("experiments/Data/Normal-Pipelines/DeepLab") |