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

feat(annotated_to_deepen): add default attributes #67

Merged
merged 9 commits into from
Dec 27, 2023
50 changes: 49 additions & 1 deletion perception_dataset/rosbag2/autoware_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,52 @@
TrafficSignalArray,
)

DEFAULT_ATTRIBUTES_BY_CATEGORY_NAME: Dict[str, List[str]] = {
"unknown": [
"object_state.still",
"occlusion_state.none",
],
"car": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"truck": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"bus": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"trailer": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"motorcycle": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"bicycle": [
"occlusion_state.none",
"extremities_state.none",
"vehicle_state.driving",
],
"pedestrian": [
"occlusion_state.none",
"extremities_state.none",
"pedestrian_state.standing",
],
"bicycle_without_rider": [],
"motorcycle_without_rider": [],
"personal_mobility_vehicle": [],
"street_asset": [],
}


def semantic_type_to_class_name(semantic_type: int) -> str:
"""https://github.com/tier4/tier4_autoware_msgs/blob/tier4/universe/tier4_perception_msgs/msg/object_recognition/Semantic.msg"""
Expand Down Expand Up @@ -131,7 +177,9 @@ def get_category_name(classification: List[ObjectClassification]) -> str:
label_dict: Dict[str, Any] = {
"category_name": category_name,
"instance_id": str(obj_uuid),
"attribute_names": [], # not available
"attribute_names": DEFAULT_ATTRIBUTES_BY_CATEGORY_NAME[category_name]
if category_name in DEFAULT_ATTRIBUTES_BY_CATEGORY_NAME
else [],
"three_d_bbox": {
"translation": position,
"velocity": velocity,
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tracking_sim_dataset_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_rosbag2_converter_dataset_consistency(t4_dataset_path):
@pytest.mark.parametrize("t4_dataset_path", [True], indirect=True)
def test_attribute_json(t4_dataset_path, attribute_list):
attribute_json = load_json(t4_dataset_path, "attribute")
assert len(attribute_json) == 0, f"attribute_json length is {len(attribute_json)}, expected 0"
assert len(attribute_json) == 3, f"attribute_json length is {len(attribute_json)}, expected 3"
assert len(attribute_json) <= len(
attribute_list
), f"attribute_json length more than {len(attribute_list)}, expected {len(attribute_list), {attribute_list}}"
Expand Down Expand Up @@ -236,7 +236,6 @@ def test_sample_annotation_json(t4_dataset_path):
assert sample_anno["sample_token"], "sample_token is empty"
assert sample_anno["instance_token"], "instance_token is empty"

assert sample_anno["attribute_tokens"] == []
assert sample_anno["visibility_token"], "visibility_token is empty"
assert sample_anno["translation"], "translation is empty"
assert "velocity" in sample_anno.keys(), "sample_annotation must have velocity key"
Expand Down
Loading