Skip to content

Commit

Permalink
some update
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Jun 27, 2023
1 parent 8015438 commit 007f4f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
45 changes: 24 additions & 21 deletions perception_eval/perception_eval/common/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import annotations

import logging
from typing import Any
from typing import Dict
from typing import List
Expand All @@ -38,7 +39,6 @@
from perception_eval.common.status import Visibility
from PIL import Image
from pyquaternion.quaternion import Quaternion
import logging

from . import dataset

Expand Down Expand Up @@ -388,26 +388,29 @@ def _sample_to_frame_2d(
unix_time: int = sample["timestamp"]

sample_data_tokens: List[str] = []
frame_id_mapping: Dict[str, FrameID] = {}
frame_id_mapping: Dict[str, FrameID] = {}
for frame_id_ in frame_ids:
# TODO update
scene_descriptions: List[str] = nusc.get("scene", sample["scene_token"])[
"description"
].split(", ")
if "regulatory_element" in scene_descriptions:
for camera_type in (FrameID.CAM_TRAFFIC_LIGHT_FAR.value.upper(), FrameID.CAM_TRAFFIC_LIGHT_NEAR.value.upper()):
if nusc_sample["data"].get(camera_type) is None:
continue
sample_data_token = nusc_sample["data"][camera_type]
sample_data_tokens.append(sample_data_token)
frame_id_mapping[sample_data_token] = FrameID.TRAFFIC_LIGHT # frame_id_
else:
camera_type: str = frame_id_.value.upper()
if nusc_sample["data"].get(camera_type) is None:
continue
sample_data_token = nusc_sample["data"][camera_type]
sample_data_tokens.append(sample_data_token)
frame_id_mapping[sample_data_token] = frame_id_
# # TODO update
# scene_descriptions: List[str] = nusc.get("scene", sample["scene_token"])[
# "description"
# ].split(", ")
# if "regulatory_element" in scene_descriptions:
# for camera_type in (
# FrameID.CAM_TRAFFIC_LIGHT_FAR.value.upper(),
# FrameID.CAM_TRAFFIC_LIGHT_NEAR.value.upper(),
# ):
# if nusc_sample["data"].get(camera_type) is None:
# continue
# sample_data_token = nusc_sample["data"][camera_type]
# sample_data_tokens.append(sample_data_token)
# frame_id_mapping[sample_data_token] = FrameID.TRAFFIC_LIGHT # frame_id_
# else:
camera_type: str = frame_id_.value.upper()
if nusc_sample["data"].get(camera_type) is None:
continue
sample_data_token = nusc_sample["data"][camera_type]
sample_data_tokens.append(sample_data_token)
frame_id_mapping[sample_data_token] = frame_id_

raw_data: Optional[Dict[str, np.ndarray]] = {} if load_raw_data else None
if load_raw_data:
Expand Down Expand Up @@ -452,7 +455,7 @@ def _sample_to_frame_2d(

visibility = None

logging.info(f"uuid: {uuid}")
logging.debug(f"uuid: {uuid}")

object_: DynamicObject2D = DynamicObject2D(
unix_time=unix_time,
Expand Down
9 changes: 8 additions & 1 deletion perception_eval/perception_eval/common/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def __init__(
label_prefix: str,
count_label_number: bool = False,
) -> None:

self.evaluation_task: EvaluationTask = (
evaluation_task
if isinstance(evaluation_task, EvaluationTask)
Expand Down Expand Up @@ -305,9 +304,13 @@ def _get_traffic_light_paris(
(TrafficLightLabel.RED_LEFT, "red_left"),
(TrafficLightLabel.RED_LEFT_STRAIGHT, "red_left_straight"),
(TrafficLightLabel.RED_LEFT_DIAGONAL, "red_left_diagonal"),
(TrafficLightLabel.RED_LEFT_STRAIGHT, "red_straight_left"),
(TrafficLightLabel.RED_LEFT_DIAGONAL, "red_diagonal_left"),
(TrafficLightLabel.RED_RIGHT, "red_right"),
(TrafficLightLabel.RED_RIGHT_STRAIGHT, "red_right_straight"),
(TrafficLightLabel.RED_RIGHT_DIAGONAL, "red_right_diagonal"),
(TrafficLightLabel.RED_RIGHT_STRAIGHT, "red_straight_right"),
(TrafficLightLabel.RED_RIGHT_DIAGONAL, "red_diagonal_right"),
(TrafficLightLabel.YELLOW_RIGHT, "yellow_right"),
(TrafficLightLabel.UNKNOWN, "unknown"),
]
Expand All @@ -321,9 +324,13 @@ def _get_traffic_light_paris(
(TrafficLightLabel.TRAFFIC_LIGHT, "red_left"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_left_straight"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_left_diagonal"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_straight_left"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_diagonal_left"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_right"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_right_straight"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_right_diagonal"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_straight_right"),
(TrafficLightLabel.TRAFFIC_LIGHT, "red_diagonal_right"),
(TrafficLightLabel.TRAFFIC_LIGHT, "yellow_right"),
(TrafficLightLabel.UNKNOWN, "unknown"),
]
Expand Down

0 comments on commit 007f4f6

Please sign in to comment.