Skip to content

fix: Fix an error when converting null masks in object_ann and surface_ann#143

Merged
ktro2828 merged 8 commits into
tier4:mainfrom
KSeangTan:fix/fix_non_mask
May 15, 2025
Merged

fix: Fix an error when converting null masks in object_ann and surface_ann#143
ktro2828 merged 8 commits into
tier4:mainfrom
KSeangTan:fix/fix_non_mask

Conversation

@KSeangTan

Copy link
Copy Markdown
Contributor

The validator will fail when our mask value is null, this PR fixes that by allowing passing None valueinmask`.

@KSeangTan

Copy link
Copy Markdown
Contributor Author

Hi @ktro2828

It seems that I dont have the permission to add reviewers in this PR. Would you mind taking a look? Thanks

@KSeangTan KSeangTan changed the title fixt: Fix an error when converting null masks in T4dataset fixt: Fix an error when converting null masks in object_ann ans surface_ann May 13, 2025
@KSeangTan KSeangTan changed the title fixt: Fix an error when converting null masks in object_ann ans surface_ann fixt: Fix an error when converting null masks in object_ann and surface_ann May 13, 2025
@ktro2828 ktro2828 self-requested a review May 13, 2025 15:00

@ktro2828 ktro2828 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching!

Could you also update SurfaceAnn.bbox for the case of mask=None?

@property
def bbox(self) -> RoiLike:
"""Return a bounding box corners calculated from polygon vertices.
Returns:
Given as [xmin, ymin, xmax, ymax].
"""
mask = self.mask.decode()
indices = np.where(mask == 1)
xmin, ymin = np.min(indices, axis=1)
xmax, ymax = np.max(indices, axis=1)
return xmin, ymin, xmax, ymax

def bbox(...) -> RoiLike | None:
    if mask is None:
        return None
    # ...

Comment thread t4_devkit/schema/tables/object_ann.py Outdated
Comment thread t4_devkit/schema/tables/surface_ann.py Outdated
@ktro2828

Copy link
Copy Markdown
Collaborator

@KSeangTan Also, do you know the database version of the corresponding dataset? Is the latest or old one?

@KSeangTan

Copy link
Copy Markdown
Contributor Author

Hi @ktro2828

It's the older database, one of the example is
db_jpntaxi_v1/70891309-ca8b-477b-905a-5156ffb3df65

@ktro2828 ktro2828 changed the title fixt: Fix an error when converting null masks in object_ann and surface_ann fix: Fix an error when converting null masks in object_ann and surface_ann May 14, 2025

@ktro2828 ktro2828 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KSeangTan Could fix CI failure in pre-commit?

@KSeangTan

Copy link
Copy Markdown
Contributor Author

Hi @ktro2828
I have resolved the pre-commit errors, would you mind proceeding with the merging? Thanks

@ktro2828 ktro2828 merged commit 757f6b4 into tier4:main May 15, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants