From abcdd36c7f4e6ab6b9f2caa3b5a98096a7ad908b Mon Sep 17 00:00:00 2001 From: ktro2828 Date: Sat, 24 Jan 2026 21:36:55 +0900 Subject: [PATCH 1/2] fix: update schema of surface_ann.json Signed-off-by: ktro2828 --- t4_devkit/schema/tables/surface_ann.py | 16 +++++++++++++++- tests/schema/conftest.py | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/t4_devkit/schema/tables/surface_ann.py b/t4_devkit/schema/tables/surface_ann.py index eb19dc13..428d02f3 100644 --- a/t4_devkit/schema/tables/surface_ann.py +++ b/t4_devkit/schema/tables/surface_ann.py @@ -23,7 +23,9 @@ class SurfaceAnn(SchemaBase, AutolabelMixin): token (str): Unique record identifier. sample_data_token (str): Foreign key pointing to the sample data, which must be a keyframe image. category_token (str): Foreign key pointing to the surface category. - mask (RLEMask): Segmentation mask using the COCO format compressed by RLE. + instance_token (str | None, optional): Foreign key pointing to the instance category. + attribute_tokens (list[str], optional): Foreign keys pointing to the attribute categories. + mask (RLEMask | None, optional): Segmentation mask using the COCO format compressed by RLE. Inherited from AutolabelMixin: automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model. @@ -37,6 +39,18 @@ class SurfaceAnn(SchemaBase, AutolabelMixin): sample_data_token: str = field(validator=(validators.instance_of(str), impossible_empty())) category_token: str = field(validator=(validators.instance_of(str), impossible_empty())) + instance_token: str | None = field( + default=None, + validator=validators.optional( + validators.and_(validators.instance_of(str), impossible_empty()) + ), + ) + attribute_tokens: list[str] = field( + factory=list, + validator=validators.deep_iterable( + validators.and_(validators.instance_of(str), impossible_empty()) + ), + ) mask: RLEMask | None = field( default=None, converter=lambda x: RLEMask(**x) if isinstance(x, dict) else x, diff --git a/tests/schema/conftest.py b/tests/schema/conftest.py index 7511c473..56a5586b 100644 --- a/tests/schema/conftest.py +++ b/tests/schema/conftest.py @@ -365,6 +365,8 @@ def surface_ann_dict() -> dict: "token": "4230e00708fb3f404d246ea97716f848", "sample_data_token": "a1d3257e11ec9d4a587ea7053b33f1c1", "category_token": "7864884179fb37bf9e973016b13a332c", + "instance_token": None, + "attribute_tokens": [], "mask": {"size": [1920, 1280], "counts": "UFBQWzI='"}, "automatic_annotation": False, "autolabel_metadata": None, From 612fd15e48b0f9d0a3127fc2485c5d058067568d Mon Sep 17 00:00:00 2001 From: ktro2828 Date: Sun, 25 Jan 2026 14:07:29 +0900 Subject: [PATCH 2/2] docs: update document Signed-off-by: ktro2828 --- docs/schema/table.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/schema/table.md b/docs/schema/table.md index 7deb593c..4df8c599 100644 --- a/docs/schema/table.md +++ b/docs/schema/table.md @@ -13,7 +13,7 @@ | `enum[X,Y,...]` | Enumerated type with possible values X, Y, ... | | `[T;N]` | Array of N elements of type T | | `[T;N,M,...]` | Array of type T with N, M, or other specified number of elements | -| `option[T]` | Optional value of type T | +| `option[T]` | Optional value of type T by default `None` | ### Special Types @@ -382,7 +382,9 @@ surface_ann { "token": -- Unique record identifier. "sample_data_token": -- Foreign key to the `SampleData` table associated with the sample data. "category_token": -- Foreign key to the `Category` table associated with the category of the surface. - "mask": -- Run length encoding of instance mask. + "instance_token": -- Foreign key to the `Instance` table associated with the instance of the surface. + "attribute_tokens": -- Foreign keys to the `Attribute` table associated with the attributes of the surface. Defaults to `[]`. + "mask": -- Run length encoding of instance mask. "automatic_annotation": -- Whether the annotation was automatically generated. Defaults to `false`. "autolabel_metadata": -- List of models used for autolabeling. Required if `automatic_annotation` is `true`. }