Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust plotting from gsp #465

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions angel_system/global_step_prediction/global_step_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,14 +835,14 @@ def plot_gt_vs_predicted_one_recipe(

plt.legend()
if not fname_suffix:
fname_suffix = f"vid{vid_id}"
fname_suffix = "vid_unknown"
output_dir_p = Path(output_dir)
output_dir_p.mkdir(parents=True, exist_ok=True)
title = f"plot_pred_vs_gt_{recipe_type}_{fname_suffix}.png"
plt.title(title)
output_file_path = output_dir_p / title
fig.savefig(output_file_path)
return output_file_path, preds, step_gts
fig.savefig(output_file_path.as_posix())
return output_file_path

def determine_recipe_from_gt_first_activity(self, activity_gts):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def output_gt_plotting(self):
log.info("No GT configured to score against, skipping.")
return
# List of per-frame truth activity classification IDs.
activity_gts = self.gt_video_dset.images().lookup("activity_gt")
activity_gts = self.gt_video_dset.annots().get("category_id")
recipe_type = self.gsp.determine_recipe_from_gt_first_activity(activity_gts)
log.info(f"recipe_type = {recipe_type}")
if recipe_type == "unknown_recipe_type":
Expand All @@ -610,11 +610,15 @@ def output_gt_plotting(self):
) = self.gsp.get_gt_steps_from_gt_activities(self.gt_video_dset, config_fn)

vid_name = self.gt_video_dset.dataset["videos"][0]["name"]
# handle video name if it is a full path
if Path(vid_name).exists():
vid_name = Path(vid_name).stem # just use the final part of the path

vid_id = self.gt_video_dset.dataset["videos"][0]["id"]
log.info("Generating plots...")
log.info(f"Generating plots to folder: {self.gt_output_dir_override}...")
out_p = self.gsp.plot_gt_vs_predicted_one_recipe(
granular_step_gts,
recipe_type,
step_gts=granular_step_gts,
recipe_type=recipe_type,
fname_suffix=f"{vid_name}_{str(vid_id)}_granular",
granular_or_broad="granular",
output_dir=self.gt_output_dir_override,
Expand Down
Loading