Skip to content

Commit

Permalink
chore: update from_scenario
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Jan 1, 2024
1 parent b45762b commit 96f6ef7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
12 changes: 5 additions & 7 deletions perception_eval/perception_eval/tool/perception_analyzer2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,20 @@ def from_scenario(
scenario_obj: Optional[Dict[str, Any]] = yaml.safe_load(scenario_file)

p_cfg: Dict[str, Any] = scenario_obj["Evaluation"]["PerceptionEvaluationConfig"]
eval_cfg_dict: Dict[str, Any] = p_cfg["evaluation_config_dict"]
config_dict: Dict[str, Any] = p_cfg["evaluation_config_dict"]

eval_cfg_dict["label_prefix"] = (
"traffic_light" if eval_cfg_dict["UseCaseName"] == "traffic_light" else "autoware"
)
config_dict["label_prefix"] = "traffic_light" if config_dict["UseCaseName"] == "traffic_light" else "autoware"
camera_types: Dict[str, int] = scenario_obj["Evaluation"]["Conditions"]["TargetCameras"]

evaluation_config: PerceptionEvaluationConfig = PerceptionEvaluationConfig(
config = PerceptionEvaluationConfig(
dataset_paths=[""], # dummy path
frame_id=list(camera_types.keys()),
result_root_directory=result_root_directory,
evaluation_config_dict=eval_cfg_dict,
config_dict=config_dict,
load_raw_data=False,
)

return cls(evaluation_config)
return cls(config)

@property
def columns(self) -> List[str]:
Expand Down
12 changes: 6 additions & 6 deletions perception_eval/perception_eval/tool/perception_analyzer3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ def from_scenario(
scenario_obj: Optional[Dict[str, Any]] = yaml.safe_load(scenario_file)

p_cfg: Dict[str, Any] = scenario_obj["Evaluation"]["PerceptionEvaluationConfig"]
eval_cfg_dict: Dict[str, Any] = p_cfg["evaluation_config_dict"]
config_dict: Dict[str, Any] = p_cfg["evaluation_config_dict"]

eval_cfg_dict["label_prefix"] = "autoware"
config_dict["label_prefix"] = "autoware"

evaluation_config: PerceptionEvaluationConfig = PerceptionEvaluationConfig(
config = PerceptionEvaluationConfig(
dataset_paths=[""], # dummy path
frame_id="base_link" if eval_cfg_dict["evaluation_task"] == "detection" else "map",
frame_id="base_link" if config_dict["evaluation_task"] == "detection" else "map",
result_root_directory=result_root_directory,
evaluation_config_dict=eval_cfg_dict,
config_dict=config_dict,
load_raw_data=False,
)

return cls(evaluation_config, num_area_division)
return cls(config, num_area_division)

@property
def columns(self) -> List[str]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,20 @@ def from_scenario(
scenario_obj: Optional[Dict[str, any]] = yaml.safe_load(scenario_file)

p_cfg: Dict[str, any] = scenario_obj["Evaluation"]["PerceptionEvaluationConfig"]
eval_cfg_dict: Dict[str, any] = p_cfg["evaluation_config_dict"]
config_dict: Dict[str, any] = p_cfg["evaluation_config_dict"]

eval_cfg_dict["label_prefix"] = (
"traffic_light" if eval_cfg_dict["UseCaseName"] == "traffic_light" else "autoware"
)
config_dict["label_prefix"] = "traffic_light" if config_dict["UseCaseName"] == "traffic_light" else "autoware"
camera_types: Dict[str, int] = scenario_obj["Evaluation"]["Conditions"]["TargetCameras"]

evaluation_config: PerceptionEvaluationConfig = PerceptionEvaluationConfig(
config = PerceptionEvaluationConfig(
dataset_paths=[""], # dummy path
frame_id=list(camera_types.keys()),
result_root_directory=result_root_directory,
evaluation_config_dict=eval_cfg_dict,
config_dict=config_dict,
load_raw_data=False,
)

return cls(evaluation_config, **kwargs)
return cls(config, **kwargs)

def init_figure(self) -> Tuple[Figure, np.ndarray]:
"""Initialize figure and axes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ def from_scenario(
scenario_obj: Optional[Dict[str, any]] = yaml.safe_load(scenario_file)

p_cfg: Dict[str, any] = scenario_obj["Evaluation"]["PerceptionEvaluationConfig"]
eval_cfg_dict: Dict[str, any] = p_cfg["evaluation_config_dict"]
config_dict: Dict[str, any] = p_cfg["evaluation_config_dict"]

eval_cfg_dict["label_prefix"] = "autoware"
config_dict["label_prefix"] = "autoware"

evaluation_config: PerceptionEvaluationConfig = PerceptionEvaluationConfig(
config = PerceptionEvaluationConfig(
dataset_paths=[""], # dummy path
frame_id="base_link" if eval_cfg_dict["evaluation_task"] == "detection" else "map",
frame_id="base_link" if config_dict["evaluation_task"] == "detection" else "map",
result_root_directory=result_root_directory,
evaluation_config_dict=eval_cfg_dict,
config_dict=config_dict,
load_raw_data=False,
)

return cls(evaluation_config, **kwargs)
return cls(config, **kwargs)

@property
def config(self) -> PerceptionEvaluationConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ def from_scenario(
scenario_obj: Optional[Dict[str, any]] = yaml.safe_load(scenario_file)

s_cfg: Dict[str, any] = scenario_obj["Evaluation"]["SensingEvaluationConfig"]
eval_cfg_dict: Dict[str, any] = s_cfg["evaluation_config_dict"]
config_dict: Dict[str, any] = s_cfg["evaluation_config_dict"]

eval_cfg_dict["label_prefix"] = "autoware"
config_dict["label_prefix"] = "autoware"

evaluation_config: SensingEvaluationConfig = SensingEvaluationConfig(
config: SensingEvaluationConfig = SensingEvaluationConfig(
dataset_paths=[""], # dummy path
frame_id="base_link",
result_root_directory=result_root_directory,
evaluation_config_dict=eval_cfg_dict,
config_dict=config_dict,
load_raw_data=False,
)

return cls(evaluation_config, **kwargs)
return cls(config, **kwargs)

@property
def config(self) -> SensingEvaluationConfig:
Expand Down

0 comments on commit 96f6ef7

Please sign in to comment.