fix(sanity): pass if the reference token is empty string#240
Conversation
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
There was a problem hiding this comment.
Pull request overview
This PR fixes the reference validation logic to properly handle empty string reference tokens in T4 datasets that only contain 2D annotations. When a dataset lacks 3D annotations, first_annotation_token and last_annotation_token fields are legitimately empty strings, and should not be flagged as missing references.
Key changes:
- Modified the reference check in
base.pyto treat empty string reference tokens as valid, preventing false positive validation failures.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
|
@SamratThapa120 Let me just confirm!
As far as I explored, tier4_perception_dataset/AnnotationFileGenerator generate references from an instance record to the first and last annotation records only for 3D annotations, not for 2D. We can update generator as follows, but it cause conflicts if the dataset contains both 3D and 2D. Then, I think we should define tha |
shekharhimanshu
left a comment
There was a problem hiding this comment.
Thank you for the fix. LGTM! 💯
What
This pull request introduces a minor adjustment to the reference check logic in
base.py. The change ensures that records with an empty string as the reference token are not flagged as missing, improving the accuracy of the sanity check.checkmethod int4_devkit/sanity/reference/base.pyto skip records where the reference token is an empty string, treating them as successful matches.Usecase
If the T4 dataset contains only 2D annotations (
object_annotation.json), bothfirst_annotation_tokenandlast_annotation_tokenwill be empty string"", although instance records are generated.Therefore,
fist_annotation_tokenandlast_annotation_tokenshould be the reference tosample_annotation.json.How PR Tested?
Parent Link (TIER IV INTERNAL)
Sample Dataset Link (TIER IV INTERNAL)
Before
REF010: - No reference to 'instance.first_annotation_token': - No reference to 'instance.first_annotation_token': REF011: - No reference to 'instance.last_annotation_token': - No reference to 'instance.last_annotation_token': +--------------------------------------+---------+--------+--------+---------+----------+ | DatasetID | Version | Passed | Failed | Skipped | Warnings | +--------------------------------------+---------+--------+--------+---------+----------+ | 471a3751-dac2-451e-9421-552975d50272 | | 47 | 2 | 2 | 4 | +--------------------------------------+---------+--------+--------+---------+----------+