Skip to content

Commit

Permalink
made sure results are saved to the right paths
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <[email protected]>
  • Loading branch information
bmmtstb committed Jun 6, 2024
1 parent 3a8a149 commit d6f9413
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions scripts/own/eval_pair_similarities_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# @torch_memory_analysis
# @MemoryTracker(interval=7.5, top_n=20)
@torch.no_grad()
def run(config: Config, dl_key: str, paths: list[str]) -> None:
def run(config: Config, dl_key: str, paths: list[str], out_key: str) -> None:
"""Main function to run the code."""
# Combinations of IoU, OKS, and visual similarity
for dgs_key in (pbar_key := tqdm(MODULES, desc="combinations")):
Expand All @@ -69,7 +69,7 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
orig_log_dir = config["log_dir"]

# change config data
config["log_dir"] += f"./{dl_key}/{dgs_key}_{alpha_1}_{100-alpha_1}/"
config["log_dir"] += f"./{out_key}/{dgs_key}_{alpha_1}_{100-alpha_1}/"
# set the new path for the out file in the log_dir
config["submission"]["file"] = os.path.abspath(
os.path.normpath(
Expand Down Expand Up @@ -109,7 +109,7 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
cfg = load_config(CONFIG_FILE)
base_path = cfg["dgs_gt"]["base_path"]
data_paths = [f.path for f in os.scandir(base_path) if f.is_file()]
run(config=cfg, dl_key="dgs_gt", paths=data_paths)
run(config=cfg, dl_key="dgs_gt", paths=data_paths, out_key="dgs_gt")

print("Evaluating on the PT21 eval-dataset using KeypointRCNN as prediction backbone")
for thresh in (pbar_thresh := tqdm(["085", "090", "095", "099"], desc="thresholds")):
Expand All @@ -119,4 +119,4 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
cfg["dgs_rcnn"]["base_path"] = base_path
cfg["dgs_rcnn"]["crops_folder"] = f"./data/PoseTrack21/crops/256x192/rcnn_prediction_{thresh}/"
data_paths = [f.path for f in os.scandir(base_path) if f.is_file()]
run(config=cfg, dl_key="dgs_rcnn", paths=data_paths)
run(config=cfg, dl_key="dgs_rcnn", paths=data_paths, out_key=f"dgs_rcnn_{thresh}")
8 changes: 4 additions & 4 deletions scripts/own/eval_triplet_similarities_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# @torch_memory_analysis
# @MemoryTracker(interval=7.5, top_n=20)
@torch.no_grad()
def run(config: Config, dl_key: str, paths: list[str]) -> None:
def run(config: Config, dl_key: str, paths: list[str], out_key: str) -> None:
"""Main function to run the code."""

combinations = []
Expand Down Expand Up @@ -71,7 +71,7 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
orig_log_dir = config["log_dir"]

# change config data
config["log_dir"] += f"./{dl_key}/{dgs_key}_{'_'.join(str(c) for c in combination)}/"
config["log_dir"] += f"./{out_key}/{dgs_key}_{'_'.join(str(c) for c in combination)}/"
# set the new path for the out file in the log_dir
config["submission"]["file"] = os.path.abspath(
os.path.normpath(
Expand Down Expand Up @@ -111,7 +111,7 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
cfg = load_config(CONFIG_FILE)
base_path = cfg["dgs_gt"]["base_path"]
data_paths = [f.path for f in os.scandir(base_path) if f.is_file()]
run(config=cfg, dl_key="dgs_gt", paths=data_paths)
run(config=cfg, dl_key="dgs_gt", paths=data_paths, out_key="dgs_gt")

print("Evaluating on the PT21 eval-dataset using KeypointRCNN as prediction backbone")
for thresh in (pbar_thresh := tqdm(["085", "090", "095", "099"], desc="thresholds")):
Expand All @@ -121,4 +121,4 @@ def run(config: Config, dl_key: str, paths: list[str]) -> None:
cfg["dgs_rcnn"]["base_path"] = base_path
cfg["dgs_rcnn"]["crops_folder"] = f"./data/PoseTrack21/crops/256x192/rcnn_prediction_{thresh}/"
data_paths = [f.path for f in os.scandir(base_path) if f.is_file()]
run(config=cfg, dl_key="dgs_rcnn", paths=data_paths)
run(config=cfg, dl_key="dgs_rcnn", paths=data_paths, out_key=f"dgs_rcnn_{thresh}")

0 comments on commit d6f9413

Please sign in to comment.