Skip to content

Commit

Permalink
Add coarse eval choice in main megapose run evaluation script
Browse files Browse the repository at this point in the history
  • Loading branch information
MedericFourmy committed Oct 18, 2023
1 parent b9f296b commit fb18b14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class FullEvalConfig(EvalConfig):
detection_coarse_types: Optional[List] = None
ds_names: Optional[List[str]] = None
run_bop_eval: bool = True
modelnet_categories: Optional[List[str]] = None
eval_coarse_also: bool = False
convert_only: bool = False

Check warning on line 93 in happypose/pose_estimators/megapose/evaluation/eval_config.py

View check run for this annotation

Codecov / codecov/patch

happypose/pose_estimators/megapose/evaluation/eval_config.py#L92-L93

Added lines #L92 - L93 were not covered by tests


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def run_full_eval(cfg: FullEvalConfig) -> None:

# create the EvalConfig objects that we will call `run_eval` on
eval_configs: Dict[str, EvalConfig] = dict()
for (detection_type, coarse_estimation_type) in cfg.detection_coarse_types:
for detection_type, coarse_estimation_type in cfg.detection_coarse_types:

Check warning on line 121 in happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py

View check run for this annotation

Codecov / codecov/patch

happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py#L121

Added line #L121 was not covered by tests
name, cfg_ = create_eval_cfg(cfg, detection_type, coarse_estimation_type, ds_name)
eval_configs[name] = cfg_

Expand All @@ -135,8 +135,7 @@ def run_full_eval(cfg: FullEvalConfig) -> None:
else: # Otherwise hack the output so we can run the BOP eval
if get_rank() == 0:
results_dir = get_save_dir(eval_cfg)
# pred_keys = ["refiner/final"]
pred_keys = ["coarse"]
pred_keys = ["coarse", "refiner/final"]

Check warning on line 138 in happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py

View check run for this annotation

Codecov / codecov/patch

happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py#L138

Added line #L138 was not covered by tests
if eval_cfg.inference.run_depth_refiner:
pred_keys.append("depth_refiner")
eval_out = {
Expand All @@ -151,8 +150,11 @@ def run_full_eval(cfg: FullEvalConfig) -> None:

# Run the bop eval for each type of prediction
if cfg.run_bop_eval and get_rank() == 0:
bop_eval_keys = set(("refiner/final", "depth_refiner"))
if cfg.eval_coarse_also:
bop_eval_keys.add('coarse')

Check warning on line 155 in happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py

View check run for this annotation

Codecov / codecov/patch

happypose/pose_estimators/megapose/scripts/run_full_megapose_eval.py#L154-L155

Added lines #L154 - L155 were not covered by tests

bop_eval_keys = set(("coarse", "refiner/final", "depth_refiner"))
# Remove from evaluation predictions that were not produced at inference time
bop_eval_keys = bop_eval_keys.intersection(set(eval_out["pred_keys"]))

for method in bop_eval_keys:
Expand Down

0 comments on commit fb18b14

Please sign in to comment.