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

refactor: update Tier4 API to avoid runtime errors for irregular data #64

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

ktro2828
Copy link
Collaborator

@ktro2828 ktro2828 commented Dec 4, 2024

What

This PR updates Tier4 API to avoid runtime errors for irregular data as follows:

Case1:

Invalid instance token is contained in object_ann.

Creating data info for scene: 70891309-ca8b-477b-905a-5156ffb3df65
Traceback (most recent call last):
  File "/workspace/tools/detection3d/create_data_t4dataset.py", line 290, in <module>
    main()
  File "/workspace/tools/detection3d/create_data_t4dataset.py", line 263, in main
    t4 = Tier4(
  File "/opt/conda/lib/python3.10/site-packages/t4_devkit/tier4.py", line 128, in __init__
    self.__make_reverse_index__(verbose)
  File "/opt/conda/lib/python3.10/site-packages/t4_devkit/tier4.py", line 189, in __make_reverse_index__
    instance: Instance = self.get("instance", record.instance_token)
  File "/opt/conda/lib/python3.10/site-packages/t4_devkit/tier4.py", line 262, in get
    return self.get_table(schema)[self.get_idx(schema, token)]
  File "/opt/conda/lib/python3.10/site-packages/t4_devkit/tier4.py", line 278, in get_idx
    raise KeyError(f"{token} is not registered in {schema}.")
KeyError: '89338d1d0b3e8ab40b363e4b84cfb7d0 is not registered in instance.'

In order to avoid this case, Tier4 API access category_token directory.

Case2:

Empty category token in assigned to surface_ann.

Reverse indexing...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ktro2828/workspace/t4-devkit/t4_devkit/tier4.py", line 128, in __init__
    self.__make_reverse_index__(verbose)
  File "/home/ktro2828/workspace/t4-devkit/t4_devkit/tier4.py", line 193, in __make_reverse_index__
    category: Category = self.get("category", record.category_token)
  File "/home/ktro2828/workspace/t4-devkit/t4_devkit/tier4.py", line 261, in get
    return self.get_table(schema)[self.get_idx(schema, token)]
  File "/home/ktro2828/workspace/t4-devkit/t4_devkit/tier4.py", line 277, in get_idx
    raise KeyError(f"{token} is not registered in {schema}.")
KeyError: ' is not registered in category.'

In this case, Tier4 API skips to set corresponding category name.

@github-actions github-actions bot added the refactor Refactoring code or increasing performance label Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

☂️ Python Coverage

current status: ❌

Overall Coverage

Lines Covered Coverage Threshold Status
2112 1436 68% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/tier4.py 10% 🔴
TOTAL 10% 🔴

updated for commit: 747f310 by action🐍

@ktro2828 ktro2828 merged commit 697a56a into main Dec 4, 2024
4 of 5 checks passed
@ktro2828 ktro2828 deleted the refactor/objec-ann/use-category-token branch December 4, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring code or increasing performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant