From 697a56adc5071855985af36d2d980a4b88c4046e Mon Sep 17 00:00:00 2001 From: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:39:45 +0900 Subject: [PATCH] refactor: update Tier4 API to avoid runtime errors for irregular data (#64) Signed-off-by: ktro2828 --- t4_devkit/tier4.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t4_devkit/tier4.py b/t4_devkit/tier4.py index 54dde33..eba797f 100644 --- a/t4_devkit/tier4.py +++ b/t4_devkit/tier4.py @@ -186,11 +186,12 @@ def __make_reverse_index__(self, verbose: bool) -> None: record.category_name = category.name for record in self.object_ann: - instance: Instance = self.get("instance", record.instance_token) - category: Category = self.get("category", instance.category_token) + category: Category = self.get("category", record.category_token) record.category_name = category.name for record in self.surface_ann: + if record.category_token == "": # NOTE: Some database contains this case + continue category: Category = self.get("category", record.category_token) record.category_name = category.name