Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 30, 2024
1 parent fa360db commit 3f5f471
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion perception_dataset/deepen/deepen_to_t4_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
)
from perception_dataset.rosbag2.rosbag2_converter import Rosbag2Converter
from perception_dataset.t4_dataset.annotation_files_generator import AnnotationFilesGenerator
from perception_dataset.t4_dataset.resolver.keyframe_consistency_resolver import KeyFrameConsistencyResolver
from perception_dataset.t4_dataset.resolver.keyframe_consistency_resolver import (
KeyFrameConsistencyResolver,
)
from perception_dataset.utils.logger import configure_logger
import perception_dataset.utils.misc as misc_utils

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ def convert(self) -> None:
raise ValueError("If you want to overwrite files, use --overwrite option.")

# Start updating annotations
annotation_files_updater = AnnotationFilesUpdater(description=self._description, surface_categories=self._surface_categories)
annotation_files_updater = AnnotationFilesUpdater(
description=self._description, surface_categories=self._surface_categories
)
annotation_files_updater.convert_one_scene(
input_dir=input_dir,
output_dir=output_dir,
scene_anno_dict=fl_annotations[t4dataset_name],
dataset_name=t4dataset_name,
)
logger.info(f"Finished updating annotations for {t4dataset_name}")

4 changes: 1 addition & 3 deletions perception_dataset/t4_dataset/annotation_files_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ def convert_one_scene(
prev_wid_hgt: Tuple = (0, 0)
# NOTE: num_cameras is always 6, because it is hard coded above.
for frame_index_nuim, sample_nuim in enumerate(nuim.sample_data):
if (
sample_nuim["fileformat"] == "png" or sample_nuim["fileformat"] == "jpg"
):
if sample_nuim["fileformat"] == "png" or sample_nuim["fileformat"] == "jpg":
cam = sample_nuim["filename"].split("/")[1]
cam_idx = self._camera2idx[cam]

Expand Down
13 changes: 10 additions & 3 deletions perception_dataset/t4_dataset/annotation_files_updater.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from pathlib import Path
import os.path as osp
from pathlib import Path
from typing import Any, Dict, List

from perception_dataset.t4_dataset.annotation_files_generator import AnnotationFilesGenerator
Expand All @@ -13,7 +13,9 @@
SurfaceAnnTable,
VisibilityTable,
)
from perception_dataset.t4_dataset.resolver.keyframe_consistency_resolver import KeyFrameConsistencyResolver
from perception_dataset.t4_dataset.resolver.keyframe_consistency_resolver import (
KeyFrameConsistencyResolver,
)


def _load_json(filepath: str) -> Any:
Expand All @@ -23,7 +25,12 @@ def _load_json(filepath: str) -> Any:


class AnnotationFilesUpdater(AnnotationFilesGenerator):
def __init__(self, with_camera: bool = True, description: Dict[str, Dict[str, str]] = ..., surface_categories: List[str] = []):
def __init__(
self,
with_camera: bool = True,
description: Dict[str, Dict[str, str]] = ...,
surface_categories: List[str] = [],
):
super().__init__(with_camera, description, surface_categories)
self.description = description

Expand Down

0 comments on commit 3f5f471

Please sign in to comment.