denkproto 1.0.91__py3-none-any.whl → 1.0.92__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/annotation_comparer_request.py +1010 -0
- denkproto/json/ocr_prediction_request.py +506 -0
- denkproto/json/prediction_request.py +259 -0
- {denkproto-1.0.91.dist-info → denkproto-1.0.92.dist-info}/METADATA +1 -1
- {denkproto-1.0.91.dist-info → denkproto-1.0.92.dist-info}/RECORD +7 -4
- {denkproto-1.0.91.dist-info → denkproto-1.0.92.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
from uuid import UUID
|
|
2
|
+
from typing import Any, Dict, List, TypeVar, Callable, Type, cast
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def from_int(x: Any) -> int:
|
|
9
|
+
assert isinstance(x, int) and not isinstance(x, bool)
|
|
10
|
+
return x
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]:
|
|
14
|
+
assert isinstance(x, dict)
|
|
15
|
+
return { k: f(v) for (k, v) in x.items() }
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def from_bool(x: Any) -> bool:
|
|
19
|
+
assert isinstance(x, bool)
|
|
20
|
+
return 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_list(f: Callable[[Any], T], x: Any) -> List[T]:
|
|
29
|
+
assert isinstance(x, list)
|
|
30
|
+
return [f(y) for y in x]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def from_str(x: Any) -> str:
|
|
34
|
+
assert isinstance(x, str)
|
|
35
|
+
return x
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Image:
|
|
39
|
+
blob_id: UUID
|
|
40
|
+
height: int
|
|
41
|
+
owned_by_group_id: UUID
|
|
42
|
+
width: int
|
|
43
|
+
|
|
44
|
+
def __init__(self, blob_id: UUID, height: int, owned_by_group_id: UUID, width: int) -> None:
|
|
45
|
+
self.blob_id = blob_id
|
|
46
|
+
self.height = height
|
|
47
|
+
self.owned_by_group_id = owned_by_group_id
|
|
48
|
+
self.width = width
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def from_dict(obj: Any) -> 'Image':
|
|
52
|
+
assert isinstance(obj, dict)
|
|
53
|
+
blob_id = UUID(obj.get("blob_id"))
|
|
54
|
+
height = from_int(obj.get("height"))
|
|
55
|
+
owned_by_group_id = UUID(obj.get("owned_by_group_id"))
|
|
56
|
+
width = from_int(obj.get("width"))
|
|
57
|
+
return Image(blob_id, height, owned_by_group_id, width)
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> dict:
|
|
60
|
+
result: dict = {}
|
|
61
|
+
result["blob_id"] = str(self.blob_id)
|
|
62
|
+
result["height"] = from_int(self.height)
|
|
63
|
+
result["owned_by_group_id"] = str(self.owned_by_group_id)
|
|
64
|
+
result["width"] = from_int(self.width)
|
|
65
|
+
return result
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ClassLabel:
|
|
69
|
+
id: UUID
|
|
70
|
+
idx: int
|
|
71
|
+
|
|
72
|
+
def __init__(self, id: UUID, idx: int) -> None:
|
|
73
|
+
self.id = id
|
|
74
|
+
self.idx = idx
|
|
75
|
+
|
|
76
|
+
@staticmethod
|
|
77
|
+
def from_dict(obj: Any) -> 'ClassLabel':
|
|
78
|
+
assert isinstance(obj, dict)
|
|
79
|
+
id = UUID(obj.get("id"))
|
|
80
|
+
idx = from_int(obj.get("idx"))
|
|
81
|
+
return ClassLabel(id, idx)
|
|
82
|
+
|
|
83
|
+
def to_dict(self) -> dict:
|
|
84
|
+
result: dict = {}
|
|
85
|
+
result["id"] = str(self.id)
|
|
86
|
+
result["idx"] = from_int(self.idx)
|
|
87
|
+
return result
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Config:
|
|
91
|
+
metadata: Dict[str, Any]
|
|
92
|
+
uses_validation_tiling: bool
|
|
93
|
+
|
|
94
|
+
def __init__(self, metadata: Dict[str, Any], uses_validation_tiling: bool) -> None:
|
|
95
|
+
self.metadata = metadata
|
|
96
|
+
self.uses_validation_tiling = uses_validation_tiling
|
|
97
|
+
|
|
98
|
+
@staticmethod
|
|
99
|
+
def from_dict(obj: Any) -> 'Config':
|
|
100
|
+
assert isinstance(obj, dict)
|
|
101
|
+
metadata = from_dict(lambda x: x, obj.get("metadata"))
|
|
102
|
+
uses_validation_tiling = from_bool(obj.get("uses_validation_tiling"))
|
|
103
|
+
return Config(metadata, uses_validation_tiling)
|
|
104
|
+
|
|
105
|
+
def to_dict(self) -> dict:
|
|
106
|
+
result: dict = {}
|
|
107
|
+
result["metadata"] = from_dict(lambda x: x, self.metadata)
|
|
108
|
+
result["uses_validation_tiling"] = from_bool(self.uses_validation_tiling)
|
|
109
|
+
return result
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class Onnx:
|
|
113
|
+
blob_id: UUID
|
|
114
|
+
owned_by_group_id: UUID
|
|
115
|
+
|
|
116
|
+
def __init__(self, blob_id: UUID, owned_by_group_id: UUID) -> None:
|
|
117
|
+
self.blob_id = blob_id
|
|
118
|
+
self.owned_by_group_id = owned_by_group_id
|
|
119
|
+
|
|
120
|
+
@staticmethod
|
|
121
|
+
def from_dict(obj: Any) -> 'Onnx':
|
|
122
|
+
assert isinstance(obj, dict)
|
|
123
|
+
blob_id = UUID(obj.get("blob_id"))
|
|
124
|
+
owned_by_group_id = UUID(obj.get("owned_by_group_id"))
|
|
125
|
+
return Onnx(blob_id, owned_by_group_id)
|
|
126
|
+
|
|
127
|
+
def to_dict(self) -> dict:
|
|
128
|
+
result: dict = {}
|
|
129
|
+
result["blob_id"] = str(self.blob_id)
|
|
130
|
+
result["owned_by_group_id"] = str(self.owned_by_group_id)
|
|
131
|
+
return result
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class Pytorch:
|
|
135
|
+
blob_id: UUID
|
|
136
|
+
owned_by_group_id: UUID
|
|
137
|
+
|
|
138
|
+
def __init__(self, blob_id: UUID, owned_by_group_id: UUID) -> None:
|
|
139
|
+
self.blob_id = blob_id
|
|
140
|
+
self.owned_by_group_id = owned_by_group_id
|
|
141
|
+
|
|
142
|
+
@staticmethod
|
|
143
|
+
def from_dict(obj: Any) -> 'Pytorch':
|
|
144
|
+
assert isinstance(obj, dict)
|
|
145
|
+
blob_id = UUID(obj.get("blob_id"))
|
|
146
|
+
owned_by_group_id = UUID(obj.get("owned_by_group_id"))
|
|
147
|
+
return Pytorch(blob_id, owned_by_group_id)
|
|
148
|
+
|
|
149
|
+
def to_dict(self) -> dict:
|
|
150
|
+
result: dict = {}
|
|
151
|
+
result["blob_id"] = str(self.blob_id)
|
|
152
|
+
result["owned_by_group_id"] = str(self.owned_by_group_id)
|
|
153
|
+
return result
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class Snapshot:
|
|
157
|
+
onnx: Onnx
|
|
158
|
+
pytorch: Pytorch
|
|
159
|
+
|
|
160
|
+
def __init__(self, onnx: Onnx, pytorch: Pytorch) -> None:
|
|
161
|
+
self.onnx = onnx
|
|
162
|
+
self.pytorch = pytorch
|
|
163
|
+
|
|
164
|
+
@staticmethod
|
|
165
|
+
def from_dict(obj: Any) -> 'Snapshot':
|
|
166
|
+
assert isinstance(obj, dict)
|
|
167
|
+
onnx = Onnx.from_dict(obj.get("onnx"))
|
|
168
|
+
pytorch = Pytorch.from_dict(obj.get("pytorch"))
|
|
169
|
+
return Snapshot(onnx, pytorch)
|
|
170
|
+
|
|
171
|
+
def to_dict(self) -> dict:
|
|
172
|
+
result: dict = {}
|
|
173
|
+
result["onnx"] = to_class(Onnx, self.onnx)
|
|
174
|
+
result["pytorch"] = to_class(Pytorch, self.pytorch)
|
|
175
|
+
return result
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class NetworkExperiment:
|
|
179
|
+
class_labels: List[ClassLabel]
|
|
180
|
+
config: Config
|
|
181
|
+
flavor: str
|
|
182
|
+
network_typename: str
|
|
183
|
+
snapshot: Snapshot
|
|
184
|
+
|
|
185
|
+
def __init__(self, class_labels: List[ClassLabel], config: Config, flavor: str, network_typename: str, snapshot: Snapshot) -> None:
|
|
186
|
+
self.class_labels = class_labels
|
|
187
|
+
self.config = config
|
|
188
|
+
self.flavor = flavor
|
|
189
|
+
self.network_typename = network_typename
|
|
190
|
+
self.snapshot = snapshot
|
|
191
|
+
|
|
192
|
+
@staticmethod
|
|
193
|
+
def from_dict(obj: Any) -> 'NetworkExperiment':
|
|
194
|
+
assert isinstance(obj, dict)
|
|
195
|
+
class_labels = from_list(ClassLabel.from_dict, obj.get("class_labels"))
|
|
196
|
+
config = Config.from_dict(obj.get("config"))
|
|
197
|
+
flavor = from_str(obj.get("flavor"))
|
|
198
|
+
network_typename = from_str(obj.get("network_typename"))
|
|
199
|
+
snapshot = Snapshot.from_dict(obj.get("snapshot"))
|
|
200
|
+
return NetworkExperiment(class_labels, config, flavor, network_typename, snapshot)
|
|
201
|
+
|
|
202
|
+
def to_dict(self) -> dict:
|
|
203
|
+
result: dict = {}
|
|
204
|
+
result["class_labels"] = from_list(lambda x: to_class(ClassLabel, x), self.class_labels)
|
|
205
|
+
result["config"] = to_class(Config, self.config)
|
|
206
|
+
result["flavor"] = from_str(self.flavor)
|
|
207
|
+
result["network_typename"] = from_str(self.network_typename)
|
|
208
|
+
result["snapshot"] = to_class(Snapshot, self.snapshot)
|
|
209
|
+
return result
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class PredictionRequest:
|
|
213
|
+
created_by_user_id: UUID
|
|
214
|
+
id: UUID
|
|
215
|
+
image: Image
|
|
216
|
+
network_experiment: NetworkExperiment
|
|
217
|
+
owned_by_group_id: UUID
|
|
218
|
+
prediction_priority: int
|
|
219
|
+
request_classification_interpretation: bool
|
|
220
|
+
|
|
221
|
+
def __init__(self, created_by_user_id: UUID, id: UUID, image: Image, network_experiment: NetworkExperiment, owned_by_group_id: UUID, prediction_priority: int, request_classification_interpretation: bool) -> None:
|
|
222
|
+
self.created_by_user_id = created_by_user_id
|
|
223
|
+
self.id = id
|
|
224
|
+
self.image = image
|
|
225
|
+
self.network_experiment = network_experiment
|
|
226
|
+
self.owned_by_group_id = owned_by_group_id
|
|
227
|
+
self.prediction_priority = prediction_priority
|
|
228
|
+
self.request_classification_interpretation = request_classification_interpretation
|
|
229
|
+
|
|
230
|
+
@staticmethod
|
|
231
|
+
def from_dict(obj: Any) -> 'PredictionRequest':
|
|
232
|
+
assert isinstance(obj, dict)
|
|
233
|
+
created_by_user_id = UUID(obj.get("created_by_user_id"))
|
|
234
|
+
id = UUID(obj.get("id"))
|
|
235
|
+
image = Image.from_dict(obj.get("image"))
|
|
236
|
+
network_experiment = NetworkExperiment.from_dict(obj.get("network_experiment"))
|
|
237
|
+
owned_by_group_id = UUID(obj.get("owned_by_group_id"))
|
|
238
|
+
prediction_priority = from_int(obj.get("prediction_priority"))
|
|
239
|
+
request_classification_interpretation = from_bool(obj.get("request_classification_interpretation"))
|
|
240
|
+
return PredictionRequest(created_by_user_id, id, image, network_experiment, owned_by_group_id, prediction_priority, request_classification_interpretation)
|
|
241
|
+
|
|
242
|
+
def to_dict(self) -> dict:
|
|
243
|
+
result: dict = {}
|
|
244
|
+
result["created_by_user_id"] = str(self.created_by_user_id)
|
|
245
|
+
result["id"] = str(self.id)
|
|
246
|
+
result["image"] = to_class(Image, self.image)
|
|
247
|
+
result["network_experiment"] = to_class(NetworkExperiment, self.network_experiment)
|
|
248
|
+
result["owned_by_group_id"] = str(self.owned_by_group_id)
|
|
249
|
+
result["prediction_priority"] = from_int(self.prediction_priority)
|
|
250
|
+
result["request_classification_interpretation"] = from_bool(self.request_classification_interpretation)
|
|
251
|
+
return result
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def prediction_request_from_dict(s: Any) -> PredictionRequest:
|
|
255
|
+
return PredictionRequest.from_dict(s)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def prediction_request_to_dict(x: PredictionRequest) -> Any:
|
|
259
|
+
return to_class(PredictionRequest, x)
|
|
@@ -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=LDgxmn6SiEEtSki6rD4s68kC-IpEPy_PKbB1lWh4NBQ,23
|
|
8
8
|
denkproto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
denkproto/denkcache_pb2.py,sha256=u0O26m7t4kfu4R1nx1ZcTst4n6pG32pMbhl2PGYivXE,7161
|
|
10
10
|
denkproto/denkcache_pb2.pyi,sha256=8K_Ebyy4mgXrxqJenN8f8LXLvVKOiaZxhmGeYjFZVpY,6357
|
|
@@ -26,11 +26,14 @@ denkproto/validate_pb2.py,sha256=CuGAaHir9X9jniW3QsRKAESjYzoS2U6dLk_J55XmNqU,136
|
|
|
26
26
|
denkproto/validate_pb2.pyi,sha256=fWsdVOR3NJDioCKkCKfxfl4qaEb5xqXXU_WlEbdQx6E,23077
|
|
27
27
|
denkproto/validate_pb2_grpc.py,sha256=XvjuWEgJFJtH1E7HWm7SKpV10PMpOSbonKa2VPHpYy8,889
|
|
28
28
|
denkproto/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
+
denkproto/json/annotation_comparer_request.py,sha256=-sWJvUj9EZ46ru78CFjllBws9KfZWSfG3zOj71Ip77A,39437
|
|
29
30
|
denkproto/json/classification_markup.py,sha256=vTu0H7Cb3gU6UUUSg1vDTRlFUorZrjMbcp_yx6UssZA,2461
|
|
30
31
|
denkproto/json/inference_graph_models_generated.py,sha256=GfsGk4bKbL8gyqOScA4x13P8sJrAmv3tEhNU36rbIDs,6313
|
|
31
32
|
denkproto/json/object_detection_markup.py,sha256=T0hcFPq8F_galjDjRC9dbcRVwCSOYtu2jt9wpEeHlQs,4904
|
|
32
33
|
denkproto/json/ocr_markup.py,sha256=KyOpth9evOekyhTJdZSnYyB9EIyoWbY33sqncb_jBgw,7069
|
|
34
|
+
denkproto/json/ocr_prediction_request.py,sha256=t0DsoCKDxA0fSc77VGy_9bfS8H2cswa6gkWUsMR_F3A,17587
|
|
35
|
+
denkproto/json/prediction_request.py,sha256=3_9dZq38hd-sLvOT6Jcb5s5WGa9TdEflQ6e0Mfj8mOg,8643
|
|
33
36
|
denkproto/json/segmentation_markup.py,sha256=EvniRksF2KaQolm6zZ6UKSiGwnqc8wR2sHB1iv05RTE,19911
|
|
34
|
-
denkproto-1.0.
|
|
35
|
-
denkproto-1.0.
|
|
36
|
-
denkproto-1.0.
|
|
37
|
+
denkproto-1.0.92.dist-info/METADATA,sha256=LgTO31cFeg3b9zbWAlzGEVi3n9THZCa7o5chRp1b-to,110
|
|
38
|
+
denkproto-1.0.92.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
39
|
+
denkproto-1.0.92.dist-info/RECORD,,
|
|
File without changes
|