Skip to content

Commit

Permalink
Fix for 0 windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Etav99 committed Jan 9, 2023
1 parent a9c1e8f commit 5d90f44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/config_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def config_factory(
:return:
"""
layer = get_layer(special_layer, n_windows, window_widths, window_centers)
n_channels = 1 if layer is None else n_windows
if mode == ConfigMode.TRAIN:
return TrainingConfig(
custom_layer=layer,
n_channels=n_windows,
n_channels=n_channels,
batch_size=batch_size,
epochs=epochs,
learning_rate=learning_rate,
Expand All @@ -85,7 +86,7 @@ def config_factory(
elif mode == ConfigMode.TEST:
return TestingConfig(
custom_layer=layer,
n_channels=n_windows,
n_channels=n_channels,
batch_size=batch_size,
use_batchnorm=use_batch_norm,
multiclass=multiclass,
Expand Down
11 changes: 6 additions & 5 deletions src/process_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
"This notebook requires TensorBoard 2.3 or later."
print("TensorBoard version: ", tb.__version__)

experiment_id = "85t0twQZQkCp8ahXn60Ubw"
experiment_id = "OEIe2ae3T7mIdXyuXDE3hg"
experiment = tb.data.experimental.ExperimentFromDev(experiment_id)
df = experiment.get_scalars()

last_step = df['step'].max()

df = df[df["step"].eq(last_step) | df["tag"].str.contains("test")]
df = df[df["run"].str.contains("_single-window") & (df["step"].eq(last_step) | df["tag"].str.contains("test"))]

df = df.loc[
df["tag"].str.contains("test-dice")
| df["tag"].str.contains("window")
]

ww_regex = re.compile(r"ww-\[(-?\d+)\]")
wl_regex = re.compile(r"wl-\[(-?\d+)\]")
fold_regex = re.compile(r"fold-(\d+)")
ww_regex = re.compile(r"ww-\[(-?(\d+)?)\]")
wl_regex = re.compile(r"wl-\[(-?(\d+)?)\]")
fold_regex = re.compile(r"fold-((\d+)?)")

df = df.pivot(index="run", columns="tag", values="value")

Expand All @@ -35,5 +35,6 @@
df["fold"] = df.apply(lambda row: fold_regex.search(row.name).group(1), axis=1)

df = df[["fold", "window_width_init", "window_center_init", "test-dice", "test-dice_liver", "test-dice_tumor", "window-0-width", "window-0-center"]]
# df = df[["fold", "window_width_init", "window_center_init", "test-dice", "test-dice_liver", "test-dice_tumor", "window-0-width", "window-0-center", "window-1-width", "window-1-center", "window-2-width", "window-2-center", "window-3-width", "window-3-center", "window-4-width", "window-4-center"]]

df.to_excel("out.xlsx")

0 comments on commit 5d90f44

Please sign in to comment.