valor-lite 0.33.13__py3-none-any.whl → 0.33.15__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.
- valor_lite/classification/__init__.py +8 -21
- valor_lite/classification/computation.py +2 -2
- valor_lite/classification/manager.py +32 -244
- valor_lite/classification/metric.py +331 -372
- valor_lite/classification/utilities.py +222 -0
- valor_lite/object_detection/__init__.py +4 -35
- valor_lite/object_detection/computation.py +25 -22
- valor_lite/object_detection/manager.py +38 -497
- valor_lite/object_detection/metric.py +633 -706
- valor_lite/object_detection/utilities.py +505 -0
- valor_lite/schemas.py +10 -8
- valor_lite/semantic_segmentation/__init__.py +2 -17
- valor_lite/semantic_segmentation/computation.py +1 -1
- valor_lite/semantic_segmentation/manager.py +13 -116
- valor_lite/semantic_segmentation/metric.py +216 -239
- valor_lite/semantic_segmentation/utilities.py +104 -0
- {valor_lite-0.33.13.dist-info → valor_lite-0.33.15.dist-info}/METADATA +1 -1
- valor_lite-0.33.15.dist-info/RECORD +27 -0
- valor_lite-0.33.13.dist-info/RECORD +0 -24
- {valor_lite-0.33.13.dist-info → valor_lite-0.33.15.dist-info}/LICENSE +0 -0
- {valor_lite-0.33.13.dist-info → valor_lite-0.33.15.dist-info}/WHEEL +0 -0
- {valor_lite-0.33.13.dist-info → valor_lite-0.33.15.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy.typing import NDArray
|
|
5
|
+
from valor_lite.semantic_segmentation.metric import Metric, MetricType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def unpack_precision_recall_iou_into_metric_lists(
|
|
9
|
+
results: tuple,
|
|
10
|
+
label_metadata: NDArray[np.int32],
|
|
11
|
+
index_to_label: dict[int, str],
|
|
12
|
+
) -> dict[MetricType, list[Metric]]:
|
|
13
|
+
|
|
14
|
+
n_labels = len(index_to_label)
|
|
15
|
+
(
|
|
16
|
+
precision,
|
|
17
|
+
recall,
|
|
18
|
+
f1_score,
|
|
19
|
+
accuracy,
|
|
20
|
+
ious,
|
|
21
|
+
hallucination_ratios,
|
|
22
|
+
missing_prediction_ratios,
|
|
23
|
+
) = results
|
|
24
|
+
|
|
25
|
+
metrics = defaultdict(list)
|
|
26
|
+
|
|
27
|
+
metrics[MetricType.Accuracy] = [
|
|
28
|
+
Metric.accuracy(
|
|
29
|
+
value=float(accuracy),
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
metrics[MetricType.ConfusionMatrix] = [
|
|
34
|
+
Metric.confusion_matrix(
|
|
35
|
+
confusion_matrix={
|
|
36
|
+
index_to_label[gt_label_idx]: {
|
|
37
|
+
index_to_label[pd_label_idx]: {
|
|
38
|
+
"iou": float(ious[gt_label_idx, pd_label_idx])
|
|
39
|
+
}
|
|
40
|
+
for pd_label_idx in range(n_labels)
|
|
41
|
+
if label_metadata[pd_label_idx, 0] > 0
|
|
42
|
+
}
|
|
43
|
+
for gt_label_idx in range(n_labels)
|
|
44
|
+
if label_metadata[gt_label_idx, 0] > 0
|
|
45
|
+
},
|
|
46
|
+
hallucinations={
|
|
47
|
+
index_to_label[pd_label_idx]: {
|
|
48
|
+
"ratio": float(hallucination_ratios[pd_label_idx])
|
|
49
|
+
}
|
|
50
|
+
for pd_label_idx in range(n_labels)
|
|
51
|
+
if label_metadata[pd_label_idx, 0] > 0
|
|
52
|
+
},
|
|
53
|
+
missing_predictions={
|
|
54
|
+
index_to_label[gt_label_idx]: {
|
|
55
|
+
"ratio": float(missing_prediction_ratios[gt_label_idx])
|
|
56
|
+
}
|
|
57
|
+
for gt_label_idx in range(n_labels)
|
|
58
|
+
if label_metadata[gt_label_idx, 0] > 0
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
metrics[MetricType.mIOU] = [
|
|
64
|
+
Metric.mean_iou(
|
|
65
|
+
value=float(ious.diagonal().mean()),
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
for label_idx, label in index_to_label.items():
|
|
70
|
+
|
|
71
|
+
kwargs = {
|
|
72
|
+
"label": label,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
# if no groundtruths exists for a label, skip it.
|
|
76
|
+
if label_metadata[label_idx, 0] == 0:
|
|
77
|
+
continue
|
|
78
|
+
|
|
79
|
+
metrics[MetricType.Precision].append(
|
|
80
|
+
Metric.precision(
|
|
81
|
+
value=float(precision[label_idx]),
|
|
82
|
+
**kwargs,
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
metrics[MetricType.Recall].append(
|
|
86
|
+
Metric.recall(
|
|
87
|
+
value=float(recall[label_idx]),
|
|
88
|
+
**kwargs,
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
metrics[MetricType.F1].append(
|
|
92
|
+
Metric.f1_score(
|
|
93
|
+
value=float(f1_score[label_idx]),
|
|
94
|
+
**kwargs,
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
metrics[MetricType.IOU].append(
|
|
98
|
+
Metric.iou(
|
|
99
|
+
value=float(ious[label_idx, label_idx]),
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
return metrics
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
valor_lite/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
2
|
+
valor_lite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
valor_lite/schemas.py,sha256=hcCFJ4ZywlFCqhx0om80Uf4xpASYPvs2vpP1yOUIqaE,403
|
|
4
|
+
valor_lite/classification/__init__.py,sha256=8MI8bGwCxYGqRP7KxG7ezhYv4qQ5947XGvvlF8WPM5g,392
|
|
5
|
+
valor_lite/classification/annotation.py,sha256=0aUOvcwBAZgiNOJuyh-pXyNTG7vP7r8CUfnU3OmpUwQ,1113
|
|
6
|
+
valor_lite/classification/computation.py,sha256=qfBhhuDYCiY8h2RdBG3shzgJbHLXDVNujkYFg9xZa6U,12116
|
|
7
|
+
valor_lite/classification/manager.py,sha256=8GXZECSx4CBbG5NfPrA19BPENqmrjo-wZBmaulWHY20,16676
|
|
8
|
+
valor_lite/classification/metric.py,sha256=0ZGp7Wm4oc0h_EBiYfVEs39QEeL5xa-F27gig7smnq8,11409
|
|
9
|
+
valor_lite/classification/utilities.py,sha256=PmQar06Vt-ew4Jvnn0IM63mq730QVTsdRtFdVu1HMFU,6885
|
|
10
|
+
valor_lite/object_detection/__init__.py,sha256=Ql8rju2q7y0Zd9zFvtBJDRhgQFDm1RSYkTsyH3ZE6pA,648
|
|
11
|
+
valor_lite/object_detection/annotation.py,sha256=o6VfiRobiB0ljqsNBLAYMXgi32RSIR7uTA-dgxq6zBI,8248
|
|
12
|
+
valor_lite/object_detection/computation.py,sha256=P5ijxEBuZ3mxYjBQy24TiQpGxRmPuS40Gwn44uv0J7M,28064
|
|
13
|
+
valor_lite/object_detection/manager.py,sha256=YjM9Kx3xrIt2VMjNZ-8guPchPq7YBABlams_7eZvYVY,23298
|
|
14
|
+
valor_lite/object_detection/metric.py,sha256=QbxYTOykysshhpdVJjxMPnw8hvcAv4SM3sXDZj8OwnE,23967
|
|
15
|
+
valor_lite/object_detection/utilities.py,sha256=98VSW-g8EYI8Cdd9KHLHdm6F4fI89jaX5I4z99zny4s,16271
|
|
16
|
+
valor_lite/semantic_segmentation/__init__.py,sha256=HQQkr3iBPQfdUrsu0uvx-Uyv9SYmumU1B3slbWOnpNY,245
|
|
17
|
+
valor_lite/semantic_segmentation/annotation.py,sha256=CujYFdHS3fgr4Y7mEDs_u1XBmbPJzNU2CdqvjCT_d_A,2938
|
|
18
|
+
valor_lite/semantic_segmentation/computation.py,sha256=rrql3zmpqt4Zygc2BD4SyUfNW_NXC93_kHB-lGBzjXU,5122
|
|
19
|
+
valor_lite/semantic_segmentation/manager.py,sha256=pMepH3zk_fApyFtC9tLrmEYuCbg1n5TLh1J8QRadE44,14287
|
|
20
|
+
valor_lite/semantic_segmentation/metric.py,sha256=i8uTcalwvzK7CDHJ_8I-zplWe-qrMtXwH_5ZcTBi3M8,6219
|
|
21
|
+
valor_lite/semantic_segmentation/utilities.py,sha256=vZM66YNMz9VJclhuKvcWp74nF65s6bscnnD5U9iDW7Q,2925
|
|
22
|
+
valor_lite/text_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
valor_lite-0.33.15.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
24
|
+
valor_lite-0.33.15.dist-info/METADATA,sha256=7vxvGO1Gc3A0CoRu-T42OA1IM0ksQOjkL13kPZTkcaY,5632
|
|
25
|
+
valor_lite-0.33.15.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
26
|
+
valor_lite-0.33.15.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
|
|
27
|
+
valor_lite-0.33.15.dist-info/RECORD,,
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
valor_lite/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
2
|
-
valor_lite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
valor_lite/schemas.py,sha256=r4cC10w1xYsA785KmGE4ePeOX3wzEs846vT7QAiVg_I,293
|
|
4
|
-
valor_lite/classification/__init__.py,sha256=2wmmziIzUATm7MbmAcPNLXrEX5l4oeD7XBwPd9bWM3Q,506
|
|
5
|
-
valor_lite/classification/annotation.py,sha256=0aUOvcwBAZgiNOJuyh-pXyNTG7vP7r8CUfnU3OmpUwQ,1113
|
|
6
|
-
valor_lite/classification/computation.py,sha256=pMePRFKCikYiGDgR-ZB8TmrzAts5ZIz4EywCT-XL42g,12100
|
|
7
|
-
valor_lite/classification/manager.py,sha256=fwb5z84SzgJ-ud1kTY3oYbUJLbA7R0cdWqqcaAIUcWs,23222
|
|
8
|
-
valor_lite/classification/metric.py,sha256=JjY9x6Sq1Hr_2agGnyT9EhVI5wXKQcMmEwxIK32yhGw,11903
|
|
9
|
-
valor_lite/object_detection/__init__.py,sha256=PiKfemo8FkZRzBhPSjhil8ahGURLy0Vk_iV25CB4UBU,1139
|
|
10
|
-
valor_lite/object_detection/annotation.py,sha256=o6VfiRobiB0ljqsNBLAYMXgi32RSIR7uTA-dgxq6zBI,8248
|
|
11
|
-
valor_lite/object_detection/computation.py,sha256=dbwyBgRQqG47R8FINd0vQq10b85rsq0jZH4M81KQT24,28017
|
|
12
|
-
valor_lite/object_detection/manager.py,sha256=gjKpytNldF51V_xUktJHrLRDQme-AkZ3HpiL8uMnYJY,39156
|
|
13
|
-
valor_lite/object_detection/metric.py,sha256=SS3U-HV3QgHoN3hcY2DmLl5GzK4KyvC78vjXTIa7XAU,24330
|
|
14
|
-
valor_lite/semantic_segmentation/__init__.py,sha256=IdarTHKUuUMDvMBmInQu12Mm_NMCbql6Hf0nL5b56Ak,424
|
|
15
|
-
valor_lite/semantic_segmentation/annotation.py,sha256=CujYFdHS3fgr4Y7mEDs_u1XBmbPJzNU2CdqvjCT_d_A,2938
|
|
16
|
-
valor_lite/semantic_segmentation/computation.py,sha256=iJkEmTNmw9HwQCxSnpJkQsAdVcFriGhhu_WMks6D7tU,5122
|
|
17
|
-
valor_lite/semantic_segmentation/manager.py,sha256=aJk6edWZWKqrzl6hVmEUSZVYhHLuyihxWgAIXsCXkZ0,17361
|
|
18
|
-
valor_lite/semantic_segmentation/metric.py,sha256=Y8M3z92SaABEe9TwBUN37TFsh9DR5WoIxO-TfXVwz8I,6289
|
|
19
|
-
valor_lite/text_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
valor_lite-0.33.13.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
21
|
-
valor_lite-0.33.13.dist-info/METADATA,sha256=4WsoZ-i3KETNN5d1F333ZJvhGPj1tiGEAzSTjrOW7yk,5632
|
|
22
|
-
valor_lite-0.33.13.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
23
|
-
valor_lite-0.33.13.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
|
|
24
|
-
valor_lite-0.33.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|