From ea2c8811b1aad93f504285dbbc352594f55dce19 Mon Sep 17 00:00:00 2001 From: ktro2828 Date: Thu, 28 Aug 2025 19:44:09 +0900 Subject: [PATCH] feat: add directory path as property Signed-off-by: ktro2828 --- t4_devkit/tier4.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t4_devkit/tier4.py b/t4_devkit/tier4.py index dcb0c70..a4787b0 100644 --- a/t4_devkit/tier4.py +++ b/t4_devkit/tier4.py @@ -95,8 +95,6 @@ def load_metadata(db_root: str, revision: str | None = None) -> DBMetadata: class Tier4: """Database class for T4 dataset to help query and retrieve information from the database.""" - schema_dir: str = "annotation" - def __init__( self, data_root: str, @@ -151,7 +149,7 @@ def __init__( start_time = time.time() if verbose: - print(f"======\nLoading T4 tables in `{self.schema_dir}`...") + print("======\nLoading T4 tables...") # assign tables explicitly self.attribute: list[Attribute] = self.__load_table__(SchemaName.ATTRIBUTE) @@ -214,6 +212,11 @@ def map_dir(self) -> str: """Return the path to map directory.""" return osp.join(self.data_root, "map") + @property + def bag_dir(self) -> str: + """Return the path to ROS bag directory.""" + return osp.join(self.data_root, "input_bag") + def __load_table__(self, schema: SchemaName) -> list[SchemaTable]: """Load schema table from a json file. @@ -226,7 +229,7 @@ def __load_table__(self, schema: SchemaName) -> list[SchemaTable]: Returns: Loaded table data saved in `.json`. """ - filepath = osp.join(self.data_root, self.schema_dir, schema.filename) + filepath = osp.join(self.annotation_dir, schema.filename) if not osp.exists(filepath) and schema.is_optional(): return []