denkproto 1.0.50__py3-none-any.whl → 1.0.55__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of denkproto might be problematic. Click here for more details.
- denkproto/__about__.py +1 -1
- denkproto/json/__init__.py +0 -0
- denkproto/json/classification_markup.py +90 -0
- denkproto/json/object_detection_markup.py +153 -0
- denkproto/json/ocr_markup.py +193 -0
- denkproto/json/segmentation_markup.py +526 -0
- denkproto/modelfile_v2_pb2.py +22 -22
- denkproto/modelfile_v2_pb2.pyi +4 -2
- {denkproto-1.0.50.dist-info → denkproto-1.0.55.dist-info}/METADATA +1 -1
- {denkproto-1.0.50.dist-info → denkproto-1.0.55.dist-info}/RECORD +11 -6
- {denkproto-1.0.50.dist-info → denkproto-1.0.55.dist-info}/WHEEL +0 -0
denkproto/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.55"
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from uuid import UUID
|
|
2
|
+
from typing import Any, List, TypeVar, Callable, Type, cast
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def from_float(x: Any) -> float:
|
|
9
|
+
assert isinstance(x, (float, int)) and not isinstance(x, bool)
|
|
10
|
+
return float(x)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def to_float(x: Any) -> float:
|
|
14
|
+
assert isinstance(x, (int, float))
|
|
15
|
+
return x
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
|
|
19
|
+
assert isinstance(x, list)
|
|
20
|
+
return [f(y) for y in x]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def from_int(x: Any) -> int:
|
|
24
|
+
assert isinstance(x, int) and not isinstance(x, bool)
|
|
25
|
+
return x
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def to_class(c: Type[T], x: Any) -> dict:
|
|
29
|
+
assert isinstance(x, c)
|
|
30
|
+
return cast(Any, x).to_dict()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Annotation:
|
|
34
|
+
id: UUID
|
|
35
|
+
label_id: UUID
|
|
36
|
+
value: float
|
|
37
|
+
|
|
38
|
+
def __init__(self, id: UUID, label_id: UUID, value: float) -> None:
|
|
39
|
+
self.id = id
|
|
40
|
+
self.label_id = label_id
|
|
41
|
+
self.value = value
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def from_dict(obj: Any) -> 'Annotation':
|
|
45
|
+
assert isinstance(obj, dict)
|
|
46
|
+
id = UUID(obj.get("id"))
|
|
47
|
+
label_id = UUID(obj.get("label_id"))
|
|
48
|
+
value = from_float(obj.get("value"))
|
|
49
|
+
return Annotation(id, label_id, value)
|
|
50
|
+
|
|
51
|
+
def to_dict(self) -> dict:
|
|
52
|
+
result: dict = {}
|
|
53
|
+
result["id"] = str(self.id)
|
|
54
|
+
result["label_id"] = str(self.label_id)
|
|
55
|
+
result["value"] = to_float(self.value)
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ClassificationMarkup:
|
|
60
|
+
annotations: List[Annotation]
|
|
61
|
+
height: int
|
|
62
|
+
width: int
|
|
63
|
+
|
|
64
|
+
def __init__(self, annotations: List[Annotation], height: int, width: int) -> None:
|
|
65
|
+
self.annotations = annotations
|
|
66
|
+
self.height = height
|
|
67
|
+
self.width = width
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def from_dict(obj: Any) -> 'ClassificationMarkup':
|
|
71
|
+
assert isinstance(obj, dict)
|
|
72
|
+
annotations = from_list(Annotation.from_dict, obj.get("annotations"))
|
|
73
|
+
height = from_int(obj.get("height"))
|
|
74
|
+
width = from_int(obj.get("width"))
|
|
75
|
+
return ClassificationMarkup(annotations, height, width)
|
|
76
|
+
|
|
77
|
+
def to_dict(self) -> dict:
|
|
78
|
+
result: dict = {}
|
|
79
|
+
result["annotations"] = from_list(lambda x: to_class(Annotation, x), self.annotations)
|
|
80
|
+
result["height"] = from_int(self.height)
|
|
81
|
+
result["width"] = from_int(self.width)
|
|
82
|
+
return result
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def classification_markup_from_dict(s: Any) -> ClassificationMarkup:
|
|
86
|
+
return ClassificationMarkup.from_dict(s)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def classification_markup_to_dict(x: ClassificationMarkup) -> Any:
|
|
90
|
+
return to_class(ClassificationMarkup, x)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Optional, Any, List, TypeVar, Type, Callable, cast
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
T = TypeVar("T")
|
|
7
|
+
EnumT = TypeVar("EnumT", bound=Enum)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def from_float(x: Any) -> float:
|
|
11
|
+
assert isinstance(x, (float, int)) and not isinstance(x, bool)
|
|
12
|
+
return float(x)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def from_none(x: Any) -> Any:
|
|
16
|
+
assert x is None
|
|
17
|
+
return x
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def from_union(fs, x):
|
|
21
|
+
for f in fs:
|
|
22
|
+
try:
|
|
23
|
+
return f(x)
|
|
24
|
+
except:
|
|
25
|
+
pass
|
|
26
|
+
assert False
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def from_bool(x: Any) -> bool:
|
|
30
|
+
assert isinstance(x, bool)
|
|
31
|
+
return x
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def to_float(x: Any) -> float:
|
|
35
|
+
assert isinstance(x, (int, float))
|
|
36
|
+
return x
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_enum(c: Type[EnumT], x: Any) -> EnumT:
|
|
40
|
+
assert isinstance(x, c)
|
|
41
|
+
return x.value
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
|
|
45
|
+
assert isinstance(x, list)
|
|
46
|
+
return [f(y) for y in x]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def from_int(x: Any) -> int:
|
|
50
|
+
assert isinstance(x, int) and not isinstance(x, bool)
|
|
51
|
+
return x
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_class(c: Type[T], x: Any) -> dict:
|
|
55
|
+
assert isinstance(x, c)
|
|
56
|
+
return cast(Any, x).to_dict()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AnnotationType(Enum):
|
|
60
|
+
IGNORE = "IGNORE"
|
|
61
|
+
NEGATIVE = "NEGATIVE"
|
|
62
|
+
POSITIVE = "POSITIVE"
|
|
63
|
+
ROI = "ROI"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Annotation:
|
|
67
|
+
angle: Optional[float]
|
|
68
|
+
annotation_type: AnnotationType
|
|
69
|
+
average_width: float
|
|
70
|
+
bottom_right_x: float
|
|
71
|
+
bottom_right_y: float
|
|
72
|
+
full_orientation: Optional[bool]
|
|
73
|
+
id: UUID
|
|
74
|
+
label_id: UUID
|
|
75
|
+
top_left_x: float
|
|
76
|
+
top_left_y: float
|
|
77
|
+
|
|
78
|
+
def __init__(self, angle: Optional[float], annotation_type: AnnotationType, average_width: float, bottom_right_x: float, bottom_right_y: float, full_orientation: Optional[bool], id: UUID, label_id: UUID, top_left_x: float, top_left_y: float) -> None:
|
|
79
|
+
self.angle = angle
|
|
80
|
+
self.annotation_type = annotation_type
|
|
81
|
+
self.average_width = average_width
|
|
82
|
+
self.bottom_right_x = bottom_right_x
|
|
83
|
+
self.bottom_right_y = bottom_right_y
|
|
84
|
+
self.full_orientation = full_orientation
|
|
85
|
+
self.id = id
|
|
86
|
+
self.label_id = label_id
|
|
87
|
+
self.top_left_x = top_left_x
|
|
88
|
+
self.top_left_y = top_left_y
|
|
89
|
+
|
|
90
|
+
@staticmethod
|
|
91
|
+
def from_dict(obj: Any) -> 'Annotation':
|
|
92
|
+
assert isinstance(obj, dict)
|
|
93
|
+
angle = from_union([from_float, from_none], obj.get("angle"))
|
|
94
|
+
annotation_type = AnnotationType(obj.get("annotation_type"))
|
|
95
|
+
average_width = from_float(obj.get("average_width"))
|
|
96
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
97
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
98
|
+
full_orientation = from_union([from_bool, from_none], obj.get("full_orientation"))
|
|
99
|
+
id = UUID(obj.get("id"))
|
|
100
|
+
label_id = UUID(obj.get("label_id"))
|
|
101
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
102
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
103
|
+
return Annotation(angle, annotation_type, average_width, bottom_right_x, bottom_right_y, full_orientation, id, label_id, top_left_x, top_left_y)
|
|
104
|
+
|
|
105
|
+
def to_dict(self) -> dict:
|
|
106
|
+
result: dict = {}
|
|
107
|
+
if self.angle is not None:
|
|
108
|
+
result["angle"] = from_union([to_float, from_none], self.angle)
|
|
109
|
+
result["annotation_type"] = to_enum(AnnotationType, self.annotation_type)
|
|
110
|
+
result["average_width"] = to_float(self.average_width)
|
|
111
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
112
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
113
|
+
if self.full_orientation is not None:
|
|
114
|
+
result["full_orientation"] = from_union([from_bool, from_none], self.full_orientation)
|
|
115
|
+
result["id"] = str(self.id)
|
|
116
|
+
result["label_id"] = str(self.label_id)
|
|
117
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
118
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
119
|
+
return result
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ObjectDetectionMarkup:
|
|
123
|
+
annotations: List[Annotation]
|
|
124
|
+
height: int
|
|
125
|
+
width: int
|
|
126
|
+
|
|
127
|
+
def __init__(self, annotations: List[Annotation], height: int, width: int) -> None:
|
|
128
|
+
self.annotations = annotations
|
|
129
|
+
self.height = height
|
|
130
|
+
self.width = width
|
|
131
|
+
|
|
132
|
+
@staticmethod
|
|
133
|
+
def from_dict(obj: Any) -> 'ObjectDetectionMarkup':
|
|
134
|
+
assert isinstance(obj, dict)
|
|
135
|
+
annotations = from_list(Annotation.from_dict, obj.get("annotations"))
|
|
136
|
+
height = from_int(obj.get("height"))
|
|
137
|
+
width = from_int(obj.get("width"))
|
|
138
|
+
return ObjectDetectionMarkup(annotations, height, width)
|
|
139
|
+
|
|
140
|
+
def to_dict(self) -> dict:
|
|
141
|
+
result: dict = {}
|
|
142
|
+
result["annotations"] = from_list(lambda x: to_class(Annotation, x), self.annotations)
|
|
143
|
+
result["height"] = from_int(self.height)
|
|
144
|
+
result["width"] = from_int(self.width)
|
|
145
|
+
return result
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def object_detection_markup_from_dict(s: Any) -> ObjectDetectionMarkup:
|
|
149
|
+
return ObjectDetectionMarkup.from_dict(s)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def object_detection_markup_to_dict(x: ObjectDetectionMarkup) -> Any:
|
|
153
|
+
return to_class(ObjectDetectionMarkup, x)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from typing import Any, List, Optional, TypeVar, Callable, Type, cast
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def from_float(x: Any) -> float:
|
|
9
|
+
assert isinstance(x, (float, int)) and not isinstance(x, bool)
|
|
10
|
+
return float(x)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def to_float(x: Any) -> float:
|
|
14
|
+
assert isinstance(x, (int, float))
|
|
15
|
+
return x
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
|
|
19
|
+
assert isinstance(x, list)
|
|
20
|
+
return [f(y) for y in x]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def to_class(c: Type[T], x: Any) -> dict:
|
|
24
|
+
assert isinstance(x, c)
|
|
25
|
+
return cast(Any, x).to_dict()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def from_none(x: Any) -> Any:
|
|
29
|
+
assert x is None
|
|
30
|
+
return x
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def from_union(fs, x):
|
|
34
|
+
for f in fs:
|
|
35
|
+
try:
|
|
36
|
+
return f(x)
|
|
37
|
+
except:
|
|
38
|
+
pass
|
|
39
|
+
assert False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def from_str(x: Any) -> str:
|
|
43
|
+
assert isinstance(x, str)
|
|
44
|
+
return x
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def from_int(x: Any) -> int:
|
|
48
|
+
assert isinstance(x, int) and not isinstance(x, bool)
|
|
49
|
+
return x
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class BoundingBox:
|
|
53
|
+
bottom_right_x: float
|
|
54
|
+
bottom_right_y: float
|
|
55
|
+
top_left_x: float
|
|
56
|
+
top_left_y: float
|
|
57
|
+
|
|
58
|
+
def __init__(self, bottom_right_x: float, bottom_right_y: float, top_left_x: float, top_left_y: float) -> None:
|
|
59
|
+
self.bottom_right_x = bottom_right_x
|
|
60
|
+
self.bottom_right_y = bottom_right_y
|
|
61
|
+
self.top_left_x = top_left_x
|
|
62
|
+
self.top_left_y = top_left_y
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def from_dict(obj: Any) -> 'BoundingBox':
|
|
66
|
+
assert isinstance(obj, dict)
|
|
67
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
68
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
69
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
70
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
71
|
+
return BoundingBox(bottom_right_x, bottom_right_y, top_left_x, top_left_y)
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> dict:
|
|
74
|
+
result: dict = {}
|
|
75
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
76
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
77
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
78
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
79
|
+
return result
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class Point:
|
|
83
|
+
x: float
|
|
84
|
+
y: float
|
|
85
|
+
|
|
86
|
+
def __init__(self, x: float, y: float) -> None:
|
|
87
|
+
self.x = x
|
|
88
|
+
self.y = y
|
|
89
|
+
|
|
90
|
+
@staticmethod
|
|
91
|
+
def from_dict(obj: Any) -> 'Point':
|
|
92
|
+
assert isinstance(obj, dict)
|
|
93
|
+
x = from_float(obj.get("x"))
|
|
94
|
+
y = from_float(obj.get("y"))
|
|
95
|
+
return Point(x, y)
|
|
96
|
+
|
|
97
|
+
def to_dict(self) -> dict:
|
|
98
|
+
result: dict = {}
|
|
99
|
+
result["x"] = to_float(self.x)
|
|
100
|
+
result["y"] = to_float(self.y)
|
|
101
|
+
return result
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Polygon:
|
|
105
|
+
points: List[Point]
|
|
106
|
+
|
|
107
|
+
def __init__(self, points: List[Point]) -> None:
|
|
108
|
+
self.points = points
|
|
109
|
+
|
|
110
|
+
@staticmethod
|
|
111
|
+
def from_dict(obj: Any) -> 'Polygon':
|
|
112
|
+
assert isinstance(obj, dict)
|
|
113
|
+
points = from_list(Point.from_dict, obj.get("points"))
|
|
114
|
+
return Polygon(points)
|
|
115
|
+
|
|
116
|
+
def to_dict(self) -> dict:
|
|
117
|
+
result: dict = {}
|
|
118
|
+
result["points"] = from_list(lambda x: to_class(Point, x), self.points)
|
|
119
|
+
return result
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class Annotation:
|
|
123
|
+
bounding_box: Optional[BoundingBox]
|
|
124
|
+
id: UUID
|
|
125
|
+
label_id: UUID
|
|
126
|
+
polygon: Optional[Polygon]
|
|
127
|
+
text: str
|
|
128
|
+
|
|
129
|
+
def __init__(self, bounding_box: Optional[BoundingBox], id: UUID, label_id: UUID, polygon: Optional[Polygon], text: str) -> None:
|
|
130
|
+
self.bounding_box = bounding_box
|
|
131
|
+
self.id = id
|
|
132
|
+
self.label_id = label_id
|
|
133
|
+
self.polygon = polygon
|
|
134
|
+
self.text = text
|
|
135
|
+
|
|
136
|
+
@staticmethod
|
|
137
|
+
def from_dict(obj: Any) -> 'Annotation':
|
|
138
|
+
assert isinstance(obj, dict)
|
|
139
|
+
bounding_box = from_union([BoundingBox.from_dict, from_none], obj.get("bounding_box"))
|
|
140
|
+
id = UUID(obj.get("id"))
|
|
141
|
+
label_id = UUID(obj.get("label_id"))
|
|
142
|
+
polygon = from_union([Polygon.from_dict, from_none], obj.get("polygon"))
|
|
143
|
+
text = from_str(obj.get("text"))
|
|
144
|
+
return Annotation(bounding_box, id, label_id, polygon, text)
|
|
145
|
+
|
|
146
|
+
def to_dict(self) -> dict:
|
|
147
|
+
result: dict = {}
|
|
148
|
+
if self.bounding_box is not None:
|
|
149
|
+
result["bounding_box"] = from_union([lambda x: to_class(BoundingBox, x), from_none], self.bounding_box)
|
|
150
|
+
result["id"] = str(self.id)
|
|
151
|
+
result["label_id"] = str(self.label_id)
|
|
152
|
+
if self.polygon is not None:
|
|
153
|
+
result["polygon"] = from_union([lambda x: to_class(Polygon, x), from_none], self.polygon)
|
|
154
|
+
result["text"] = from_str(self.text)
|
|
155
|
+
return result
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class OcrMarkup:
|
|
159
|
+
annotations: List[Annotation]
|
|
160
|
+
average_object_widths: List[float]
|
|
161
|
+
height: int
|
|
162
|
+
width: int
|
|
163
|
+
|
|
164
|
+
def __init__(self, annotations: List[Annotation], average_object_widths: List[float], height: int, width: int) -> None:
|
|
165
|
+
self.annotations = annotations
|
|
166
|
+
self.average_object_widths = average_object_widths
|
|
167
|
+
self.height = height
|
|
168
|
+
self.width = width
|
|
169
|
+
|
|
170
|
+
@staticmethod
|
|
171
|
+
def from_dict(obj: Any) -> 'OcrMarkup':
|
|
172
|
+
assert isinstance(obj, dict)
|
|
173
|
+
annotations = from_list(Annotation.from_dict, obj.get("annotations"))
|
|
174
|
+
average_object_widths = from_list(from_float, obj.get("average_object_widths"))
|
|
175
|
+
height = from_int(obj.get("height"))
|
|
176
|
+
width = from_int(obj.get("width"))
|
|
177
|
+
return OcrMarkup(annotations, average_object_widths, height, width)
|
|
178
|
+
|
|
179
|
+
def to_dict(self) -> dict:
|
|
180
|
+
result: dict = {}
|
|
181
|
+
result["annotations"] = from_list(lambda x: to_class(Annotation, x), self.annotations)
|
|
182
|
+
result["average_object_widths"] = from_list(to_float, self.average_object_widths)
|
|
183
|
+
result["height"] = from_int(self.height)
|
|
184
|
+
result["width"] = from_int(self.width)
|
|
185
|
+
return result
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def ocr_markup_from_dict(s: Any) -> OcrMarkup:
|
|
189
|
+
return OcrMarkup.from_dict(s)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def ocr_markup_to_dict(x: OcrMarkup) -> Any:
|
|
193
|
+
return to_class(OcrMarkup, x)
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Any, List, Optional, TypeVar, Callable, Type, cast
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
T = TypeVar("T")
|
|
7
|
+
EnumT = TypeVar("EnumT", bound=Enum)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def from_float(x: Any) -> float:
|
|
11
|
+
assert isinstance(x, (float, int)) and not isinstance(x, bool)
|
|
12
|
+
return float(x)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def to_float(x: Any) -> float:
|
|
16
|
+
assert isinstance(x, (int, float))
|
|
17
|
+
return x
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def from_str(x: Any) -> str:
|
|
21
|
+
assert isinstance(x, str)
|
|
22
|
+
return x
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
|
|
26
|
+
assert isinstance(x, list)
|
|
27
|
+
return [f(y) for y in x]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def from_int(x: Any) -> int:
|
|
31
|
+
assert isinstance(x, int) and not isinstance(x, bool)
|
|
32
|
+
return x
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def to_class(c: Type[T], x: Any) -> dict:
|
|
36
|
+
assert isinstance(x, c)
|
|
37
|
+
return cast(Any, x).to_dict()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def from_none(x: Any) -> Any:
|
|
41
|
+
assert x is None
|
|
42
|
+
return x
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def from_union(fs, x):
|
|
46
|
+
for f in fs:
|
|
47
|
+
try:
|
|
48
|
+
return f(x)
|
|
49
|
+
except:
|
|
50
|
+
pass
|
|
51
|
+
assert False
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_enum(c: Type[EnumT], x: Any) -> EnumT:
|
|
55
|
+
assert isinstance(x, c)
|
|
56
|
+
return x.value
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AnnotationType(Enum):
|
|
60
|
+
IGNORE = "IGNORE"
|
|
61
|
+
NEGATIVE = "NEGATIVE"
|
|
62
|
+
POSITIVE = "POSITIVE"
|
|
63
|
+
ROI = "ROI"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CircleAnnotation:
|
|
67
|
+
center_x: float
|
|
68
|
+
center_y: float
|
|
69
|
+
radius: float
|
|
70
|
+
|
|
71
|
+
def __init__(self, center_x: float, center_y: float, radius: float) -> None:
|
|
72
|
+
self.center_x = center_x
|
|
73
|
+
self.center_y = center_y
|
|
74
|
+
self.radius = radius
|
|
75
|
+
|
|
76
|
+
@staticmethod
|
|
77
|
+
def from_dict(obj: Any) -> 'CircleAnnotation':
|
|
78
|
+
assert isinstance(obj, dict)
|
|
79
|
+
center_x = from_float(obj.get("center_x"))
|
|
80
|
+
center_y = from_float(obj.get("center_y"))
|
|
81
|
+
radius = from_float(obj.get("radius"))
|
|
82
|
+
return CircleAnnotation(center_x, center_y, radius)
|
|
83
|
+
|
|
84
|
+
def to_dict(self) -> dict:
|
|
85
|
+
result: dict = {}
|
|
86
|
+
result["center_x"] = to_float(self.center_x)
|
|
87
|
+
result["center_y"] = to_float(self.center_y)
|
|
88
|
+
result["radius"] = to_float(self.radius)
|
|
89
|
+
return result
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class MagicwandAnnotationPoint:
|
|
93
|
+
x: float
|
|
94
|
+
y: float
|
|
95
|
+
|
|
96
|
+
def __init__(self, x: float, y: float) -> None:
|
|
97
|
+
self.x = x
|
|
98
|
+
self.y = y
|
|
99
|
+
|
|
100
|
+
@staticmethod
|
|
101
|
+
def from_dict(obj: Any) -> 'MagicwandAnnotationPoint':
|
|
102
|
+
assert isinstance(obj, dict)
|
|
103
|
+
x = from_float(obj.get("x"))
|
|
104
|
+
y = from_float(obj.get("y"))
|
|
105
|
+
return MagicwandAnnotationPoint(x, y)
|
|
106
|
+
|
|
107
|
+
def to_dict(self) -> dict:
|
|
108
|
+
result: dict = {}
|
|
109
|
+
result["x"] = to_float(self.x)
|
|
110
|
+
result["y"] = to_float(self.y)
|
|
111
|
+
return result
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class MagicwandAnnotation:
|
|
115
|
+
bottom_right_x: float
|
|
116
|
+
bottom_right_y: float
|
|
117
|
+
center_x: float
|
|
118
|
+
center_y: float
|
|
119
|
+
data_url: str
|
|
120
|
+
points: List[MagicwandAnnotationPoint]
|
|
121
|
+
threshold: int
|
|
122
|
+
top_left_x: float
|
|
123
|
+
top_left_y: float
|
|
124
|
+
|
|
125
|
+
def __init__(self, bottom_right_x: float, bottom_right_y: float, center_x: float, center_y: float, data_url: str, points: List[MagicwandAnnotationPoint], threshold: int, top_left_x: float, top_left_y: float) -> None:
|
|
126
|
+
self.bottom_right_x = bottom_right_x
|
|
127
|
+
self.bottom_right_y = bottom_right_y
|
|
128
|
+
self.center_x = center_x
|
|
129
|
+
self.center_y = center_y
|
|
130
|
+
self.data_url = data_url
|
|
131
|
+
self.points = points
|
|
132
|
+
self.threshold = threshold
|
|
133
|
+
self.top_left_x = top_left_x
|
|
134
|
+
self.top_left_y = top_left_y
|
|
135
|
+
|
|
136
|
+
@staticmethod
|
|
137
|
+
def from_dict(obj: Any) -> 'MagicwandAnnotation':
|
|
138
|
+
assert isinstance(obj, dict)
|
|
139
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
140
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
141
|
+
center_x = from_float(obj.get("center_x"))
|
|
142
|
+
center_y = from_float(obj.get("center_y"))
|
|
143
|
+
data_url = from_str(obj.get("dataURL"))
|
|
144
|
+
points = from_list(MagicwandAnnotationPoint.from_dict, obj.get("points"))
|
|
145
|
+
threshold = from_int(obj.get("threshold"))
|
|
146
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
147
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
148
|
+
return MagicwandAnnotation(bottom_right_x, bottom_right_y, center_x, center_y, data_url, points, threshold, top_left_x, top_left_y)
|
|
149
|
+
|
|
150
|
+
def to_dict(self) -> dict:
|
|
151
|
+
result: dict = {}
|
|
152
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
153
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
154
|
+
result["center_x"] = to_float(self.center_x)
|
|
155
|
+
result["center_y"] = to_float(self.center_y)
|
|
156
|
+
result["dataURL"] = from_str(self.data_url)
|
|
157
|
+
result["points"] = from_list(lambda x: to_class(MagicwandAnnotationPoint, x), self.points)
|
|
158
|
+
result["threshold"] = from_int(self.threshold)
|
|
159
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
160
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
161
|
+
return result
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class PenAnnotationPoint:
|
|
165
|
+
x: float
|
|
166
|
+
y: float
|
|
167
|
+
|
|
168
|
+
def __init__(self, x: float, y: float) -> None:
|
|
169
|
+
self.x = x
|
|
170
|
+
self.y = y
|
|
171
|
+
|
|
172
|
+
@staticmethod
|
|
173
|
+
def from_dict(obj: Any) -> 'PenAnnotationPoint':
|
|
174
|
+
assert isinstance(obj, dict)
|
|
175
|
+
x = from_float(obj.get("x"))
|
|
176
|
+
y = from_float(obj.get("y"))
|
|
177
|
+
return PenAnnotationPoint(x, y)
|
|
178
|
+
|
|
179
|
+
def to_dict(self) -> dict:
|
|
180
|
+
result: dict = {}
|
|
181
|
+
result["x"] = to_float(self.x)
|
|
182
|
+
result["y"] = to_float(self.y)
|
|
183
|
+
return result
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class PenAnnotation:
|
|
187
|
+
bottom_right_x: float
|
|
188
|
+
bottom_right_y: float
|
|
189
|
+
data_url: str
|
|
190
|
+
points: List[PenAnnotationPoint]
|
|
191
|
+
thickness: float
|
|
192
|
+
top_left_x: float
|
|
193
|
+
top_left_y: float
|
|
194
|
+
|
|
195
|
+
def __init__(self, bottom_right_x: float, bottom_right_y: float, data_url: str, points: List[PenAnnotationPoint], thickness: float, top_left_x: float, top_left_y: float) -> None:
|
|
196
|
+
self.bottom_right_x = bottom_right_x
|
|
197
|
+
self.bottom_right_y = bottom_right_y
|
|
198
|
+
self.data_url = data_url
|
|
199
|
+
self.points = points
|
|
200
|
+
self.thickness = thickness
|
|
201
|
+
self.top_left_x = top_left_x
|
|
202
|
+
self.top_left_y = top_left_y
|
|
203
|
+
|
|
204
|
+
@staticmethod
|
|
205
|
+
def from_dict(obj: Any) -> 'PenAnnotation':
|
|
206
|
+
assert isinstance(obj, dict)
|
|
207
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
208
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
209
|
+
data_url = from_str(obj.get("dataURL"))
|
|
210
|
+
points = from_list(PenAnnotationPoint.from_dict, obj.get("points"))
|
|
211
|
+
thickness = from_float(obj.get("thickness"))
|
|
212
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
213
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
214
|
+
return PenAnnotation(bottom_right_x, bottom_right_y, data_url, points, thickness, top_left_x, top_left_y)
|
|
215
|
+
|
|
216
|
+
def to_dict(self) -> dict:
|
|
217
|
+
result: dict = {}
|
|
218
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
219
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
220
|
+
result["dataURL"] = from_str(self.data_url)
|
|
221
|
+
result["points"] = from_list(lambda x: to_class(PenAnnotationPoint, x), self.points)
|
|
222
|
+
result["thickness"] = to_float(self.thickness)
|
|
223
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
224
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
225
|
+
return result
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class PixelAnnotation:
|
|
229
|
+
blob_id: UUID
|
|
230
|
+
bottom_right_x: float
|
|
231
|
+
bottom_right_y: float
|
|
232
|
+
top_left_x: float
|
|
233
|
+
top_left_y: float
|
|
234
|
+
|
|
235
|
+
def __init__(self, blob_id: UUID, bottom_right_x: float, bottom_right_y: float, top_left_x: float, top_left_y: float) -> None:
|
|
236
|
+
self.blob_id = blob_id
|
|
237
|
+
self.bottom_right_x = bottom_right_x
|
|
238
|
+
self.bottom_right_y = bottom_right_y
|
|
239
|
+
self.top_left_x = top_left_x
|
|
240
|
+
self.top_left_y = top_left_y
|
|
241
|
+
|
|
242
|
+
@staticmethod
|
|
243
|
+
def from_dict(obj: Any) -> 'PixelAnnotation':
|
|
244
|
+
assert isinstance(obj, dict)
|
|
245
|
+
blob_id = UUID(obj.get("blob_id"))
|
|
246
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
247
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
248
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
249
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
250
|
+
return PixelAnnotation(blob_id, bottom_right_x, bottom_right_y, top_left_x, top_left_y)
|
|
251
|
+
|
|
252
|
+
def to_dict(self) -> dict:
|
|
253
|
+
result: dict = {}
|
|
254
|
+
result["blob_id"] = str(self.blob_id)
|
|
255
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
256
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
257
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
258
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
259
|
+
return result
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class PolygonAnnotationPoint:
|
|
263
|
+
x: float
|
|
264
|
+
y: float
|
|
265
|
+
|
|
266
|
+
def __init__(self, x: float, y: float) -> None:
|
|
267
|
+
self.x = x
|
|
268
|
+
self.y = y
|
|
269
|
+
|
|
270
|
+
@staticmethod
|
|
271
|
+
def from_dict(obj: Any) -> 'PolygonAnnotationPoint':
|
|
272
|
+
assert isinstance(obj, dict)
|
|
273
|
+
x = from_float(obj.get("x"))
|
|
274
|
+
y = from_float(obj.get("y"))
|
|
275
|
+
return PolygonAnnotationPoint(x, y)
|
|
276
|
+
|
|
277
|
+
def to_dict(self) -> dict:
|
|
278
|
+
result: dict = {}
|
|
279
|
+
result["x"] = to_float(self.x)
|
|
280
|
+
result["y"] = to_float(self.y)
|
|
281
|
+
return result
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class PolygonAnnotation:
|
|
285
|
+
points: List[PolygonAnnotationPoint]
|
|
286
|
+
|
|
287
|
+
def __init__(self, points: List[PolygonAnnotationPoint]) -> None:
|
|
288
|
+
self.points = points
|
|
289
|
+
|
|
290
|
+
@staticmethod
|
|
291
|
+
def from_dict(obj: Any) -> 'PolygonAnnotation':
|
|
292
|
+
assert isinstance(obj, dict)
|
|
293
|
+
points = from_list(PolygonAnnotationPoint.from_dict, obj.get("points"))
|
|
294
|
+
return PolygonAnnotation(points)
|
|
295
|
+
|
|
296
|
+
def to_dict(self) -> dict:
|
|
297
|
+
result: dict = {}
|
|
298
|
+
result["points"] = from_list(lambda x: to_class(PolygonAnnotationPoint, x), self.points)
|
|
299
|
+
return result
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class RectangleAnnotation:
|
|
303
|
+
bottom_right_x: float
|
|
304
|
+
bottom_right_y: float
|
|
305
|
+
top_left_x: float
|
|
306
|
+
top_left_y: float
|
|
307
|
+
|
|
308
|
+
def __init__(self, bottom_right_x: float, bottom_right_y: float, top_left_x: float, top_left_y: float) -> None:
|
|
309
|
+
self.bottom_right_x = bottom_right_x
|
|
310
|
+
self.bottom_right_y = bottom_right_y
|
|
311
|
+
self.top_left_x = top_left_x
|
|
312
|
+
self.top_left_y = top_left_y
|
|
313
|
+
|
|
314
|
+
@staticmethod
|
|
315
|
+
def from_dict(obj: Any) -> 'RectangleAnnotation':
|
|
316
|
+
assert isinstance(obj, dict)
|
|
317
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
318
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
319
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
320
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
321
|
+
return RectangleAnnotation(bottom_right_x, bottom_right_y, top_left_x, top_left_y)
|
|
322
|
+
|
|
323
|
+
def to_dict(self) -> dict:
|
|
324
|
+
result: dict = {}
|
|
325
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
326
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
327
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
328
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
329
|
+
return result
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class SausageAnnotationPoint:
|
|
333
|
+
x: float
|
|
334
|
+
y: float
|
|
335
|
+
|
|
336
|
+
def __init__(self, x: float, y: float) -> None:
|
|
337
|
+
self.x = x
|
|
338
|
+
self.y = y
|
|
339
|
+
|
|
340
|
+
@staticmethod
|
|
341
|
+
def from_dict(obj: Any) -> 'SausageAnnotationPoint':
|
|
342
|
+
assert isinstance(obj, dict)
|
|
343
|
+
x = from_float(obj.get("x"))
|
|
344
|
+
y = from_float(obj.get("y"))
|
|
345
|
+
return SausageAnnotationPoint(x, y)
|
|
346
|
+
|
|
347
|
+
def to_dict(self) -> dict:
|
|
348
|
+
result: dict = {}
|
|
349
|
+
result["x"] = to_float(self.x)
|
|
350
|
+
result["y"] = to_float(self.y)
|
|
351
|
+
return result
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class SausageAnnotation:
|
|
355
|
+
bottom_right_x: float
|
|
356
|
+
bottom_right_y: float
|
|
357
|
+
data_url: str
|
|
358
|
+
points: List[SausageAnnotationPoint]
|
|
359
|
+
radius: float
|
|
360
|
+
top_left_x: float
|
|
361
|
+
top_left_y: float
|
|
362
|
+
|
|
363
|
+
def __init__(self, bottom_right_x: float, bottom_right_y: float, data_url: str, points: List[SausageAnnotationPoint], radius: float, top_left_x: float, top_left_y: float) -> None:
|
|
364
|
+
self.bottom_right_x = bottom_right_x
|
|
365
|
+
self.bottom_right_y = bottom_right_y
|
|
366
|
+
self.data_url = data_url
|
|
367
|
+
self.points = points
|
|
368
|
+
self.radius = radius
|
|
369
|
+
self.top_left_x = top_left_x
|
|
370
|
+
self.top_left_y = top_left_y
|
|
371
|
+
|
|
372
|
+
@staticmethod
|
|
373
|
+
def from_dict(obj: Any) -> 'SausageAnnotation':
|
|
374
|
+
assert isinstance(obj, dict)
|
|
375
|
+
bottom_right_x = from_float(obj.get("bottom_right_x"))
|
|
376
|
+
bottom_right_y = from_float(obj.get("bottom_right_y"))
|
|
377
|
+
data_url = from_str(obj.get("dataURL"))
|
|
378
|
+
points = from_list(SausageAnnotationPoint.from_dict, obj.get("points"))
|
|
379
|
+
radius = from_float(obj.get("radius"))
|
|
380
|
+
top_left_x = from_float(obj.get("top_left_x"))
|
|
381
|
+
top_left_y = from_float(obj.get("top_left_y"))
|
|
382
|
+
return SausageAnnotation(bottom_right_x, bottom_right_y, data_url, points, radius, top_left_x, top_left_y)
|
|
383
|
+
|
|
384
|
+
def to_dict(self) -> dict:
|
|
385
|
+
result: dict = {}
|
|
386
|
+
result["bottom_right_x"] = to_float(self.bottom_right_x)
|
|
387
|
+
result["bottom_right_y"] = to_float(self.bottom_right_y)
|
|
388
|
+
result["dataURL"] = from_str(self.data_url)
|
|
389
|
+
result["points"] = from_list(lambda x: to_class(SausageAnnotationPoint, x), self.points)
|
|
390
|
+
result["radius"] = to_float(self.radius)
|
|
391
|
+
result["top_left_x"] = to_float(self.top_left_x)
|
|
392
|
+
result["top_left_y"] = to_float(self.top_left_y)
|
|
393
|
+
return result
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
class Annotation:
|
|
397
|
+
annotation_type: AnnotationType
|
|
398
|
+
average_width: float
|
|
399
|
+
circle_annotation: Optional[CircleAnnotation]
|
|
400
|
+
id: UUID
|
|
401
|
+
label_id: UUID
|
|
402
|
+
magicwand_annotation: Optional[MagicwandAnnotation]
|
|
403
|
+
pen_annotation: Optional[PenAnnotation]
|
|
404
|
+
pixel_annotation: Optional[PixelAnnotation]
|
|
405
|
+
polygon_annotation: Optional[PolygonAnnotation]
|
|
406
|
+
rectangle_annotation: Optional[RectangleAnnotation]
|
|
407
|
+
sausage_annotation: Optional[SausageAnnotation]
|
|
408
|
+
|
|
409
|
+
def __init__(self, annotation_type: AnnotationType, average_width: float, circle_annotation: Optional[CircleAnnotation], id: UUID, label_id: UUID, magicwand_annotation: Optional[MagicwandAnnotation], pen_annotation: Optional[PenAnnotation], pixel_annotation: Optional[PixelAnnotation], polygon_annotation: Optional[PolygonAnnotation], rectangle_annotation: Optional[RectangleAnnotation], sausage_annotation: Optional[SausageAnnotation]) -> None:
|
|
410
|
+
self.annotation_type = annotation_type
|
|
411
|
+
self.average_width = average_width
|
|
412
|
+
self.circle_annotation = circle_annotation
|
|
413
|
+
self.id = id
|
|
414
|
+
self.label_id = label_id
|
|
415
|
+
self.magicwand_annotation = magicwand_annotation
|
|
416
|
+
self.pen_annotation = pen_annotation
|
|
417
|
+
self.pixel_annotation = pixel_annotation
|
|
418
|
+
self.polygon_annotation = polygon_annotation
|
|
419
|
+
self.rectangle_annotation = rectangle_annotation
|
|
420
|
+
self.sausage_annotation = sausage_annotation
|
|
421
|
+
|
|
422
|
+
@staticmethod
|
|
423
|
+
def from_dict(obj: Any) -> 'Annotation':
|
|
424
|
+
assert isinstance(obj, dict)
|
|
425
|
+
annotation_type = AnnotationType(obj.get("annotation_type"))
|
|
426
|
+
average_width = from_float(obj.get("average_width"))
|
|
427
|
+
circle_annotation = from_union([CircleAnnotation.from_dict, from_none], obj.get("circle_annotation"))
|
|
428
|
+
id = UUID(obj.get("id"))
|
|
429
|
+
label_id = UUID(obj.get("label_id"))
|
|
430
|
+
magicwand_annotation = from_union([MagicwandAnnotation.from_dict, from_none], obj.get("magicwand_annotation"))
|
|
431
|
+
pen_annotation = from_union([PenAnnotation.from_dict, from_none], obj.get("pen_annotation"))
|
|
432
|
+
pixel_annotation = from_union([PixelAnnotation.from_dict, from_none], obj.get("pixel_annotation"))
|
|
433
|
+
polygon_annotation = from_union([PolygonAnnotation.from_dict, from_none], obj.get("polygon_annotation"))
|
|
434
|
+
rectangle_annotation = from_union([RectangleAnnotation.from_dict, from_none], obj.get("rectangle_annotation"))
|
|
435
|
+
sausage_annotation = from_union([SausageAnnotation.from_dict, from_none], obj.get("sausage_annotation"))
|
|
436
|
+
return Annotation(annotation_type, average_width, circle_annotation, id, label_id, magicwand_annotation, pen_annotation, pixel_annotation, polygon_annotation, rectangle_annotation, sausage_annotation)
|
|
437
|
+
|
|
438
|
+
def to_dict(self) -> dict:
|
|
439
|
+
result: dict = {}
|
|
440
|
+
result["annotation_type"] = to_enum(AnnotationType, self.annotation_type)
|
|
441
|
+
result["average_width"] = to_float(self.average_width)
|
|
442
|
+
if self.circle_annotation is not None:
|
|
443
|
+
result["circle_annotation"] = from_union([lambda x: to_class(CircleAnnotation, x), from_none], self.circle_annotation)
|
|
444
|
+
result["id"] = str(self.id)
|
|
445
|
+
result["label_id"] = str(self.label_id)
|
|
446
|
+
if self.magicwand_annotation is not None:
|
|
447
|
+
result["magicwand_annotation"] = from_union([lambda x: to_class(MagicwandAnnotation, x), from_none], self.magicwand_annotation)
|
|
448
|
+
if self.pen_annotation is not None:
|
|
449
|
+
result["pen_annotation"] = from_union([lambda x: to_class(PenAnnotation, x), from_none], self.pen_annotation)
|
|
450
|
+
if self.pixel_annotation is not None:
|
|
451
|
+
result["pixel_annotation"] = from_union([lambda x: to_class(PixelAnnotation, x), from_none], self.pixel_annotation)
|
|
452
|
+
if self.polygon_annotation is not None:
|
|
453
|
+
result["polygon_annotation"] = from_union([lambda x: to_class(PolygonAnnotation, x), from_none], self.polygon_annotation)
|
|
454
|
+
if self.rectangle_annotation is not None:
|
|
455
|
+
result["rectangle_annotation"] = from_union([lambda x: to_class(RectangleAnnotation, x), from_none], self.rectangle_annotation)
|
|
456
|
+
if self.sausage_annotation is not None:
|
|
457
|
+
result["sausage_annotation"] = from_union([lambda x: to_class(SausageAnnotation, x), from_none], self.sausage_annotation)
|
|
458
|
+
return result
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
class SegmentationMap:
|
|
462
|
+
blob_id: UUID
|
|
463
|
+
label_id: UUID
|
|
464
|
+
thumbnail: str
|
|
465
|
+
|
|
466
|
+
def __init__(self, blob_id: UUID, label_id: UUID, thumbnail: str) -> None:
|
|
467
|
+
self.blob_id = blob_id
|
|
468
|
+
self.label_id = label_id
|
|
469
|
+
self.thumbnail = thumbnail
|
|
470
|
+
|
|
471
|
+
@staticmethod
|
|
472
|
+
def from_dict(obj: Any) -> 'SegmentationMap':
|
|
473
|
+
assert isinstance(obj, dict)
|
|
474
|
+
blob_id = UUID(obj.get("blob_id"))
|
|
475
|
+
label_id = UUID(obj.get("label_id"))
|
|
476
|
+
thumbnail = from_str(obj.get("thumbnail"))
|
|
477
|
+
return SegmentationMap(blob_id, label_id, thumbnail)
|
|
478
|
+
|
|
479
|
+
def to_dict(self) -> dict:
|
|
480
|
+
result: dict = {}
|
|
481
|
+
result["blob_id"] = str(self.blob_id)
|
|
482
|
+
result["label_id"] = str(self.label_id)
|
|
483
|
+
result["thumbnail"] = from_str(self.thumbnail)
|
|
484
|
+
return result
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
class SegmentationMarkup:
|
|
488
|
+
annotations: List[Annotation]
|
|
489
|
+
average_object_widths: List[float]
|
|
490
|
+
height: int
|
|
491
|
+
segmentation_maps: List[SegmentationMap]
|
|
492
|
+
width: int
|
|
493
|
+
|
|
494
|
+
def __init__(self, annotations: List[Annotation], average_object_widths: List[float], height: int, segmentation_maps: List[SegmentationMap], width: int) -> None:
|
|
495
|
+
self.annotations = annotations
|
|
496
|
+
self.average_object_widths = average_object_widths
|
|
497
|
+
self.height = height
|
|
498
|
+
self.segmentation_maps = segmentation_maps
|
|
499
|
+
self.width = width
|
|
500
|
+
|
|
501
|
+
@staticmethod
|
|
502
|
+
def from_dict(obj: Any) -> 'SegmentationMarkup':
|
|
503
|
+
assert isinstance(obj, dict)
|
|
504
|
+
annotations = from_list(Annotation.from_dict, obj.get("annotations"))
|
|
505
|
+
average_object_widths = from_list(from_float, obj.get("average_object_widths"))
|
|
506
|
+
height = from_int(obj.get("height"))
|
|
507
|
+
segmentation_maps = from_list(SegmentationMap.from_dict, obj.get("segmentation_maps"))
|
|
508
|
+
width = from_int(obj.get("width"))
|
|
509
|
+
return SegmentationMarkup(annotations, average_object_widths, height, segmentation_maps, width)
|
|
510
|
+
|
|
511
|
+
def to_dict(self) -> dict:
|
|
512
|
+
result: dict = {}
|
|
513
|
+
result["annotations"] = from_list(lambda x: to_class(Annotation, x), self.annotations)
|
|
514
|
+
result["average_object_widths"] = from_list(to_float, self.average_object_widths)
|
|
515
|
+
result["height"] = from_int(self.height)
|
|
516
|
+
result["segmentation_maps"] = from_list(lambda x: to_class(SegmentationMap, x), self.segmentation_maps)
|
|
517
|
+
result["width"] = from_int(self.width)
|
|
518
|
+
return result
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def segmentation_markup_from_dict(s: Any) -> SegmentationMarkup:
|
|
522
|
+
return SegmentationMarkup.from_dict(s)
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
def segmentation_markup_to_dict(x: SegmentationMarkup) -> Any:
|
|
526
|
+
return to_class(SegmentationMarkup, x)
|
denkproto/modelfile_v2_pb2.py
CHANGED
|
@@ -24,7 +24,7 @@ _sym_db = _symbol_database.Default()
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12modelfile-v2.proto\x12\x0cmodelfile.v2\"\
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12modelfile-v2.proto\x12\x0cmodelfile.v2\"\xda\"\n\tModelFile\x12\x39\n\x10protocol_version\x18\x01 \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Version\x12\x12\n\ncreated_at\x18\x02 \x01(\x03\x12\x33\n\tfile_info\x18\x03 \x01(\x0b\x32 .modelfile.v2.ModelFile.FileInfo\x12\x30\n\x07\x63ontent\x18\x04 \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Content\x12\x38\n\x0c\x63lass_labels\x18\x05 \x03(\x0b\x32\".modelfile.v2.ModelFile.ClassLabel\x12-\n\x06inputs\x18\x06 \x03(\x0b\x32\x1d.modelfile.v2.ModelFile.Input\x12/\n\x07outputs\x18\x07 \x03(\x0b\x32\x1e.modelfile.v2.ModelFile.Output\x12J\n\x12\x61\x64\x64itional_content\x18\x08 \x03(\x0b\x32..modelfile.v2.ModelFile.AdditionalContentEntry\x1a\x36\n\x07Version\x12\r\n\x05major\x18\x01 \x01(\x04\x12\r\n\x05minor\x18\x02 \x01(\x04\x12\r\n\x05patch\x18\x03 \x01(\x04\x1a\xaa\x04\n\x07\x43ontent\x12\x14\n\x0c\x62yte_content\x18\x01 \x01(\x0c\x12\x13\n\x0bhash_sha256\x18\x02 \x01(\x0c\x12M\n\x12\x63ompression_method\x18\x03 \x01(\x0e\x32\x31.modelfile.v2.ModelFile.Content.CompressionMethod\x12K\n\x11\x65ncryption_method\x18\x04 \x01(\x0e\x32\x30.modelfile.v2.ModelFile.Content.EncryptionMethod\x12@\n\tkey_slots\x18\x05 \x03(\x0b\x32-.modelfile.v2.ModelFile.Content.KeySlotsEntry\x1ai\n\x07KeySlot\x12\x13\n\x0bwrapped_key\x18\x01 \x01(\x0c\x12I\n\x0fwrapping_method\x18\x02 \x01(\x0e\x32\x30.modelfile.v2.ModelFile.Content.EncryptionMethod\x1aX\n\rKeySlotsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.modelfile.v2.ModelFile.Content.KeySlot:\x02\x38\x01\" \n\x11\x43ompressionMethod\x12\x0b\n\x07\x43M_NONE\x10\x00\"/\n\x10\x45ncryptionMethod\x12\x0b\n\x07\x45M_NONE\x10\x00\x12\x0e\n\nEM_AES_GCM\x10\x01\x1aU\n\nClassLabel\x12\x16\n\x0e\x63lass_label_id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x12\n\nshort_name\x18\x03 \x01(\t\x12\r\n\x05\x63olor\x18\x04 \x01(\t\x1a<\n\tImageSize\x12\r\n\x05width\x18\x01 \x01(\x04\x12\x0e\n\x06height\x18\x02 \x01(\x04\x12\x10\n\x08\x63hannels\x18\x03 \x01(\x04\x1aJ\n\x0eRegionFromEdge\x12\x0c\n\x04left\x18\x01 \x01(\x01\x12\r\n\x05right\x18\x02 \x01(\x01\x12\x0b\n\x03top\x18\x03 \x01(\x01\x12\x0e\n\x06\x62ottom\x18\x04 \x01(\x01\x1a\xe2\x05\n\x05Input\x12\x46\n\x0cimage_format\x18\x01 \x01(\x0b\x32..modelfile.v2.ModelFile.Input.ImageInputFormatH\x00\x1a\xfb\x04\n\x10ImageInputFormat\x12\x64\n\x10\x65xact_image_size\x18\x01 \x01(\x0b\x32H.modelfile.v2.ModelFile.Input.ImageInputFormat.ExactImageSizeRequirementH\x00\x12l\n\x14\x64ivisible_image_size\x18\x02 \x01(\x0b\x32L.modelfile.v2.ModelFile.Input.ImageInputFormat.DivisibleImageSizeRequirementH\x00\x12\x42\n\x12region_of_interest\x18\x03 \x01(\x0b\x32&.modelfile.v2.ModelFile.RegionFromEdge\x1aR\n\x19\x45xactImageSizeRequirement\x12\x35\n\nimage_size\x18\x01 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSize\x1a\xdf\x01\n\x1d\x44ivisibleImageSizeRequirement\x12>\n\x13image_size_divisors\x18\x01 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSize\x12=\n\x12minimum_image_size\x18\x02 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSize\x12?\n\x14suggested_image_size\x18\x03 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSizeB\x19\n\x17image_size_requirementsB\x13\n\x11\x46ormatInformation\x1a\xcc\n\n\x06Output\x12_\n\x18image_classifiers_format\x18\x01 \x01(\x0b\x32;.modelfile.v2.ModelFile.Output.ImageClassifiersOutputFormatH\x00\x12_\n\x18segmentation_maps_format\x18\x02 \x01(\x0b\x32;.modelfile.v2.ModelFile.Output.SegmentationMapsOutputFormatH\x00\x12Y\n\x15\x62ounding_boxes_format\x18\x03 \x01(\x0b\x32\x38.modelfile.v2.ModelFile.Output.BoundingBoxesOutputFormatH\x00\x12p\n!bounding_box_segmentations_format\x18\x04 \x01(\x0b\x32\x43.modelfile.v2.ModelFile.Output.BoundingBoxSegmentationsOutputFormatH\x00\x12\x44\n\nocr_format\x18\x05 \x01(\x0b\x32..modelfile.v2.ModelFile.Output.OcrOutputFormatH\x00\x1a\x1e\n\x1cImageClassifiersOutputFormat\x1aU\n\x1cSegmentationMapsOutputFormat\x12\x35\n\nimage_size\x18\x01 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSize\x1a\xe9\x01\n\x19\x42oundingBoxesOutputFormat\x12\x17\n\x0fnumber_of_boxes\x18\x01 \x01(\x04\x12\x0e\n\x06stride\x18\x02 \x01(\x04\x12\x11\n\tx1_offset\x18\x03 \x01(\x04\x12\x11\n\ty1_offset\x18\x04 \x01(\x04\x12\x11\n\tx2_offset\x18\x05 \x01(\x04\x12\x11\n\ty2_offset\x18\x06 \x01(\x04\x12\x19\n\x11\x63onfidence_offset\x18\x07 \x01(\x04\x12 \n\x18\x63lass_label_index_offset\x18\x08 \x01(\x04\x12\x1a\n\x12\x62\x61tch_index_offset\x18\t \x01(\x04\x1a\x7f\n$BoundingBoxSegmentationsOutputFormat\x12\x35\n\nimage_size\x18\x01 \x01(\x0b\x32!.modelfile.v2.ModelFile.ImageSize\x12 \n\x18relative_to_bounding_box\x18\x02 \x01(\x08\x1a\xf3\x02\n\x0fOcrOutputFormat\x12\x1c\n\x14number_of_characters\x18\x01 \x01(\x04\x12L\n\ncharacters\x18\x02 \x03(\x0b\x32\x38.modelfile.v2.ModelFile.Output.OcrOutputFormat.Character\x1a\xf3\x01\n\tCharacter\x12\x1b\n\x13utf8_representation\x18\x01 \x01(\x0c\x12^\n\x0e\x63haracter_type\x18\x02 \x01(\x0e\x32\x46.modelfile.v2.ModelFile.Output.OcrOutputFormat.Character.CharacterType\x12\x0e\n\x06ignore\x18\x03 \x01(\x08\"Y\n\rCharacterType\x12\x0e\n\nCT_REGULAR\x10\x00\x12\x14\n\x10\x43T_START_OF_TEXT\x10\x01\x12\x12\n\x0e\x43T_END_OF_TEXT\x10\x02\x12\x0e\n\nCT_PADDING\x10\x03\x42\x13\n\x11\x46ormatInformation\x1a\xdb\x07\n\x08\x46ileInfo\x12<\n\tfile_type\x18\x01 \x01(\x0e\x32).modelfile.v2.ModelFile.FileInfo.FileType\x12\x14\n\x0cnetwork_name\x18\x02 \x01(\t\x12\x12\n\nnetwork_id\x18\x03 \x01(\t\x12\x1d\n\x15network_experiment_id\x18\x04 \x01(\t\x12\x1b\n\x13network_snapshot_id\x18\x05 \x01(\t\x12\x42\n\x0cnetwork_type\x18\x06 \x01(\x0e\x32,.modelfile.v2.ModelFile.FileInfo.NetworkType\x12\x16\n\x0enetwork_flavor\x18\x07 \x01(\t\x12\x38\n\x0fnetwork_version\x18\x08 \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Version\x12\x38\n\x0fruntime_version\x18\t \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Version\x12=\n\tprecision\x18\n \x01(\x0e\x32*.modelfile.v2.ModelFile.FileInfo.Precision\x12\x44\n\x1bminimum_libdenkflow_version\x18\x0b \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Version\"D\n\x08\x46ileType\x12\x11\n\rFT_ONNX_MODEL\x10\x00\x12\x10\n\x0c\x46T_ZXING_KEY\x10\x01\x12\x13\n\x0f\x46T_VIZIOTIX_KEY\x10\x02\"\xc0\x01\n\x0bNetworkType\x12\x0e\n\nNT_UNKNOWN\x10\x00\x12\x15\n\x11NT_CLASSIFICATION\x10\x01\x12\x13\n\x0fNT_SEGMENTATION\x10\x02\x12\x1c\n\x18NT_INSTANCE_SEGMENTATION\x10\x03\x12\x17\n\x13NT_OBJECT_DETECTION\x10\x04\x12\x18\n\x14NT_ANOMALY_DETECTION\x10\x05\x12$\n NT_OPTICAL_CHARACTER_RECOGNITION\x10\x06\"\xcc\x01\n\tPrecision\x12\x0f\n\x0bP_UNDEFINED\x10\x00\x12\t\n\x05P_FP8\x10\x01\x12\n\n\x06P_FP16\x10\x02\x12\n\n\x06P_FP32\x10\x03\x12\n\n\x06P_FP64\x10\x04\x12\n\n\x06P_INT8\x10\x05\x12\x0b\n\x07P_INT16\x10\x06\x12\x0b\n\x07P_INT32\x10\x07\x12\x0b\n\x07P_INT64\x10\x08\x12\x0b\n\x07P_UINT8\x10\t\x12\x0c\n\x08P_UINT16\x10\n\x12\x0c\n\x08P_UINT32\x10\x0b\x12\x0c\n\x08P_UINT64\x10\x0c\x12\x15\n\x11P_MIXED_PRECISION\x10\r\x1aY\n\x16\x41\x64\x64itionalContentEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.modelfile.v2.ModelFile.Content:\x02\x38\x01\x42IZ-github.com/DENKweit/denkproto-go/modelfile/v2\xaa\x02\x17\x44\x45NK.Proto.Modelfile.V2b\x06proto3')
|
|
28
28
|
|
|
29
29
|
_globals = globals()
|
|
30
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -37,7 +37,7 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
37
37
|
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._loaded_options = None
|
|
38
38
|
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._serialized_options = b'8\001'
|
|
39
39
|
_globals['_MODELFILE']._serialized_start=37
|
|
40
|
-
_globals['_MODELFILE']._serialized_end=
|
|
40
|
+
_globals['_MODELFILE']._serialized_end=4479
|
|
41
41
|
_globals['_MODELFILE_VERSION']._serialized_start=462
|
|
42
42
|
_globals['_MODELFILE_VERSION']._serialized_end=516
|
|
43
43
|
_globals['_MODELFILE_CONTENT']._serialized_start=519
|
|
@@ -65,29 +65,29 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
65
65
|
_globals['_MODELFILE_INPUT_IMAGEINPUTFORMAT_DIVISIBLEIMAGESIZEREQUIREMENT']._serialized_start=1768
|
|
66
66
|
_globals['_MODELFILE_INPUT_IMAGEINPUTFORMAT_DIVISIBLEIMAGESIZEREQUIREMENT']._serialized_end=1991
|
|
67
67
|
_globals['_MODELFILE_OUTPUT']._serialized_start=2042
|
|
68
|
-
_globals['_MODELFILE_OUTPUT']._serialized_end=
|
|
68
|
+
_globals['_MODELFILE_OUTPUT']._serialized_end=3398
|
|
69
69
|
_globals['_MODELFILE_OUTPUT_IMAGECLASSIFIERSOUTPUTFORMAT']._serialized_start=2521
|
|
70
70
|
_globals['_MODELFILE_OUTPUT_IMAGECLASSIFIERSOUTPUTFORMAT']._serialized_end=2551
|
|
71
71
|
_globals['_MODELFILE_OUTPUT_SEGMENTATIONMAPSOUTPUTFORMAT']._serialized_start=2553
|
|
72
72
|
_globals['_MODELFILE_OUTPUT_SEGMENTATIONMAPSOUTPUTFORMAT']._serialized_end=2638
|
|
73
73
|
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXESOUTPUTFORMAT']._serialized_start=2641
|
|
74
|
-
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXESOUTPUTFORMAT']._serialized_end=
|
|
75
|
-
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXSEGMENTATIONSOUTPUTFORMAT']._serialized_start=
|
|
76
|
-
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXSEGMENTATIONSOUTPUTFORMAT']._serialized_end=
|
|
77
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT']._serialized_start=
|
|
78
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT']._serialized_end=
|
|
79
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER']._serialized_start=
|
|
80
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER']._serialized_end=
|
|
81
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER_CHARACTERTYPE']._serialized_start=
|
|
82
|
-
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER_CHARACTERTYPE']._serialized_end=
|
|
83
|
-
_globals['_MODELFILE_FILEINFO']._serialized_start=
|
|
84
|
-
_globals['_MODELFILE_FILEINFO']._serialized_end=
|
|
85
|
-
_globals['_MODELFILE_FILEINFO_FILETYPE']._serialized_start=
|
|
86
|
-
_globals['_MODELFILE_FILEINFO_FILETYPE']._serialized_end=
|
|
87
|
-
_globals['_MODELFILE_FILEINFO_NETWORKTYPE']._serialized_start=
|
|
88
|
-
_globals['_MODELFILE_FILEINFO_NETWORKTYPE']._serialized_end=
|
|
89
|
-
_globals['_MODELFILE_FILEINFO_PRECISION']._serialized_start=
|
|
90
|
-
_globals['_MODELFILE_FILEINFO_PRECISION']._serialized_end=
|
|
91
|
-
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._serialized_start=
|
|
92
|
-
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._serialized_end=
|
|
74
|
+
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXESOUTPUTFORMAT']._serialized_end=2874
|
|
75
|
+
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXSEGMENTATIONSOUTPUTFORMAT']._serialized_start=2876
|
|
76
|
+
_globals['_MODELFILE_OUTPUT_BOUNDINGBOXSEGMENTATIONSOUTPUTFORMAT']._serialized_end=3003
|
|
77
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT']._serialized_start=3006
|
|
78
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT']._serialized_end=3377
|
|
79
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER']._serialized_start=3134
|
|
80
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER']._serialized_end=3377
|
|
81
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER_CHARACTERTYPE']._serialized_start=3288
|
|
82
|
+
_globals['_MODELFILE_OUTPUT_OCROUTPUTFORMAT_CHARACTER_CHARACTERTYPE']._serialized_end=3377
|
|
83
|
+
_globals['_MODELFILE_FILEINFO']._serialized_start=3401
|
|
84
|
+
_globals['_MODELFILE_FILEINFO']._serialized_end=4388
|
|
85
|
+
_globals['_MODELFILE_FILEINFO_FILETYPE']._serialized_start=3918
|
|
86
|
+
_globals['_MODELFILE_FILEINFO_FILETYPE']._serialized_end=3986
|
|
87
|
+
_globals['_MODELFILE_FILEINFO_NETWORKTYPE']._serialized_start=3989
|
|
88
|
+
_globals['_MODELFILE_FILEINFO_NETWORKTYPE']._serialized_end=4181
|
|
89
|
+
_globals['_MODELFILE_FILEINFO_PRECISION']._serialized_start=4184
|
|
90
|
+
_globals['_MODELFILE_FILEINFO_PRECISION']._serialized_end=4388
|
|
91
|
+
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._serialized_start=4390
|
|
92
|
+
_globals['_MODELFILE_ADDITIONALCONTENTENTRY']._serialized_end=4479
|
|
93
93
|
# @@protoc_insertion_point(module_scope)
|
denkproto/modelfile_v2_pb2.pyi
CHANGED
|
@@ -124,7 +124,7 @@ class ModelFile(_message.Message):
|
|
|
124
124
|
image_size: ModelFile.ImageSize
|
|
125
125
|
def __init__(self, image_size: _Optional[_Union[ModelFile.ImageSize, _Mapping]] = ...) -> None: ...
|
|
126
126
|
class BoundingBoxesOutputFormat(_message.Message):
|
|
127
|
-
__slots__ = ("number_of_boxes", "stride", "x1_offset", "y1_offset", "x2_offset", "y2_offset", "confidence_offset", "class_label_index_offset")
|
|
127
|
+
__slots__ = ("number_of_boxes", "stride", "x1_offset", "y1_offset", "x2_offset", "y2_offset", "confidence_offset", "class_label_index_offset", "batch_index_offset")
|
|
128
128
|
NUMBER_OF_BOXES_FIELD_NUMBER: _ClassVar[int]
|
|
129
129
|
STRIDE_FIELD_NUMBER: _ClassVar[int]
|
|
130
130
|
X1_OFFSET_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -133,6 +133,7 @@ class ModelFile(_message.Message):
|
|
|
133
133
|
Y2_OFFSET_FIELD_NUMBER: _ClassVar[int]
|
|
134
134
|
CONFIDENCE_OFFSET_FIELD_NUMBER: _ClassVar[int]
|
|
135
135
|
CLASS_LABEL_INDEX_OFFSET_FIELD_NUMBER: _ClassVar[int]
|
|
136
|
+
BATCH_INDEX_OFFSET_FIELD_NUMBER: _ClassVar[int]
|
|
136
137
|
number_of_boxes: int
|
|
137
138
|
stride: int
|
|
138
139
|
x1_offset: int
|
|
@@ -141,7 +142,8 @@ class ModelFile(_message.Message):
|
|
|
141
142
|
y2_offset: int
|
|
142
143
|
confidence_offset: int
|
|
143
144
|
class_label_index_offset: int
|
|
144
|
-
|
|
145
|
+
batch_index_offset: int
|
|
146
|
+
def __init__(self, number_of_boxes: _Optional[int] = ..., stride: _Optional[int] = ..., x1_offset: _Optional[int] = ..., y1_offset: _Optional[int] = ..., x2_offset: _Optional[int] = ..., y2_offset: _Optional[int] = ..., confidence_offset: _Optional[int] = ..., class_label_index_offset: _Optional[int] = ..., batch_index_offset: _Optional[int] = ...) -> None: ...
|
|
145
147
|
class BoundingBoxSegmentationsOutputFormat(_message.Message):
|
|
146
148
|
__slots__ = ("image_size", "relative_to_bounding_box")
|
|
147
149
|
IMAGE_SIZE_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -4,7 +4,7 @@ denkproto/DENKbuffer_pb2_grpc.py,sha256=-CPJPM4FOqwvwV8-f1iJlD18UD9juVIIHfdWUecu
|
|
|
4
4
|
denkproto/ImageAnalysis_ProtobufMessages_pb2.py,sha256=iEY0j9ySGUThnqTdYD4uAVr9P3GiC5R02iK53zEOXUQ,21015
|
|
5
5
|
denkproto/ImageAnalysis_ProtobufMessages_pb2.pyi,sha256=5LFtxrmYpJHizDDNGFTkL7-NQ_TkwqCSdq7vcv3lg-c,36243
|
|
6
6
|
denkproto/ImageAnalysis_ProtobufMessages_pb2_grpc.py,sha256=l3agtDjgu4jay6P9TRnHhyhJ-7UdoII27ywhw3k84oo,911
|
|
7
|
-
denkproto/__about__.py,sha256=
|
|
7
|
+
denkproto/__about__.py,sha256=2DUObEwLNvKLYm4zUMNwCtyPL1NYz7E03pnCYA8NfhE,23
|
|
8
8
|
denkproto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
denkproto/denkcache_pb2.py,sha256=fvrIvDfK8ED_w0EfO0tIrLMsBh2T5yvVI-sNFCK7NEQ,6627
|
|
10
10
|
denkproto/denkcache_pb2.pyi,sha256=qOzFOkddUapSJZz5d_mqcfHvWDAmM-70m_7FeM7n5fI,5595
|
|
@@ -15,13 +15,18 @@ denkproto/inference_graph_pb2_grpc.py,sha256=aXPf0w7pIfspkKUKGCr--OtJMOaTfE8Ibeu
|
|
|
15
15
|
denkproto/modelfile_v1_pb2.py,sha256=ulF24nSIspn46DnQKlvR5Po3w-vFCnawuuverAVi3cY,6573
|
|
16
16
|
denkproto/modelfile_v1_pb2.pyi,sha256=gjTbWvg48wqGhyJb5CT0pw3yUZGhO_lSZgL7Ia2aPbY,10685
|
|
17
17
|
denkproto/modelfile_v1_pb2_grpc.py,sha256=ov5B2o4JSYbAfcbbdZr55wEzfGlKI02H-tkvXGXqJVg,893
|
|
18
|
-
denkproto/modelfile_v2_pb2.py,sha256=
|
|
19
|
-
denkproto/modelfile_v2_pb2.pyi,sha256=
|
|
18
|
+
denkproto/modelfile_v2_pb2.py,sha256=ccdYwtqbpRXJGBEmE5RTvm9HIEIcfYOR6U-QH6c2Naw,12415
|
|
19
|
+
denkproto/modelfile_v2_pb2.pyi,sha256=mURpurlLH3cwteYqig5UxyFjVovTIdDbw4Zk-VGWbeQ,19962
|
|
20
20
|
denkproto/modelfile_v2_pb2_grpc.py,sha256=xiC5FeyZDWcucC3uRJ4kllDJmaRayvrzOKIhvg6o1Tc,893
|
|
21
21
|
denkproto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
denkproto/results_pb2.py,sha256=rBZ4HIHgdKHdASDbF8mTmZ0_xi1ffq3YJ2g_cvzIlhk,14109
|
|
23
23
|
denkproto/results_pb2.pyi,sha256=8l1v1QenLzWlYnQtnCBqzXMMHUagOTalq9xJKfK6FKo,26711
|
|
24
24
|
denkproto/results_pb2_grpc.py,sha256=z-4qcDMjjuPRy7lDtECTtReByVEyz3fjIPES9dMlO58,888
|
|
25
|
-
denkproto
|
|
26
|
-
denkproto
|
|
27
|
-
denkproto
|
|
25
|
+
denkproto/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
+
denkproto/json/classification_markup.py,sha256=vTu0H7Cb3gU6UUUSg1vDTRlFUorZrjMbcp_yx6UssZA,2461
|
|
27
|
+
denkproto/json/object_detection_markup.py,sha256=T0hcFPq8F_galjDjRC9dbcRVwCSOYtu2jt9wpEeHlQs,4904
|
|
28
|
+
denkproto/json/ocr_markup.py,sha256=IaWbTCcJbLnS0e4u0PB1m8F-UpEwaQNTexVYKdXUPHI,5771
|
|
29
|
+
denkproto/json/segmentation_markup.py,sha256=AQLZ-m7hq1hMPc9kLwhETaFPmTXfV3Omah5CIi-cJF0,19893
|
|
30
|
+
denkproto-1.0.55.dist-info/METADATA,sha256=AFOKpt_vbco5lDLcaUQ-6974tk6VwqykEKJRz8sYQiU,110
|
|
31
|
+
denkproto-1.0.55.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
32
|
+
denkproto-1.0.55.dist-info/RECORD,,
|
|
File without changes
|