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.
@@ -0,0 +1,789 @@
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
+
25
+ @dataclass
26
+ class Counts:
27
+ """
28
+ `Counts` encapsulates the counts of true positives (`tp`), false positives (`fp`),
29
+ and false negatives (`fn`) for object detection evaluation, along with the associated
30
+ class label, Intersection over Union (IoU) threshold, and confidence score threshold.
31
+
32
+ Attributes
33
+ ----------
34
+ tp : int
35
+ Number of true positives.
36
+ fp : int
37
+ Number of false positives.
38
+ fn : int
39
+ Number of false negatives.
40
+ label : str
41
+ The class label for which the counts are calculated.
42
+ iou_threshold : float
43
+ The IoU threshold used to determine a match between predicted and ground truth boxes.
44
+ score_threshold : float
45
+ The confidence score threshold above which predictions are considered.
46
+
47
+ Methods
48
+ -------
49
+ to_metric()
50
+ Converts the instance to a generic `Metric` object.
51
+ to_dict()
52
+ Converts the instance to a dictionary representation.
53
+ """
54
+
55
+ tp: int
56
+ fp: int
57
+ fn: int
58
+ label: str
59
+ iou_threshold: float
60
+ score_threshold: float
61
+
62
+ def to_metric(self) -> Metric:
63
+ return Metric(
64
+ type=type(self).__name__,
65
+ value={
66
+ "tp": self.tp,
67
+ "fp": self.fp,
68
+ "fn": self.fn,
69
+ },
70
+ parameters={
71
+ "iou_threshold": self.iou_threshold,
72
+ "score_threshold": self.score_threshold,
73
+ "label": self.label,
74
+ },
75
+ )
76
+
77
+ def to_dict(self) -> dict:
78
+ return self.to_metric().to_dict()
79
+
80
+
81
+ @dataclass
82
+ class _ClassMetric:
83
+ value: float
84
+ label: str
85
+ iou_threshold: float
86
+ score_threshold: float
87
+
88
+ def to_metric(self) -> Metric:
89
+ return Metric(
90
+ type=type(self).__name__,
91
+ value=self.value,
92
+ parameters={
93
+ "iou_threshold": self.iou_threshold,
94
+ "score_threshold": self.score_threshold,
95
+ "label": self.label,
96
+ },
97
+ )
98
+
99
+ def to_dict(self) -> dict:
100
+ return self.to_metric().to_dict()
101
+
102
+
103
+ class Precision(_ClassMetric):
104
+ """
105
+ Precision metric for a specific class label in object detection.
106
+
107
+ This class encapsulates a metric value for a particular class label,
108
+ along with the associated Intersection over Union (IoU) threshold and
109
+ confidence score threshold.
110
+
111
+ Attributes
112
+ ----------
113
+ value : float
114
+ The metric value.
115
+ label : str
116
+ The class label for which the metric is calculated.
117
+ iou_threshold : float
118
+ The IoU threshold used to determine matches between predicted and ground truth boxes.
119
+ score_threshold : float
120
+ The confidence score threshold above which predictions are considered.
121
+
122
+ Methods
123
+ -------
124
+ to_metric()
125
+ Converts the instance to a generic `Metric` object.
126
+ to_dict()
127
+ Converts the instance to a dictionary representation.
128
+ """
129
+
130
+ pass
131
+
132
+
133
+ class Recall(_ClassMetric):
134
+ """
135
+ Recall metric for a specific class label in object detection.
136
+
137
+ This class encapsulates a metric value for a particular class label,
138
+ along with the associated Intersection over Union (IoU) threshold and
139
+ confidence score threshold.
140
+
141
+ Attributes
142
+ ----------
143
+ value : float
144
+ The metric value.
145
+ label : str
146
+ The class label for which the metric is calculated.
147
+ iou_threshold : float
148
+ The IoU threshold used to determine matches between predicted and ground truth boxes.
149
+ score_threshold : float
150
+ The confidence score threshold above which predictions are considered.
151
+
152
+ Methods
153
+ -------
154
+ to_metric()
155
+ Converts the instance to a generic `Metric` object.
156
+ to_dict()
157
+ Converts the instance to a dictionary representation.
158
+ """
159
+
160
+ pass
161
+
162
+
163
+ class Accuracy(_ClassMetric):
164
+ """
165
+ Accuracy metric for a specific class label in object detection.
166
+
167
+ This class encapsulates a metric value for a particular class label,
168
+ along with the associated Intersection over Union (IoU) threshold and
169
+ confidence score threshold.
170
+
171
+ Attributes
172
+ ----------
173
+ value : float
174
+ The metric value.
175
+ label : str
176
+ The class label for which the metric is calculated.
177
+ iou_threshold : float
178
+ The IoU threshold used to determine matches between predicted and ground truth boxes.
179
+ score_threshold : float
180
+ The confidence score threshold above which predictions are considered.
181
+
182
+ Methods
183
+ -------
184
+ to_metric()
185
+ Converts the instance to a generic `Metric` object.
186
+ to_dict()
187
+ Converts the instance to a dictionary representation.
188
+ """
189
+
190
+ pass
191
+
192
+
193
+ class F1(_ClassMetric):
194
+ """
195
+ F1 score for a specific class label in object detection.
196
+
197
+ This class encapsulates a metric value for a particular class label,
198
+ along with the associated Intersection over Union (IoU) threshold and
199
+ confidence score threshold.
200
+
201
+ Attributes
202
+ ----------
203
+ value : float
204
+ The metric value.
205
+ label : str
206
+ The class label for which the metric is calculated.
207
+ iou_threshold : float
208
+ The IoU threshold used to determine matches between predicted and ground truth boxes.
209
+ score_threshold : float
210
+ The confidence score threshold above which predictions are considered.
211
+
212
+ Methods
213
+ -------
214
+ to_metric()
215
+ Converts the instance to a generic `Metric` object.
216
+ to_dict()
217
+ Converts the instance to a dictionary representation.
218
+ """
219
+
220
+ pass
221
+
222
+
223
+ @dataclass
224
+ class AP:
225
+ """
226
+ Average Precision (AP) metric for object detection tasks.
227
+
228
+ The AP computation uses 101-point interpolation, which calculates the average
229
+ precision by interpolating the precision-recall curve at 101 evenly spaced recall
230
+ levels from 0 to 1.
231
+
232
+ Attributes
233
+ ----------
234
+ value : float
235
+ The average precision value.
236
+ iou_threshold : float
237
+ The IoU threshold used to compute the AP.
238
+ label : str
239
+ The class label for which the AP is computed.
240
+
241
+ Methods
242
+ -------
243
+ to_metric()
244
+ Converts the instance to a generic `Metric` object.
245
+ to_dict()
246
+ Converts the instance to a dictionary representation.
247
+ """
248
+
249
+ value: float
250
+ iou_threshold: float
251
+ label: str
252
+
253
+ def to_metric(self) -> Metric:
254
+ return Metric(
255
+ type=type(self).__name__,
256
+ value=self.value,
257
+ parameters={
258
+ "iou_threshold": self.iou_threshold,
259
+ "label": self.label,
260
+ },
261
+ )
262
+
263
+ def to_dict(self) -> dict:
264
+ return self.to_metric().to_dict()
265
+
266
+
267
+ @dataclass
268
+ class mAP:
269
+ """
270
+ Mean Average Precision (mAP) metric for object detection tasks.
271
+
272
+ The AP computation uses 101-point interpolation, which calculates the average
273
+ precision for each class by interpolating the precision-recall curve at 101 evenly
274
+ spaced recall levels from 0 to 1. The mAP is then calculated by averaging these
275
+ values across all class labels.
276
+
277
+ Attributes
278
+ ----------
279
+ value : float
280
+ The mean average precision value.
281
+ iou_threshold : float
282
+ The IoU threshold used to compute the mAP.
283
+
284
+ Methods
285
+ -------
286
+ to_metric()
287
+ Converts the instance to a generic `Metric` object.
288
+ to_dict()
289
+ Converts the instance to a dictionary representation.
290
+ """
291
+
292
+ value: float
293
+ iou_threshold: float
294
+
295
+ def to_metric(self) -> Metric:
296
+ return Metric(
297
+ type=type(self).__name__,
298
+ value=self.value,
299
+ parameters={
300
+ "iou_threshold": self.iou_threshold,
301
+ },
302
+ )
303
+
304
+ def to_dict(self) -> dict:
305
+ return self.to_metric().to_dict()
306
+
307
+
308
+ @dataclass
309
+ class APAveragedOverIOUs:
310
+ """
311
+ Average Precision (AP) metric averaged over multiple IoU thresholds.
312
+
313
+ The AP computation uses 101-point interpolation, which calculates the average precision
314
+ by interpolating the precision-recall curve at 101 evenly spaced recall levels from 0 to 1
315
+ for each IoU threshold specified in `iou_thresholds`. The final APAveragedOverIOUs value is
316
+ obtained by averaging these AP values across all specified IoU thresholds.
317
+
318
+ Attributes
319
+ ----------
320
+ value : float
321
+ The average precision value averaged over the specified IoU thresholds.
322
+ iou_thresholds : list[float]
323
+ The list of IoU thresholds used to compute the AP values.
324
+ label : str
325
+ The class label for which the AP is computed.
326
+
327
+ Methods
328
+ -------
329
+ to_metric()
330
+ Converts the instance to a generic `Metric` object.
331
+ to_dict()
332
+ Converts the instance to a dictionary representation.
333
+ """
334
+
335
+ value: float
336
+ iou_thresholds: list[float]
337
+ label: str
338
+
339
+ def to_metric(self) -> Metric:
340
+ return Metric(
341
+ type=type(self).__name__,
342
+ value=self.value,
343
+ parameters={
344
+ "iou_thresholds": self.iou_thresholds,
345
+ "label": self.label,
346
+ },
347
+ )
348
+
349
+ def to_dict(self) -> dict:
350
+ return self.to_metric().to_dict()
351
+
352
+
353
+ @dataclass
354
+ class mAPAveragedOverIOUs:
355
+ """
356
+ Mean Average Precision (mAP) metric averaged over multiple IoU thresholds.
357
+
358
+ The AP computation uses 101-point interpolation, which calculates the average precision
359
+ by interpolating the precision-recall curve at 101 evenly spaced recall levels from 0 to 1
360
+ for each IoU threshold specified in `iou_thresholds`. The final mAPAveragedOverIOUs value is
361
+ obtained by averaging these AP values across all specified IoU thresholds and all class labels.
362
+
363
+ Attributes
364
+ ----------
365
+ value : float
366
+ The average precision value averaged over the specified IoU thresholds.
367
+ iou_thresholds : list[float]
368
+ The list of IoU thresholds used to compute the AP values.
369
+
370
+ Methods
371
+ -------
372
+ to_metric()
373
+ Converts the instance to a generic `Metric` object.
374
+ to_dict()
375
+ Converts the instance to a dictionary representation.
376
+ """
377
+
378
+ value: float
379
+ iou_thresholds: list[float]
380
+
381
+ def to_metric(self) -> Metric:
382
+ return Metric(
383
+ type=type(self).__name__,
384
+ value=self.value,
385
+ parameters={
386
+ "iou_thresholds": self.iou_thresholds,
387
+ },
388
+ )
389
+
390
+ def to_dict(self) -> dict:
391
+ return self.to_metric().to_dict()
392
+
393
+
394
+ @dataclass
395
+ class AR:
396
+ """
397
+ Average Recall (AR) metric for object detection tasks.
398
+
399
+ The AR computation considers detections with confidence scores above the specified
400
+ `score_threshold` and calculates the recall at each IoU threshold in `iou_thresholds`.
401
+ The final AR value is the average of these recall values across all specified IoU
402
+ thresholds.
403
+
404
+ Attributes
405
+ ----------
406
+ value : float
407
+ The average recall value averaged over the specified IoU thresholds.
408
+ score_threshold : float
409
+ The detection score threshold; only detections with confidence scores above this
410
+ threshold are considered.
411
+ iou_thresholds : list[float]
412
+ The list of IoU thresholds used to compute the recall values.
413
+ label : str
414
+ The class label for which the AR is computed.
415
+
416
+ Methods
417
+ -------
418
+ to_metric()
419
+ Converts the instance to a generic `Metric` object.
420
+ to_dict()
421
+ Converts the instance to a dictionary representation.
422
+ """
423
+
424
+ value: float
425
+ score_threshold: float
426
+ iou_thresholds: list[float]
427
+ label: str
428
+
429
+ def to_metric(self) -> Metric:
430
+ return Metric(
431
+ type=type(self).__name__,
432
+ value=self.value,
433
+ parameters={
434
+ "score_threshold": self.score_threshold,
435
+ "iou_thresholds": self.iou_thresholds,
436
+ "label": self.label,
437
+ },
438
+ )
439
+
440
+ def to_dict(self) -> dict:
441
+ return self.to_metric().to_dict()
442
+
443
+
444
+ @dataclass
445
+ class mAR:
446
+ """
447
+ Mean Average Recall (mAR) metric for object detection tasks.
448
+
449
+ The mAR computation considers detections with confidence scores above the specified
450
+ `score_threshold` and calculates recall at each IoU threshold in `iou_thresholds` for
451
+ each label. The final mAR value is obtained by averaging these recall values over the
452
+ specified IoU thresholds and then averaging across all labels.
453
+
454
+ Attributes
455
+ ----------
456
+ value : float
457
+ The mean average recall value averaged over the specified IoU thresholds.
458
+ score_threshold : float
459
+ The detection score threshold; only detections with confidence scores above this
460
+ threshold are considered.
461
+ iou_thresholds : list[float]
462
+ The list of IoU thresholds used to compute the recall values.
463
+
464
+ Methods
465
+ -------
466
+ to_metric()
467
+ Converts the instance to a generic `Metric` object.
468
+ to_dict()
469
+ Converts the instance to a dictionary representation.
470
+ """
471
+
472
+ value: float
473
+ score_threshold: float
474
+ iou_thresholds: list[float]
475
+
476
+ def to_metric(self) -> Metric:
477
+ return Metric(
478
+ type=type(self).__name__,
479
+ value=self.value,
480
+ parameters={
481
+ "score_threshold": self.score_threshold,
482
+ "iou_thresholds": self.iou_thresholds,
483
+ },
484
+ )
485
+
486
+ def to_dict(self) -> dict:
487
+ return self.to_metric().to_dict()
488
+
489
+
490
+ @dataclass
491
+ class ARAveragedOverScores:
492
+ """
493
+ Average Recall (AR) metric averaged over multiple score thresholds for a specific object class label.
494
+
495
+ The AR computation considers detections across multiple `score_thresholds` and calculates
496
+ recall at each IoU threshold in `iou_thresholds`. The final AR value is obtained by averaging
497
+ the recall values over all specified score thresholds and IoU thresholds.
498
+
499
+ Attributes
500
+ ----------
501
+ value : float
502
+ The average recall value averaged over the specified score thresholds and IoU thresholds.
503
+ score_thresholds : list[float]
504
+ The list of detection score thresholds; detections with confidence scores above each threshold are considered.
505
+ iou_thresholds : list[float]
506
+ The list of IoU thresholds used to compute the recall values.
507
+ label : str
508
+ The class label for which the AR is computed.
509
+
510
+ Methods
511
+ -------
512
+ to_metric()
513
+ Converts the instance to a generic `Metric` object.
514
+ to_dict()
515
+ Converts the instance to a dictionary representation.
516
+ """
517
+
518
+ value: float
519
+ score_thresholds: list[float]
520
+ iou_thresholds: list[float]
521
+ label: str
522
+
523
+ def to_metric(self) -> Metric:
524
+ return Metric(
525
+ type=type(self).__name__,
526
+ value=self.value,
527
+ parameters={
528
+ "score_thresholds": self.score_thresholds,
529
+ "iou_thresholds": self.iou_thresholds,
530
+ "label": self.label,
531
+ },
532
+ )
533
+
534
+ def to_dict(self) -> dict:
535
+ return self.to_metric().to_dict()
536
+
537
+
538
+ @dataclass
539
+ class mARAveragedOverScores:
540
+ """
541
+ Mean Average Recall (mAR) metric averaged over multiple score thresholds and IoU thresholds.
542
+
543
+ The mAR computation considers detections across multiple `score_thresholds`, calculates recall
544
+ at each IoU threshold in `iou_thresholds` for each label, averages these recall values over all
545
+ specified score thresholds and IoU thresholds, and then computes the mean across all labels to
546
+ obtain the final mAR value.
547
+
548
+ Attributes
549
+ ----------
550
+ value : float
551
+ The mean average recall value averaged over the specified score thresholds and IoU thresholds.
552
+ score_thresholds : list[float]
553
+ The list of detection score thresholds; detections with confidence scores above each threshold are considered.
554
+ iou_thresholds : list[float]
555
+ The list of IoU thresholds used to compute the recall values.
556
+
557
+ Methods
558
+ -------
559
+ to_metric()
560
+ Converts the instance to a generic `Metric` object.
561
+ to_dict()
562
+ Converts the instance to a dictionary representation.
563
+ """
564
+
565
+ value: float
566
+ score_thresholds: list[float]
567
+ iou_thresholds: list[float]
568
+
569
+ def to_metric(self) -> Metric:
570
+ return Metric(
571
+ type=type(self).__name__,
572
+ value=self.value,
573
+ parameters={
574
+ "score_thresholds": self.score_thresholds,
575
+ "iou_thresholds": self.iou_thresholds,
576
+ },
577
+ )
578
+
579
+ def to_dict(self) -> dict:
580
+ return self.to_metric().to_dict()
581
+
582
+
583
+ @dataclass
584
+ class PrecisionRecallCurve:
585
+ """
586
+ Interpolated precision-recall curve over 101 recall points.
587
+
588
+ The precision values are interpolated over recalls ranging from 0.0 to 1.0 in steps of 0.01,
589
+ resulting in 101 points. This is a byproduct of the 101-point interpolation used in calculating
590
+ the Average Precision (AP) metric in object detection tasks.
591
+
592
+ Attributes
593
+ ----------
594
+ precision : list[float]
595
+ Interpolated precision values corresponding to recalls at 0.0, 0.01, ..., 1.0.
596
+ iou_threshold : float
597
+ The Intersection over Union (IoU) threshold used to determine true positives.
598
+ label : str
599
+ The class label associated with this precision-recall curve.
600
+
601
+ Methods
602
+ -------
603
+ to_metric()
604
+ Converts the instance to a generic `Metric` object.
605
+ to_dict()
606
+ Converts the instance to a dictionary representation.
607
+ """
608
+
609
+ precision: list[float]
610
+ iou_threshold: float
611
+ label: str
612
+
613
+ def to_metric(self) -> Metric:
614
+ return Metric(
615
+ type=type(self).__name__,
616
+ value=self.precision,
617
+ parameters={
618
+ "iou_threshold": self.iou_threshold,
619
+ "label": self.label,
620
+ },
621
+ )
622
+
623
+ def to_dict(self) -> dict:
624
+ return self.to_metric().to_dict()
625
+
626
+
627
+ @dataclass
628
+ class ConfusionMatrix:
629
+ """
630
+ Confusion matrix for object detection tasks.
631
+
632
+ This class encapsulates detailed information about the model's performance, including correct
633
+ predictions, misclassifications, hallucinations (false positives), and missing predictions
634
+ (false negatives). It provides counts and examples for each category to facilitate in-depth analysis.
635
+
636
+ Confusion Matrix Format:
637
+ {
638
+ <ground truth label>: {
639
+ <prediction label>: {
640
+ 'count': int,
641
+ 'examples': [
642
+ {
643
+ 'datum': str,
644
+ 'groundtruth': dict, # {'xmin': float, 'xmax': float, 'ymin': float, 'ymax': float}
645
+ 'prediction': dict, # {'xmin': float, 'xmax': float, 'ymin': float, 'ymax': float}
646
+ 'score': float,
647
+ },
648
+ ...
649
+ ],
650
+ },
651
+ ...
652
+ },
653
+ ...
654
+ }
655
+
656
+ Hallucinations Format:
657
+ {
658
+ <prediction label>: {
659
+ 'count': int,
660
+ 'examples': [
661
+ {
662
+ 'datum': str,
663
+ 'prediction': dict, # {'xmin': float, 'xmax': float, 'ymin': float, 'ymax': float}
664
+ 'score': float,
665
+ },
666
+ ...
667
+ ],
668
+ },
669
+ ...
670
+ }
671
+
672
+ Missing Prediction Format:
673
+ {
674
+ <ground truth label>: {
675
+ 'count': int,
676
+ 'examples': [
677
+ {
678
+ 'datum': str,
679
+ 'groundtruth': dict, # {'xmin': float, 'xmax': float, 'ymin': float, 'ymax': float}
680
+ },
681
+ ...
682
+ ],
683
+ },
684
+ ...
685
+ }
686
+
687
+ Attributes
688
+ ----------
689
+ confusion_matrix : dict
690
+ A nested dictionary where the first key is the ground truth label value, the second key
691
+ is the prediction label value, and the innermost dictionary contains either a `count`
692
+ or a list of `examples`. Each example includes the datum UID, ground truth bounding box,
693
+ predicted bounding box, and prediction scores.
694
+ hallucinations : dict
695
+ A dictionary where each key is a prediction label value with no corresponding ground truth
696
+ (false positives). The value is a dictionary containing either a `count` or a list of
697
+ `examples`. Each example includes the datum UID, predicted bounding box, and prediction score.
698
+ missing_predictions : dict
699
+ A dictionary where each key is a ground truth label value for which the model failed to predict
700
+ (false negatives). The value is a dictionary containing either a `count` or a list of `examples`.
701
+ Each example includes the datum UID and ground truth bounding box.
702
+ score_threshold : float
703
+ The confidence score threshold used to filter predictions.
704
+ iou_threshold : float
705
+ The Intersection over Union (IoU) threshold used to determine true positives.
706
+ number_of_examples : int
707
+ The maximum number of examples per element.
708
+
709
+ Methods
710
+ -------
711
+ to_metric()
712
+ Converts the instance to a generic `Metric` object.
713
+ to_dict()
714
+ Converts the instance to a dictionary representation.
715
+ """
716
+
717
+ confusion_matrix: dict[
718
+ str, # ground truth label value
719
+ dict[
720
+ str, # prediction label value
721
+ dict[
722
+ str, # either `count` or `examples`
723
+ int
724
+ | list[
725
+ dict[
726
+ str, # either `datum`, `groundtruth`, `prediction` or score
727
+ str # datum uid
728
+ | dict[
729
+ str, float
730
+ ] # bounding box (xmin, xmax, ymin, ymax)
731
+ | float, # prediction score
732
+ ]
733
+ ],
734
+ ],
735
+ ],
736
+ ]
737
+ hallucinations: dict[
738
+ str, # prediction label value
739
+ dict[
740
+ str, # either `count` or `examples`
741
+ int
742
+ | list[
743
+ dict[
744
+ str, # either `datum`, `prediction` or score
745
+ str # datum uid
746
+ | float # prediction score
747
+ | dict[
748
+ str, float
749
+ ], # bounding box (xmin, xmax, ymin, ymax)
750
+ ]
751
+ ],
752
+ ],
753
+ ]
754
+ missing_predictions: dict[
755
+ str, # ground truth label value
756
+ dict[
757
+ str, # either `count` or `examples`
758
+ int
759
+ | list[
760
+ dict[
761
+ str, # either `datum` or `groundtruth`
762
+ str # datum uid
763
+ | dict[
764
+ str, float
765
+ ], # bounding box (xmin, xmax, ymin, ymax)
766
+ ]
767
+ ],
768
+ ],
769
+ ]
770
+ score_threshold: float
771
+ iou_threshold: float
772
+ number_of_examples: int
773
+
774
+ def to_metric(self) -> Metric:
775
+ return Metric(
776
+ type=type(self).__name__,
777
+ value={
778
+ "confusion_matrix": self.confusion_matrix,
779
+ "hallucinations": self.hallucinations,
780
+ "missing_predictions": self.missing_predictions,
781
+ },
782
+ parameters={
783
+ "score_threshold": self.score_threshold,
784
+ "iou_threshold": self.iou_threshold,
785
+ },
786
+ )
787
+
788
+ def to_dict(self) -> dict:
789
+ return self.to_metric().to_dict()