Skip to content

Commit 553864e

Browse files
authored
Merge pull request #127 from kurusugawa-computer/add-full-annotation-dataclass
`FullAnnotationData`の詳細なクラスを追加
2 parents 4b39089 + 465e287 commit 553864e

File tree

3 files changed

+103
-2
lines changed

3 files changed

+103
-2
lines changed

annofabapi/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.27.3'
1+
__version__ = '0.27.4'

annofabapi/dataclass/annotation.py

+94
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,100 @@ class Point:
3535
""""""
3636

3737

38+
@dataclass_json
39+
@dataclass
40+
class FullAnnotationDataClassification:
41+
"""
42+
43+
"""
44+
type: str
45+
"""Classification"""
46+
47+
48+
@dataclass_json
49+
@dataclass
50+
class FullAnnotationDataSegmentation:
51+
"""
52+
塗っていないところは rgba(0,0,0,0)、塗ったところは rgba(255,255,255,1) の PNGデータをBase64エンコードしたもの。
53+
"""
54+
data_uri: str
55+
""""""
56+
57+
type: str
58+
"""Segmentation"""
59+
60+
61+
@dataclass_json
62+
@dataclass
63+
class FullAnnotationDataSegmentationV2:
64+
"""
65+
66+
"""
67+
data_uri: str
68+
""""""
69+
70+
type: str
71+
"""SegmentationV2"""
72+
73+
74+
@dataclass_json
75+
@dataclass
76+
class FullAnnotationDataBoundingBox:
77+
"""
78+
annotation_type が bounding_boxの場合に、[左上頂点座標, 右下頂点座標]を {\"x\":int, \"y\":int} の形式で記述したもの。
79+
"""
80+
left_top: Point
81+
""""""
82+
83+
right_bottom: Point
84+
""""""
85+
86+
type: str
87+
"""BoundingBox"""
88+
89+
90+
@dataclass_json
91+
@dataclass
92+
class FullAnnotationDataPoints:
93+
"""
94+
頂点座標 {\"x\":int, \"y\":int} の配列。 * annotation_type が polygon/polyline の場合: ポリゴン/ポリラインを構成する頂点の配列。
95+
"""
96+
points: List[Point]
97+
""""""
98+
99+
type: str
100+
"""Points"""
101+
102+
103+
@dataclass_json
104+
@dataclass
105+
class FullAnnotationDataSinglePoint:
106+
"""
107+
annotation_type が pointの場合。
108+
"""
109+
point: Point
110+
""""""
111+
112+
type: str
113+
"""SinglePoint。"""
114+
115+
116+
@dataclass_json
117+
@dataclass
118+
class FullAnnotationDataRange:
119+
"""
120+
annotation_type が rangeの場合に、[開始時間, 終了時間]を {\"begin\":number, \"end\":number} の形式で記述したもの。開始時間・終了時間の単位は秒で、精度はミリ秒まで。
121+
"""
122+
begin: float
123+
"""開始時間(ミリ秒)。小数点以下はミリ秒以下を表します。"""
124+
125+
end: float
126+
"""終了時間(ミリ秒)。小数点以下はミリ秒以下を表します。"""
127+
128+
type: str
129+
"""Range"""
130+
131+
38132
@dataclass_json
39133
@dataclass
40134
class AdditionalData:

generate/generate.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ MODELS_DIR=out/openapi_client/models
116116

117117
# Annotation
118118
declare -a model_files=(${MODELS_DIR}/point.py \
119+
${MODELS_DIR}/full_annotation_data_classification.py \
120+
${MODELS_DIR}/full_annotation_data_segmentation.py \
121+
${MODELS_DIR}/full_annotation_data_segmentation_v2.py \
122+
${MODELS_DIR}/full_annotation_data_bounding_box.py \
123+
${MODELS_DIR}/full_annotation_data_points.py \
124+
${MODELS_DIR}/full_annotation_data_single_point.py \
125+
${MODELS_DIR}/full_annotation_data_range.py \
119126
${MODELS_DIR}/additional_data.py \
120127
${MODELS_DIR}/full_annotation_additional_data.py \
121128
${MODELS_DIR}/full_annotation_detail.py \
@@ -124,7 +131,7 @@ declare -a model_files=(${MODELS_DIR}/point.py \
124131
${MODELS_DIR}/simple_annotation.py \
125132
${MODELS_DIR}/single_annotation_detail.py \
126133
${MODELS_DIR}/single_annotation.py \
127-
${MODELS_DIR}/annotation_detail.
134+
${MODELS_DIR}/annotation_detail.py \
128135
${MODELS_DIR}/annotation.py \
129136
)
130137
cat partial-header/dataclass/common.py partial-header/dataclass/annotation.py \

0 commit comments

Comments
 (0)