valor-lite 0.33.7__py3-none-any.whl → 0.33.9__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.
@@ -1,408 +0,0 @@
1
- from dataclasses import dataclass
2
- from enum import Enum
3
-
4
- from valor_lite.schemas import Metric
5
-
6
-
7
- class MetricType(str, Enum):
8
- Counts = "Counts"
9
- Accuracy = "Accuracy"
10
- Precision = "Precision"
11
- Recall = "Recall"
12
- F1 = "F1"
13
- AP = "AP"
14
- AR = "AR"
15
- mAP = "mAP"
16
- mAR = "mAR"
17
- APAveragedOverIOUs = "APAveragedOverIOUs"
18
- mAPAveragedOverIOUs = "mAPAveragedOverIOUs"
19
- ARAveragedOverScores = "ARAveragedOverScores"
20
- mARAveragedOverScores = "mARAveragedOverScores"
21
- PrecisionRecallCurve = "PrecisionRecallCurve"
22
- ConfusionMatrix = "ConfusionMatrix"
23
-
24
- @classmethod
25
- def base_metrics(cls):
26
- return [
27
- cls.Counts,
28
- cls.Accuracy,
29
- cls.Precision,
30
- cls.Recall,
31
- cls.F1,
32
- cls.AP,
33
- cls.AR,
34
- cls.mAP,
35
- cls.mAR,
36
- cls.APAveragedOverIOUs,
37
- cls.mAPAveragedOverIOUs,
38
- cls.ARAveragedOverScores,
39
- cls.mARAveragedOverScores,
40
- cls.PrecisionRecallCurve,
41
- ]
42
-
43
-
44
- @dataclass
45
- class Counts:
46
- tp: int
47
- fp: int
48
- fn: int
49
- label: tuple[str, str]
50
- iou_threshold: float
51
- score_threshold: float
52
-
53
- @property
54
- def metric(self) -> Metric:
55
- return Metric(
56
- type=type(self).__name__,
57
- value={
58
- "tp": self.tp,
59
- "fp": self.fp,
60
- "fn": self.fn,
61
- },
62
- parameters={
63
- "iou_threshold": self.iou_threshold,
64
- "score_threshold": self.score_threshold,
65
- "label": {
66
- "key": self.label[0],
67
- "value": self.label[1],
68
- },
69
- },
70
- )
71
-
72
- def to_dict(self) -> dict:
73
- return self.metric.to_dict()
74
-
75
-
76
- @dataclass
77
- class ClassMetric:
78
- value: float
79
- label: tuple[str, str]
80
- iou_threshold: float
81
- score_threshold: float
82
-
83
- @property
84
- def metric(self) -> Metric:
85
- return Metric(
86
- type=type(self).__name__,
87
- value=self.value,
88
- parameters={
89
- "iou_threshold": self.iou_threshold,
90
- "score_threshold": self.score_threshold,
91
- "label": {
92
- "key": self.label[0],
93
- "value": self.label[1],
94
- },
95
- },
96
- )
97
-
98
- def to_dict(self) -> dict:
99
- return self.metric.to_dict()
100
-
101
-
102
- class Precision(ClassMetric):
103
- pass
104
-
105
-
106
- class Recall(ClassMetric):
107
- pass
108
-
109
-
110
- class Accuracy(ClassMetric):
111
- pass
112
-
113
-
114
- class F1(ClassMetric):
115
- pass
116
-
117
-
118
- @dataclass
119
- class AP:
120
- value: float
121
- iou_threshold: float
122
- label: tuple[str, str]
123
-
124
- @property
125
- def metric(self) -> Metric:
126
- return Metric(
127
- type=type(self).__name__,
128
- value=self.value,
129
- parameters={
130
- "iou_threshold": self.iou_threshold,
131
- "label": {
132
- "key": self.label[0],
133
- "value": self.label[1],
134
- },
135
- },
136
- )
137
-
138
- def to_dict(self) -> dict:
139
- return self.metric.to_dict()
140
-
141
-
142
- @dataclass
143
- class mAP:
144
- value: float
145
- iou_threshold: float
146
- label_key: str
147
-
148
- @property
149
- def metric(self) -> Metric:
150
- return Metric(
151
- type=type(self).__name__,
152
- value=self.value,
153
- parameters={
154
- "iou_threshold": self.iou_threshold,
155
- "label_key": self.label_key,
156
- },
157
- )
158
-
159
- def to_dict(self) -> dict:
160
- return self.metric.to_dict()
161
-
162
-
163
- @dataclass
164
- class APAveragedOverIOUs:
165
- value: float
166
- iou_thresholds: list[float]
167
- label: tuple[str, str]
168
-
169
- @property
170
- def metric(self) -> Metric:
171
- return Metric(
172
- type=type(self).__name__,
173
- value=self.value,
174
- parameters={
175
- "iou_thresholds": self.iou_thresholds,
176
- "label": {
177
- "key": self.label[0],
178
- "value": self.label[1],
179
- },
180
- },
181
- )
182
-
183
- def to_dict(self) -> dict:
184
- return self.metric.to_dict()
185
-
186
-
187
- @dataclass
188
- class mAPAveragedOverIOUs:
189
- value: float
190
- iou_thresholds: list[float]
191
- label_key: str
192
-
193
- @property
194
- def metric(self) -> Metric:
195
- return Metric(
196
- type=type(self).__name__,
197
- value=self.value,
198
- parameters={
199
- "iou_thresholds": self.iou_thresholds,
200
- "label_key": self.label_key,
201
- },
202
- )
203
-
204
- def to_dict(self) -> dict:
205
- return self.metric.to_dict()
206
-
207
-
208
- @dataclass
209
- class AR:
210
- value: float
211
- score_threshold: float
212
- iou_thresholds: list[float]
213
- label: tuple[str, str]
214
-
215
- @property
216
- def metric(self) -> Metric:
217
- return Metric(
218
- type=type(self).__name__,
219
- value=self.value,
220
- parameters={
221
- "score_threshold": self.score_threshold,
222
- "iou_thresholds": self.iou_thresholds,
223
- "label": {
224
- "key": self.label[0],
225
- "value": self.label[1],
226
- },
227
- },
228
- )
229
-
230
- def to_dict(self) -> dict:
231
- return self.metric.to_dict()
232
-
233
-
234
- @dataclass
235
- class mAR:
236
- value: float
237
- score_threshold: float
238
- iou_thresholds: list[float]
239
- label_key: str
240
-
241
- @property
242
- def metric(self) -> Metric:
243
- return Metric(
244
- type=type(self).__name__,
245
- value=self.value,
246
- parameters={
247
- "score_threshold": self.score_threshold,
248
- "iou_thresholds": self.iou_thresholds,
249
- "label_key": self.label_key,
250
- },
251
- )
252
-
253
- def to_dict(self) -> dict:
254
- return self.metric.to_dict()
255
-
256
-
257
- @dataclass
258
- class ARAveragedOverScores:
259
- value: float
260
- score_thresholds: list[float]
261
- iou_thresholds: list[float]
262
- label: tuple[str, str]
263
-
264
- @property
265
- def metric(self) -> Metric:
266
- return Metric(
267
- type=type(self).__name__,
268
- value=self.value,
269
- parameters={
270
- "score_thresholds": self.score_thresholds,
271
- "iou_thresholds": self.iou_thresholds,
272
- "label": {
273
- "key": self.label[0],
274
- "value": self.label[1],
275
- },
276
- },
277
- )
278
-
279
- def to_dict(self) -> dict:
280
- return self.metric.to_dict()
281
-
282
-
283
- @dataclass
284
- class mARAveragedOverScores:
285
- value: float
286
- score_thresholds: list[float]
287
- iou_thresholds: list[float]
288
- label_key: str
289
-
290
- @property
291
- def metric(self) -> Metric:
292
- return Metric(
293
- type=type(self).__name__,
294
- value=self.value,
295
- parameters={
296
- "score_thresholds": self.score_thresholds,
297
- "iou_thresholds": self.iou_thresholds,
298
- "label_key": self.label_key,
299
- },
300
- )
301
-
302
- def to_dict(self) -> dict:
303
- return self.metric.to_dict()
304
-
305
-
306
- @dataclass
307
- class PrecisionRecallCurve:
308
- """
309
- Interpolated over recalls 0.0, 0.01, ..., 1.0.
310
- """
311
-
312
- precision: list[float]
313
- iou_threshold: float
314
- label: tuple[str, str]
315
-
316
- @property
317
- def metric(self) -> Metric:
318
- return Metric(
319
- type=type(self).__name__,
320
- value=self.precision,
321
- parameters={
322
- "iou_threshold": self.iou_threshold,
323
- "label": {"key": self.label[0], "value": self.label[1]},
324
- },
325
- )
326
-
327
- def to_dict(self) -> dict:
328
- return self.metric.to_dict()
329
-
330
-
331
- @dataclass
332
- class ConfusionMatrix:
333
- confusion_matrix: dict[
334
- str, # ground truth label value
335
- dict[
336
- str, # prediction label value
337
- dict[
338
- str, # either `count` or `examples`
339
- int
340
- | list[
341
- dict[
342
- str, # either `datum`, `groundtruth`, `prediction` or score
343
- str # datum uid
344
- | tuple[
345
- float, float, float, float
346
- ] # bounding box (xmin, xmax, ymin, ymax)
347
- | float, # prediction score
348
- ]
349
- ],
350
- ],
351
- ],
352
- ]
353
- hallucinations: dict[
354
- str, # prediction label value
355
- dict[
356
- str, # either `count` or `examples`
357
- int
358
- | list[
359
- dict[
360
- str, # either `datum`, `prediction` or score
361
- str # datum uid
362
- | float # prediction score
363
- | tuple[
364
- float, float, float, float
365
- ], # bounding box (xmin, xmax, ymin, ymax)
366
- ]
367
- ],
368
- ],
369
- ]
370
- missing_predictions: dict[
371
- str, # ground truth label value
372
- dict[
373
- str, # either `count` or `examples`
374
- int
375
- | list[
376
- dict[
377
- str, # either `datum` or `groundtruth`
378
- str # datum uid
379
- | tuple[
380
- float, float, float, float
381
- ], # bounding box (xmin, xmax, ymin, ymax)
382
- ]
383
- ],
384
- ],
385
- ]
386
- score_threshold: float
387
- iou_threshold: float
388
- label_key: str
389
- number_of_examples: int
390
-
391
- @property
392
- def metric(self) -> Metric:
393
- return Metric(
394
- type=type(self).__name__,
395
- value={
396
- "confusion_matrix": self.confusion_matrix,
397
- "hallucinations": self.hallucinations,
398
- "missing_predictions": self.missing_predictions,
399
- },
400
- parameters={
401
- "score_threshold": self.score_threshold,
402
- "iou_threshold": self.iou_threshold,
403
- "label_key": self.label_key,
404
- },
405
- )
406
-
407
- def to_dict(self) -> dict:
408
- return self.metric.to_dict()
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: valor-lite
3
- Version: 0.33.7
4
- Summary: Compute valor metrics directly in your client.
5
- License: MIT License
6
-
7
- Copyright (c) 2023 Striveworks
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
27
- Project-URL: homepage, https://www.striveworks.com
28
- Requires-Python: >=3.10
29
- Description-Content-Type: text/markdown
30
- License-File: LICENSE
31
- Requires-Dist: Pillow >=9.1.0
32
- Requires-Dist: tqdm
33
- Requires-Dist: requests
34
- Requires-Dist: numpy
35
- Requires-Dist: shapely
36
- Requires-Dist: importlib-metadata ; python_version < "3.8"
37
- Provides-Extra: test
38
- Requires-Dist: pytest ; extra == 'test'
39
- Requires-Dist: coverage ; extra == 'test'
40
-
41
- # valor-lite: Compute classification, object detection, and segmentation metrics locally.
@@ -1,17 +0,0 @@
1
- valor_lite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- valor_lite/schemas.py,sha256=r4cC10w1xYsA785KmGE4ePeOX3wzEs846vT7QAiVg_I,293
3
- valor_lite/classification/__init__.py,sha256=2wmmziIzUATm7MbmAcPNLXrEX5l4oeD7XBwPd9bWM3Q,506
4
- valor_lite/classification/annotation.py,sha256=rMDTvPHdAlvJ6_M2kRrnJQnj1oqKe-lxbncWC7Q50RE,345
5
- valor_lite/classification/computation.py,sha256=pqAPX6zFlaWyYBnve4sdgJLba_m7smeaqZAsEBvi1no,12776
6
- valor_lite/classification/manager.py,sha256=Tx6SpEBnV17V-rT6b4MG5jQN-fqG2dlau2-aBnzF_mI,27965
7
- valor_lite/classification/metric.py,sha256=00qmagf-zQXUZ1qJW_UmN1k35aaYK_7GEM292Tc_cBE,4256
8
- valor_lite/detection/__init__.py,sha256=PiKfemo8FkZRzBhPSjhil8ahGURLy0Vk_iV25CB4UBU,1139
9
- valor_lite/detection/annotation.py,sha256=BspLc3SjWXj6qYlGGpzDPHEZ8j7CiFzIL5cNlk0WCAM,2732
10
- valor_lite/detection/computation.py,sha256=HDFfPTFQN2obm-g570KKDf7SP9V-h09OyMtFEJXsoTA,26323
11
- valor_lite/detection/manager.py,sha256=BnLqDGaP5h1aC5D_Vm6-oUYFlz-1yuQqlJAnQ1zztSI,53160
12
- valor_lite/detection/metric.py,sha256=RYKN17nEFRIZIqmotQa6OyNnU0nkjXyfFIclX_5hGpY,9933
13
- valor_lite-0.33.7.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
14
- valor_lite-0.33.7.dist-info/METADATA,sha256=EyxuCPqIDbQa4PAQ0utdpb0TVmZUn8TfwSTHnvoKXBc,1865
15
- valor_lite-0.33.7.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
16
- valor_lite-0.33.7.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
17
- valor_lite-0.33.7.dist-info/RECORD,,
File without changes