edgefirst-validator 4.2.1__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.
- deepview/modelpack/utils/argmax.py +16 -0
- edgefirst/validator/__init__.py +1 -0
- edgefirst/validator/__main__.py +375 -0
- edgefirst/validator/datasets/__init__.py +118 -0
- edgefirst/validator/datasets/cache.py +296 -0
- edgefirst/validator/datasets/core.py +250 -0
- edgefirst/validator/datasets/darknet.py +446 -0
- edgefirst/validator/datasets/database.py +1067 -0
- edgefirst/validator/datasets/instance/__init__.py +4 -0
- edgefirst/validator/datasets/instance/core.py +222 -0
- edgefirst/validator/datasets/instance/detection.py +145 -0
- edgefirst/validator/datasets/instance/multitask.py +80 -0
- edgefirst/validator/datasets/instance/segmentation.py +120 -0
- edgefirst/validator/datasets/utils/fetch.py +682 -0
- edgefirst/validator/datasets/utils/readers.py +425 -0
- edgefirst/validator/datasets/utils/transformations.py +1695 -0
- edgefirst/validator/evaluators/__init__.py +17 -0
- edgefirst/validator/evaluators/callbacks/__init__.py +3 -0
- edgefirst/validator/evaluators/callbacks/core.py +192 -0
- edgefirst/validator/evaluators/callbacks/plots.py +900 -0
- edgefirst/validator/evaluators/callbacks/studio.py +234 -0
- edgefirst/validator/evaluators/core.py +257 -0
- edgefirst/validator/evaluators/detection.py +749 -0
- edgefirst/validator/evaluators/multitask.py +270 -0
- edgefirst/validator/evaluators/parameters/__init__.py +53 -0
- edgefirst/validator/evaluators/parameters/core.py +554 -0
- edgefirst/validator/evaluators/parameters/dataset.py +239 -0
- edgefirst/validator/evaluators/parameters/model.py +338 -0
- edgefirst/validator/evaluators/parameters/validation.py +528 -0
- edgefirst/validator/evaluators/segmentation.py +729 -0
- edgefirst/validator/evaluators/utils/__init__.py +3 -0
- edgefirst/validator/evaluators/utils/classify.py +292 -0
- edgefirst/validator/evaluators/utils/match.py +262 -0
- edgefirst/validator/evaluators/utils/timer.py +132 -0
- edgefirst/validator/metrics/__init__.py +9 -0
- edgefirst/validator/metrics/data/__init__.py +7 -0
- edgefirst/validator/metrics/data/label.py +668 -0
- edgefirst/validator/metrics/data/metrics.py +759 -0
- edgefirst/validator/metrics/data/plots.py +476 -0
- edgefirst/validator/metrics/data/stats.py +507 -0
- edgefirst/validator/metrics/detection.py +595 -0
- edgefirst/validator/metrics/segmentation.py +173 -0
- edgefirst/validator/metrics/utils/math.py +717 -0
- edgefirst/validator/publishers/__init__.py +3 -0
- edgefirst/validator/publishers/console.py +147 -0
- edgefirst/validator/publishers/studio.py +128 -0
- edgefirst/validator/publishers/tensorboard.py +119 -0
- edgefirst/validator/publishers/utils/logger.py +111 -0
- edgefirst/validator/publishers/utils/table.py +403 -0
- edgefirst/validator/runners/__init__.py +8 -0
- edgefirst/validator/runners/core.py +727 -0
- edgefirst/validator/runners/deepviewrt.py +177 -0
- edgefirst/validator/runners/hailo.py +263 -0
- edgefirst/validator/runners/keras.py +150 -0
- edgefirst/validator/runners/kinara.py +265 -0
- edgefirst/validator/runners/offline.py +228 -0
- edgefirst/validator/runners/onnx.py +241 -0
- edgefirst/validator/runners/processing/decode.py +320 -0
- edgefirst/validator/runners/processing/dvapi.py +4192 -0
- edgefirst/validator/runners/processing/nms.py +637 -0
- edgefirst/validator/runners/processing/outputs.py +507 -0
- edgefirst/validator/runners/tensorrt.py +321 -0
- edgefirst/validator/runners/tflite.py +221 -0
- edgefirst/validator/validate.py +843 -0
- edgefirst/validator/visualize/__init__.py +3 -0
- edgefirst/validator/visualize/detection.py +623 -0
- edgefirst/validator/visualize/segmentation.py +281 -0
- edgefirst/validator/visualize/utils/plots.py +635 -0
- edgefirst_validator-4.2.1.dist-info/METADATA +111 -0
- edgefirst_validator-4.2.1.dist-info/RECORD +73 -0
- edgefirst_validator-4.2.1.dist-info/WHEEL +5 -0
- edgefirst_validator-4.2.1.dist-info/entry_points.txt +2 -0
- edgefirst_validator-4.2.1.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from edgefirst.validator.metrics import Metrics, MultitaskMetrics
|
|
7
|
+
from edgefirst.validator.evaluators import CombinedParameters
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parameters_table(parameters: CombinedParameters) -> str:
|
|
11
|
+
"""
|
|
12
|
+
Formats the parameters object into a string table.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
parameters: CombinedParameters
|
|
17
|
+
This contains the model, validation, and dataset parameters
|
|
18
|
+
set from the command line.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
str
|
|
23
|
+
The formatted parameters as a string table.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
if parameters.model.common.with_boxes:
|
|
27
|
+
table = \
|
|
28
|
+
f""" +--------------------------------------------------+
|
|
29
|
+
| engine: {str(parameters.model.engine).ljust(37)}|
|
|
30
|
+
| NMS: {str(parameters.model.nms).ljust(40)}|
|
|
31
|
+
| NMS max detections: {str(parameters.model.max_detections).ljust(25)}|
|
|
32
|
+
| NMS IoU threshold: {str(parameters.model.iou_threshold).ljust(26)}|
|
|
33
|
+
| NMS score threshold: {str(parameters.model.score_threshold).ljust(24)}|
|
|
34
|
+
| validation IoU threshold: {str(parameters.validation.iou_threshold).ljust(19)}|
|
|
35
|
+
| validation Score threshold: {str(parameters.validation.score_threshold).ljust(17)}|
|
|
36
|
+
| normalization: {str(parameters.model.common.norm).ljust(30)}|
|
|
37
|
+
| preprocessing: {str(parameters.model.common.preprocessing).ljust(30)}|
|
|
38
|
+
| backend: {str(parameters.dataset.common.backend).ljust(36)}|
|
|
39
|
+
| warmup: {str(parameters.model.warmup).ljust(37)}|
|
|
40
|
+
| metric: {str(parameters.validation.metric).ljust(37)}|"""
|
|
41
|
+
else:
|
|
42
|
+
table = \
|
|
43
|
+
f""" +--------------------------------------------------+
|
|
44
|
+
| engine: {str(parameters.model.engine).ljust(37)}|
|
|
45
|
+
| normalization: {str(parameters.model.common.norm).ljust(30)}|
|
|
46
|
+
| preprocessing: {str(parameters.model.common.preprocessing).ljust(30)}|
|
|
47
|
+
| warmup: {str(parameters.model.warmup).ljust(37)}|"""
|
|
48
|
+
|
|
49
|
+
if parameters.validation.metric == "centerpoint":
|
|
50
|
+
table += f"""
|
|
51
|
+
| matching leniency: {str(parameters.validation.metric).ljust(26)}|"""
|
|
52
|
+
|
|
53
|
+
if parameters.validation.clamp_boxes:
|
|
54
|
+
table += f"""
|
|
55
|
+
| box clamp dimensions: {str(parameters.validation.clamp_boxes).ljust(23)}|
|
|
56
|
+
| box ignore dimensions: {str(parameters.validation.ignore_boxes).ljust(22)}|"""
|
|
57
|
+
|
|
58
|
+
if parameters.model.common.with_masks:
|
|
59
|
+
table += f"""
|
|
60
|
+
| include background: {str(parameters.validation.include_background).ljust(25)}|"""
|
|
61
|
+
|
|
62
|
+
table += \
|
|
63
|
+
"""
|
|
64
|
+
+--------------------------------------------------+"""
|
|
65
|
+
return table
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def timings_table(timings: dict) -> str:
|
|
69
|
+
"""
|
|
70
|
+
Formats the dictionary timings summary into a string table.
|
|
71
|
+
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
timings: dict
|
|
75
|
+
This contains the timing information formatting
|
|
76
|
+
in one of the following orders.
|
|
77
|
+
|
|
78
|
+
.. code-block:: python
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
'min_read_time': minimum time to read the input,
|
|
82
|
+
'max_read_time': maximum time to read the input,
|
|
83
|
+
'min_load_time': minimum time to preprocess the input,
|
|
84
|
+
'max_load_time': maximum time to preprocess the input,
|
|
85
|
+
'min_backbone_time': minimum time to run the model,
|
|
86
|
+
'max_backbone_time': maximum time to run the model,
|
|
87
|
+
'min_decode_time': minimum time to decode the outputs,
|
|
88
|
+
'max_decode_time': maximum time to decode the outputs,
|
|
89
|
+
'min_box_time': minimum time to process the outputs,
|
|
90
|
+
'max_box_time': maximum time to process the outputs,
|
|
91
|
+
'avg_read_time': average time to read the input,
|
|
92
|
+
'avg_load_time': average time to preprocess the input,
|
|
93
|
+
'avg_backbone_time': average time to run the model,
|
|
94
|
+
'avg_decode_time': average time to decode the outputs,
|
|
95
|
+
'avg_box_time': average time to process the outputs,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.. code-block:: python
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
'min_input_time': minimum time to load an image,
|
|
102
|
+
'max_input_time': maximum time to load an image,
|
|
103
|
+
'avg_input_time': average time to load an image,
|
|
104
|
+
'min_inference_time': minimum time to produce bounding boxes,
|
|
105
|
+
'max_inference_time': maximum time to produce bounding boxes,
|
|
106
|
+
'avg_inference_time': average time to produce bounding boxes,
|
|
107
|
+
'min_decoding_time': minimum time to process model predictions,
|
|
108
|
+
'max_decoding_time': maximum time to process model predictions,
|
|
109
|
+
'avg_decoding_time': average time to process model predictions,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
str
|
|
115
|
+
The formatted timings in a table in milliseconds.
|
|
116
|
+
"""
|
|
117
|
+
timings = {k: str(round(v, 2)) for k, v in timings.items()}
|
|
118
|
+
if len(timings.keys()) > 9:
|
|
119
|
+
table = f"""
|
|
120
|
+
+----------------------------------------------------------+
|
|
121
|
+
| Read Time (ms) | Load Time (ms) | Backbone Time (ms) |
|
|
122
|
+
+------------------+------------------+--------------------+
|
|
123
|
+
| Min: {timings.get('min_read_time').ljust(11)}| Min: {timings.get('min_load_time').ljust(11)}| Min: {timings.get('min_backbone_time').ljust(14)}|
|
|
124
|
+
| Max: {timings.get('max_read_time').ljust(11)}| Max: {timings.get('max_load_time').ljust(11)}| Max: {timings.get('max_backbone_time').ljust(14)}|
|
|
125
|
+
| Avg: {timings.get('avg_read_time').ljust(11)}| Avg: {timings.get('avg_load_time').ljust(11)}| Avg: {timings.get('avg_backbone_time').ljust(14)}|
|
|
126
|
+
+------------------+---------+--------+--------------------+
|
|
127
|
+
| Decode Time (ms) | Box Time (ms) |
|
|
128
|
+
+----------------------------+-----------------------------+
|
|
129
|
+
| Min: {timings.get('min_decode_time').ljust(17)}| Min: {timings.get('min_box_time').ljust(18)}|
|
|
130
|
+
| Max: {timings.get('max_decode_time').ljust(17)}| Max: {timings.get('max_box_time').ljust(18)}|
|
|
131
|
+
| Avg: {timings.get('avg_decode_time').ljust(17)}| Avg: {timings.get('avg_box_time').ljust(18)}|
|
|
132
|
+
+----------------------------+-----------------------------+
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
else:
|
|
136
|
+
table = f"""
|
|
137
|
+
+----------------------------------------------------------+
|
|
138
|
+
| Input Time (ms) | Inference Time (ms) | Output Time (ms) |
|
|
139
|
+
+-----------------+---------------------+------------------+
|
|
140
|
+
| Min: {timings.get('min_input_time').ljust(11)}| Min: {timings.get('min_inference_time').ljust(15)}| Min: {timings.get('min_output_time').ljust(12)}|
|
|
141
|
+
| Max: {timings.get('max_input_time').ljust(11)}| Max: {timings.get('max_inference_time').ljust(15)}| Max: {timings.get('max_output_time').ljust(12)}|
|
|
142
|
+
| Avg: {timings.get('avg_input_time').ljust(11)}| Avg: {timings.get('avg_inference_time').ljust(15)}| Avg: {timings.get('avg_output_time').ljust(12)}|
|
|
143
|
+
+-----------------+---------------------+------------------+
|
|
144
|
+
"""
|
|
145
|
+
return table
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def multitask_table(metrics: MultitaskMetrics,
|
|
149
|
+
parameters: CombinedParameters) -> str:
|
|
150
|
+
"""
|
|
151
|
+
Formats the multitask metrics into a string table.
|
|
152
|
+
|
|
153
|
+
Parameters
|
|
154
|
+
----------
|
|
155
|
+
metrics: MultitaskMetrics
|
|
156
|
+
This is a container for both detection and segmentation metrics.
|
|
157
|
+
parameters: CombinedParameters
|
|
158
|
+
Thisi contains the model, validation, and dataset parameters
|
|
159
|
+
set from the command line.
|
|
160
|
+
|
|
161
|
+
Returns
|
|
162
|
+
-------
|
|
163
|
+
str
|
|
164
|
+
The formatted validation table showing the metrics, parameters,
|
|
165
|
+
and model timings.
|
|
166
|
+
"""
|
|
167
|
+
d_metrics = metrics.detection_metrics
|
|
168
|
+
s_metrics = metrics.segmentation_metrics
|
|
169
|
+
|
|
170
|
+
if parameters.validation.method in ["ultralytics", "yolov7"]:
|
|
171
|
+
table = \
|
|
172
|
+
f""" +--------------------------------------------------+
|
|
173
|
+
| Model: {str(d_metrics.model).ljust(42)}|
|
|
174
|
+
| Dataset: {str(d_metrics.dataset).ljust(40)}|
|
|
175
|
+
+--------------------------------------------------+
|
|
176
|
+
| DETECTION METRICS |
|
|
177
|
+
+--------------------------------------------------+
|
|
178
|
+
| Ground Truths: {str(d_metrics.ground_truths).ljust(34)}|
|
|
179
|
+
| Predictions: {str(d_metrics.predictions).ljust(36)}|
|
|
180
|
+
+---------------+-------------------+--------------+
|
|
181
|
+
| | Mean Precision |{str(round(d_metrics.precision["mean"]*100, 2)).center(14)}|
|
|
182
|
+
| | mAP@0.5 |{str(round(d_metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
183
|
+
| Precision (%) | mAP@0.75 |{str(round(d_metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
184
|
+
| | mAP@0.5-0.95 |{str(round(d_metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
185
|
+
+---------------+-------------------+--------------+
|
|
186
|
+
| Recall (%) | Mean Recall |{str(round(d_metrics.recall["mean"]*100, 2)).center(14)}|
|
|
187
|
+
+---------------+-------------------+--------------+
|
|
188
|
+
| F1 Score (%) | Mean F1 |{str(round(d_metrics.f1["mean"]*100, 2)).center(14)}|
|
|
189
|
+
+---------------+-------------------+--------------+"""
|
|
190
|
+
|
|
191
|
+
else:
|
|
192
|
+
table = \
|
|
193
|
+
f""" +--------------------------------------------------+
|
|
194
|
+
| Model: {str(d_metrics.model).ljust(42)}|
|
|
195
|
+
| Dataset: {str(d_metrics.dataset).ljust(40)}|
|
|
196
|
+
+--------------------------------------------------+
|
|
197
|
+
| DETECTION METRICS |
|
|
198
|
+
+---------------+----------------+-----------------+
|
|
199
|
+
| Ground Truths | True Positives | False Negatives |
|
|
200
|
+
+---------------+----------------+-----------------+
|
|
201
|
+
|{str(d_metrics.ground_truths).center(15)}|{str(d_metrics.tp).center(16)}|{str(d_metrics.fn).center(17)}|
|
|
202
|
+
+-------------------------+------------------------+
|
|
203
|
+
| Classification FP | Localization FP |
|
|
204
|
+
+-------------------------+------------------------+
|
|
205
|
+
|{str(d_metrics.cfp).center(25)}|{str(d_metrics.lfp).center(24)}|
|
|
206
|
+
+---------------+---------+---------+--------------+
|
|
207
|
+
| | Overall Accuracy |{str(round(d_metrics.accuracy["overall"]*100, 2)).center(14)}|
|
|
208
|
+
| | mACC@0.5 |{str(round(d_metrics.accuracy["macc"].get('0.50')*100, 2)).center(14)}|
|
|
209
|
+
| Accuracy (%) | mACC@0.75 |{str(round(d_metrics.accuracy["macc"].get('0.75')*100, 2)).center(14)}|
|
|
210
|
+
| | mACC@0.5-0.95 |{str(round(d_metrics.accuracy["macc"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
211
|
+
+---------------+-------------------+--------------+
|
|
212
|
+
| | Overall Precision |{str(round(d_metrics.precision["overall"]*100, 2)).center(14)}|
|
|
213
|
+
| | mAP@0.5 |{str(round(d_metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
214
|
+
| Precision (%) | mAP@0.75 |{str(round(d_metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
215
|
+
| | mAP@0.5-0.95 |{str(round(d_metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
216
|
+
+---------------+-------------------+--------------+
|
|
217
|
+
| | Overall Recall |{str(round(d_metrics.recall["overall"]*100, 2)).center(14)}|
|
|
218
|
+
| | mAR@0.5 |{str(round(d_metrics.recall["mar"].get('0.50')*100, 2)).center(14)}|
|
|
219
|
+
| Recall (%) | mAR@0.75 |{str(round(d_metrics.recall["mar"].get('0.75')*100, 2)).center(14)}|
|
|
220
|
+
| | mAR@0.5-0.95 |{str(round(d_metrics.recall["mar"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
221
|
+
+---------------+-------------------+--------------+"""
|
|
222
|
+
|
|
223
|
+
if parameters.model.common.semantic:
|
|
224
|
+
table += f"""
|
|
225
|
+
| SEMANTIC SEGMENTATION METRICS |
|
|
226
|
+
+--------------------------------------------------+
|
|
227
|
+
| Ground Truths: {str(s_metrics.ground_truths).ljust(34)}|
|
|
228
|
+
| Predictions: {str(s_metrics.predictions).ljust(36)}|
|
|
229
|
+
| Union: {str(s_metrics.union).ljust(42)}|
|
|
230
|
+
+------------------------+-------------------------+
|
|
231
|
+
| True Predictions | False Predictions |
|
|
232
|
+
+------------------------+-------------------------+
|
|
233
|
+
|{str(s_metrics.true_predictions).center(24)}|{str(s_metrics.false_predictions).center(25)}|
|
|
234
|
+
+------------------------+-------------------------+
|
|
235
|
+
| Overall Accuracy (%) |{str(round(s_metrics.accuracy["overall"]*100, 2)).center(25)}|
|
|
236
|
+
| Overall F1 (%) |{str(round(s_metrics.f1["overall"]*100, 2)).center(25)}|
|
|
237
|
+
+------------------------+-------------------------+
|
|
238
|
+
| Mean IoU (%) |{str(round(s_metrics.iou["mean"]*100, 2)).center(25)}|
|
|
239
|
+
| Mean Precision (%) |{str(round(s_metrics.precision["mean"]*100, 2)).center(25)}|
|
|
240
|
+
| Mean Recall (%) |{str(round(s_metrics.recall["mean"]*100, 2)).center(25)}|
|
|
241
|
+
+------------------------+-------------------------+"""
|
|
242
|
+
else:
|
|
243
|
+
table += f"""
|
|
244
|
+
| INSTANCE SEGMENTATION METRICS |
|
|
245
|
+
+--------------------------------------------------+
|
|
246
|
+
| | Mean Precision |{str(round(s_metrics.precision["mean"]*100, 2)).center(14)}|
|
|
247
|
+
| | mAP@0.5 |{str(round(s_metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
248
|
+
| Precision (%) | mAP@0.75 |{str(round(s_metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
249
|
+
| | mAP@0.5-0.95 |{str(round(s_metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
250
|
+
+---------------+-------------------+--------------+
|
|
251
|
+
| Recall (%) | Mean Recall |{str(round(s_metrics.recall["mean"]*100, 2)).center(14)}|
|
|
252
|
+
+---------------+-------------------+--------------+
|
|
253
|
+
| F1 Score (%) | Mean F1 |{str(round(s_metrics.f1["mean"]*100, 2)).center(14)}|
|
|
254
|
+
+---------------+-------------------+--------------+"""
|
|
255
|
+
|
|
256
|
+
if d_metrics.model.lower() != "model":
|
|
257
|
+
table += timings_table(metrics.timings)
|
|
258
|
+
table += parameters_table(parameters)
|
|
259
|
+
|
|
260
|
+
return table
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def detection_table(metrics: Metrics, parameters: CombinedParameters) -> str:
|
|
264
|
+
"""
|
|
265
|
+
Formats the detection metrics into a string table.
|
|
266
|
+
|
|
267
|
+
Parameters
|
|
268
|
+
----------
|
|
269
|
+
metrics: Metrics
|
|
270
|
+
This is the detection metrics computed during validation.
|
|
271
|
+
parameters: CombinedParameters
|
|
272
|
+
This contains the model, validation, and dataset parameters
|
|
273
|
+
set from the command line.
|
|
274
|
+
|
|
275
|
+
Returns
|
|
276
|
+
-------
|
|
277
|
+
str
|
|
278
|
+
The formatted validation table showing the metrics, parameters,
|
|
279
|
+
and model timings.
|
|
280
|
+
"""
|
|
281
|
+
if parameters.validation.method in ["ultralytics", "yolov7"]:
|
|
282
|
+
table = \
|
|
283
|
+
f""" +--------------------------------------------------+
|
|
284
|
+
| Model: {str(metrics.model).ljust(42)}|
|
|
285
|
+
| Dataset: {str(metrics.dataset).ljust(40)}|
|
|
286
|
+
+--------------------------------------------------+
|
|
287
|
+
| DETECTION METRICS |
|
|
288
|
+
+--------------------------------------------------+
|
|
289
|
+
| Ground Truths: {str(metrics.ground_truths).ljust(34)}|
|
|
290
|
+
| Predictions: {str(metrics.predictions).ljust(36)}|
|
|
291
|
+
+---------------+-------------------+--------------+
|
|
292
|
+
| | Mean Precision |{str(round(metrics.precision["mean"]*100, 2)).center(14)}|
|
|
293
|
+
| | mAP@0.5 |{str(round(metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
294
|
+
| Precision (%) | mAP@0.75 |{str(round(metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
295
|
+
| | mAP@0.5-0.95 |{str(round(metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
296
|
+
+---------------+-------------------+--------------+
|
|
297
|
+
| Recall (%) | Mean Recall |{str(round(metrics.recall["mean"]*100, 2)).center(14)}|
|
|
298
|
+
+---------------+-------------------+--------------+
|
|
299
|
+
| F1 Score (%) | Mean F1 |{str(round(metrics.f1["mean"]*100, 2)).center(14)}|
|
|
300
|
+
+---------------+-------------------+--------------+"""
|
|
301
|
+
|
|
302
|
+
else:
|
|
303
|
+
table = \
|
|
304
|
+
f""" +--------------------------------------------------+
|
|
305
|
+
| Model: {str(metrics.model).ljust(42)}|
|
|
306
|
+
| Dataset: {str(metrics.dataset).ljust(40)}|
|
|
307
|
+
+--------------------------------------------------+
|
|
308
|
+
| DETECTION METRICS |
|
|
309
|
+
+---------------+----------------+-----------------+
|
|
310
|
+
| Ground Truths | True Positives | False Negatives |
|
|
311
|
+
+---------------+----------------+-----------------+
|
|
312
|
+
|{str(metrics.ground_truths).center(15)}|{str(metrics.tp).center(16)}|{str(metrics.fn).center(17)}|
|
|
313
|
+
+-------------------------+------------------------+
|
|
314
|
+
| Classification FP | Localization FP |
|
|
315
|
+
+-------------------------+------------------------+
|
|
316
|
+
|{str(metrics.cfp).center(25)}|{str(metrics.lfp).center(24)}|
|
|
317
|
+
+---------------+---------+---------+--------------+
|
|
318
|
+
| | Overall Accuracy |{str(round(metrics.accuracy["overall"]*100, 2)).center(14)}|
|
|
319
|
+
| | mACC@0.5 |{str(round(metrics.accuracy["macc"].get('0.50')*100, 2)).center(14)}|
|
|
320
|
+
| Accuracy (%) | mACC@0.75 |{str(round(metrics.accuracy["macc"].get('0.75')*100, 2)).center(14)}|
|
|
321
|
+
| | mACC@0.5-0.95 |{str(round(metrics.accuracy["macc"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
322
|
+
+---------------+-------------------+--------------+
|
|
323
|
+
| | Overall Precision |{str(round(metrics.precision["overall"]*100, 2)).center(14)}|
|
|
324
|
+
| | mAP@0.5 |{str(round(metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
325
|
+
| Precision (%) | mAP@0.75 |{str(round(metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
326
|
+
| | mAP@0.5-0.95 |{str(round(metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
327
|
+
+---------------+-------------------+--------------+
|
|
328
|
+
| | Overall Recall |{str(round(metrics.recall["overall"]*100, 2)).center(14)}|
|
|
329
|
+
| | mAR@0.5 |{str(round(metrics.recall["mar"].get('0.50')*100, 2)).center(14)}|
|
|
330
|
+
| Recall (%) | mAR@0.75 |{str(round(metrics.recall["mar"].get('0.75')*100, 2)).center(14)}|
|
|
331
|
+
| | mAR@0.5-0.95 |{str(round(metrics.recall["mar"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
332
|
+
+---------------+-------------------+--------------+"""
|
|
333
|
+
|
|
334
|
+
if metrics.model.lower() != "model":
|
|
335
|
+
table += timings_table(metrics.timings)
|
|
336
|
+
table += parameters_table(parameters)
|
|
337
|
+
|
|
338
|
+
return table
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def segmentation_table(metrics: Metrics,
|
|
342
|
+
parameters: CombinedParameters) -> str:
|
|
343
|
+
"""
|
|
344
|
+
Formats the segmentation metrics into a string table.
|
|
345
|
+
|
|
346
|
+
Parameters
|
|
347
|
+
----------
|
|
348
|
+
metrics: Metrics
|
|
349
|
+
This is the segmentation metrics computed during validation.
|
|
350
|
+
parameters: CombinedParameters
|
|
351
|
+
This contains the model, validation, and dataset parameters
|
|
352
|
+
set from the command line.
|
|
353
|
+
|
|
354
|
+
Returns
|
|
355
|
+
-------
|
|
356
|
+
str
|
|
357
|
+
The formatted validation table showing the metrics, parameters,
|
|
358
|
+
and model timings.
|
|
359
|
+
"""
|
|
360
|
+
|
|
361
|
+
table = \
|
|
362
|
+
f""" +--------------------------------------------------+
|
|
363
|
+
| Model: {metrics.model.ljust(42)}|
|
|
364
|
+
| Dataset: {metrics.dataset.ljust(40)}|
|
|
365
|
+
+--------------------------------------------------+"""
|
|
366
|
+
|
|
367
|
+
if parameters.model.common.semantic:
|
|
368
|
+
table += f"""
|
|
369
|
+
| SEMANTIC SEGMENTATION METRICS |
|
|
370
|
+
+--------------------------------------------------+
|
|
371
|
+
| Ground Truths: {str(metrics.ground_truths).ljust(34)}|
|
|
372
|
+
| Predictions: {str(metrics.predictions).ljust(36)}|
|
|
373
|
+
| Union: {str(metrics.union).ljust(42)}|
|
|
374
|
+
+------------------------+-------------------------+
|
|
375
|
+
| True Predictions | False Predictions |
|
|
376
|
+
+------------------------+-------------------------+
|
|
377
|
+
|{str(metrics.true_predictions).center(24)}|{str(metrics.false_predictions).center(25)}|
|
|
378
|
+
+--------------------------------------------------+
|
|
379
|
+
| Overall Accuracy (%) |{str(round(metrics.accuracy["overall"]*100, 2)).center(25)}|
|
|
380
|
+
| Overall F1 (%) |{str(round(metrics.f1["overall"]*100, 2)).center(25)}|
|
|
381
|
+
+------------------------+-------------------------+
|
|
382
|
+
| Mean IoU (%) |{str(round(metrics.iou["mean"]*100, 2)).center(25)}|
|
|
383
|
+
| Mean Precision (%) |{str(round(metrics.precision["mean"]*100, 2)).center(25)}|
|
|
384
|
+
| Mean Recall (%) |{str(round(metrics.recall["mean"]*100, 2)).center(25)}|
|
|
385
|
+
+------------------------+-------------------------+"""
|
|
386
|
+
else:
|
|
387
|
+
table += f"""
|
|
388
|
+
| INSTANCE SEGMENTATION METRICS |
|
|
389
|
+
+--------------------------------------------------+
|
|
390
|
+
| | Mean Precision |{str(round(metrics.precision["mean"]*100, 2)).center(14)}|
|
|
391
|
+
| | mAP@0.5 |{str(round(metrics.precision["map"].get('0.50')*100, 2)).center(14)}|
|
|
392
|
+
| Precision (%) | mAP@0.75 |{str(round(metrics.precision["map"].get('0.75')*100, 2)).center(14)}|
|
|
393
|
+
| | mAP@0.5-0.95 |{str(round(metrics.precision["map"].get('0.50:0.95')*100, 2)).center(14)}|
|
|
394
|
+
+---------------+-------------------+--------------+
|
|
395
|
+
| Recall (%) | Mean Recall |{str(round(metrics.recall["mean"]*100, 2)).center(14)}|
|
|
396
|
+
+---------------+-------------------+--------------+
|
|
397
|
+
| F1 Score (%) | Mean F1 |{str(round(metrics.f1["mean"]*100, 2)).center(14)}|
|
|
398
|
+
+---------------+-------------------+--------------+"""
|
|
399
|
+
|
|
400
|
+
if metrics.model.lower() != "model":
|
|
401
|
+
table += timings_table(metrics.timings)
|
|
402
|
+
table += parameters_table(parameters)
|
|
403
|
+
return table
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from edgefirst.validator.runners.deepviewrt import DeepViewRTRunner
|
|
2
|
+
from edgefirst.validator.runners.tensorrt import TensorRTRunner
|
|
3
|
+
from edgefirst.validator.runners.offline import OfflineRunner
|
|
4
|
+
from edgefirst.validator.runners.tflite import TFliteRunner
|
|
5
|
+
from edgefirst.validator.runners.kinara import KinaraRunner
|
|
6
|
+
from edgefirst.validator.runners.keras import KerasRunner
|
|
7
|
+
from edgefirst.validator.runners.onnx import ONNXRunner
|
|
8
|
+
from edgefirst.validator.runners.core import Runner
|