valor-lite 0.33.10__py3-none-any.whl → 0.33.11__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/object_detection/computation.py +55 -44
- {valor_lite-0.33.10.dist-info → valor_lite-0.33.11.dist-info}/METADATA +1 -1
- {valor_lite-0.33.10.dist-info → valor_lite-0.33.11.dist-info}/RECORD +6 -6
- {valor_lite-0.33.10.dist-info → valor_lite-0.33.11.dist-info}/LICENSE +0 -0
- {valor_lite-0.33.10.dist-info → valor_lite-0.33.11.dist-info}/WHEEL +0 -0
- {valor_lite-0.33.10.dist-info → valor_lite-0.33.11.dist-info}/top_level.txt +0 -0
|
@@ -184,7 +184,7 @@ def _compute_ranked_pairs_for_datum(
|
|
|
184
184
|
|
|
185
185
|
# find best fits for prediction
|
|
186
186
|
mask_label_match = data[:, 4] == data[:, 5]
|
|
187
|
-
matched_predicitons = np.unique(data[mask_label_match, 2].astype(
|
|
187
|
+
matched_predicitons = np.unique(data[mask_label_match, 2].astype(np.int32))
|
|
188
188
|
mask_unmatched_predictions = ~np.isin(data[:, 2], matched_predicitons)
|
|
189
189
|
data = data[mask_label_match | mask_unmatched_predictions]
|
|
190
190
|
|
|
@@ -333,7 +333,7 @@ def compute_metrics(
|
|
|
333
333
|
average_recall = np.zeros((n_scores, n_labels))
|
|
334
334
|
counts = np.zeros((n_ious, n_scores, n_labels, 7))
|
|
335
335
|
|
|
336
|
-
pd_labels = data[:, 5].astype(
|
|
336
|
+
pd_labels = data[:, 5].astype(np.int32)
|
|
337
337
|
scores = data[:, 6]
|
|
338
338
|
unique_pd_labels, unique_pd_indices = np.unique(
|
|
339
339
|
pd_labels, return_index=True
|
|
@@ -383,17 +383,19 @@ def compute_metrics(
|
|
|
383
383
|
true_positives_mask[mask_tp_inner] = mask_gt_unique
|
|
384
384
|
|
|
385
385
|
# calculate intermediates
|
|
386
|
-
pd_count = np.bincount(pd_labels, minlength=n_labels).astype(
|
|
386
|
+
pd_count = np.bincount(pd_labels, minlength=n_labels).astype(
|
|
387
|
+
np.float64
|
|
388
|
+
)
|
|
387
389
|
tp_count = np.bincount(
|
|
388
390
|
pd_labels,
|
|
389
391
|
weights=true_positives_mask,
|
|
390
392
|
minlength=n_labels,
|
|
391
|
-
).astype(
|
|
393
|
+
).astype(np.float64)
|
|
392
394
|
|
|
393
395
|
fp_count = np.bincount(
|
|
394
396
|
pd_labels[mask_fp_inner],
|
|
395
397
|
minlength=n_labels,
|
|
396
|
-
).astype(
|
|
398
|
+
).astype(np.float64)
|
|
397
399
|
|
|
398
400
|
fn_count = np.bincount(
|
|
399
401
|
pd_labels[mask_fn_inner],
|
|
@@ -476,7 +478,7 @@ def compute_metrics(
|
|
|
476
478
|
where=running_gt_count > 1e-9,
|
|
477
479
|
out=recall,
|
|
478
480
|
)
|
|
479
|
-
recall_index = np.floor(recall * 100.0).astype(
|
|
481
|
+
recall_index = np.floor(recall * 100.0).astype(np.int32)
|
|
480
482
|
|
|
481
483
|
# bin precision-recall curve
|
|
482
484
|
pr_curve = np.zeros((n_ious, n_labels, 101, 2))
|
|
@@ -582,7 +584,7 @@ def _count_with_examples(
|
|
|
582
584
|
Counts for each unique label index.
|
|
583
585
|
"""
|
|
584
586
|
unique_rows, indices = np.unique(
|
|
585
|
-
data.astype(
|
|
587
|
+
data.astype(np.int32)[:, unique_idx],
|
|
586
588
|
return_index=True,
|
|
587
589
|
axis=0,
|
|
588
590
|
)
|
|
@@ -593,6 +595,35 @@ def _count_with_examples(
|
|
|
593
595
|
return examples, labels, counts
|
|
594
596
|
|
|
595
597
|
|
|
598
|
+
def _isin(
|
|
599
|
+
data: NDArray[np.int32],
|
|
600
|
+
subset: NDArray[np.int32],
|
|
601
|
+
) -> NDArray[np.bool_]:
|
|
602
|
+
"""
|
|
603
|
+
Creates a mask of rows that exist within the subset.
|
|
604
|
+
|
|
605
|
+
Parameters
|
|
606
|
+
----------
|
|
607
|
+
data : NDArray[np.int32]
|
|
608
|
+
An array with shape (N, 2).
|
|
609
|
+
subset : NDArray[np.int32]
|
|
610
|
+
An array with shape (M, 2) where N >= M.
|
|
611
|
+
|
|
612
|
+
Returns
|
|
613
|
+
-------
|
|
614
|
+
NDArray[np.bool_]
|
|
615
|
+
Returns a bool mask with shape (N,).
|
|
616
|
+
"""
|
|
617
|
+
combined_data = (data[:, 0].astype(np.int64) << 32) | data[:, 1].astype(
|
|
618
|
+
np.uint32
|
|
619
|
+
)
|
|
620
|
+
combined_subset = (subset[:, 0].astype(np.int64) << 32) | subset[
|
|
621
|
+
:, 1
|
|
622
|
+
].astype(np.uint32)
|
|
623
|
+
mask = np.isin(combined_data, combined_subset, assume_unique=False)
|
|
624
|
+
return mask
|
|
625
|
+
|
|
626
|
+
|
|
596
627
|
def compute_confusion_matrix(
|
|
597
628
|
data: NDArray[np.float64],
|
|
598
629
|
label_metadata: NDArray[np.int32],
|
|
@@ -666,20 +697,16 @@ def compute_confusion_matrix(
|
|
|
666
697
|
mask_gt_pd_match = mask_gt_pd_exists & mask_label_match
|
|
667
698
|
mask_gt_pd_mismatch = mask_gt_pd_exists & ~mask_label_match
|
|
668
699
|
|
|
669
|
-
groundtruths = data[:, [0, 1]].astype(
|
|
670
|
-
predictions = data[:, [0, 2]].astype(
|
|
700
|
+
groundtruths = data[:, [0, 1]].astype(np.int32)
|
|
701
|
+
predictions = data[:, [0, 2]].astype(np.int32)
|
|
671
702
|
for iou_idx in range(n_ious):
|
|
672
703
|
mask_iou_threshold = data[:, 3] >= iou_thresholds[iou_idx]
|
|
673
704
|
mask_iou = mask_iou_nonzero & mask_iou_threshold
|
|
674
705
|
|
|
675
706
|
groundtruths_passing_ious = np.unique(groundtruths[mask_iou], axis=0)
|
|
676
|
-
mask_groundtruths_with_passing_ious = (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
== groundtruths_passing_ious.reshape(1, -1, 2)
|
|
680
|
-
)
|
|
681
|
-
.all(axis=2)
|
|
682
|
-
.any(axis=1)
|
|
707
|
+
mask_groundtruths_with_passing_ious = _isin(
|
|
708
|
+
data=groundtruths,
|
|
709
|
+
subset=groundtruths_passing_ious,
|
|
683
710
|
)
|
|
684
711
|
mask_groundtruths_without_passing_ious = (
|
|
685
712
|
~mask_groundtruths_with_passing_ious & mask_gt_exists
|
|
@@ -688,13 +715,9 @@ def compute_confusion_matrix(
|
|
|
688
715
|
predictions_with_passing_ious = np.unique(
|
|
689
716
|
predictions[mask_iou], axis=0
|
|
690
717
|
)
|
|
691
|
-
mask_predictions_with_passing_ious = (
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
== predictions_with_passing_ious.reshape(1, -1, 2)
|
|
695
|
-
)
|
|
696
|
-
.all(axis=2)
|
|
697
|
-
.any(axis=1)
|
|
718
|
+
mask_predictions_with_passing_ious = _isin(
|
|
719
|
+
data=predictions,
|
|
720
|
+
subset=predictions_with_passing_ious,
|
|
698
721
|
)
|
|
699
722
|
mask_predictions_without_passing_ious = (
|
|
700
723
|
~mask_predictions_with_passing_ious & mask_pd_exists
|
|
@@ -707,13 +730,9 @@ def compute_confusion_matrix(
|
|
|
707
730
|
groundtruths_with_passing_score = np.unique(
|
|
708
731
|
groundtruths[mask_iou & mask_score], axis=0
|
|
709
732
|
)
|
|
710
|
-
mask_groundtruths_with_passing_score = (
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
== groundtruths_with_passing_score.reshape(1, -1, 2)
|
|
714
|
-
)
|
|
715
|
-
.all(axis=2)
|
|
716
|
-
.any(axis=1)
|
|
733
|
+
mask_groundtruths_with_passing_score = _isin(
|
|
734
|
+
data=groundtruths,
|
|
735
|
+
subset=groundtruths_with_passing_score,
|
|
717
736
|
)
|
|
718
737
|
mask_groundtruths_without_passing_score = (
|
|
719
738
|
~mask_groundtruths_with_passing_score & mask_gt_exists
|
|
@@ -736,21 +755,13 @@ def compute_confusion_matrix(
|
|
|
736
755
|
)
|
|
737
756
|
|
|
738
757
|
# filter out true-positives from misclf and misprd
|
|
739
|
-
mask_gts_with_tp_override = (
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
== data[mask_tp][:, [0, 1]].reshape(1, -1, 2)
|
|
743
|
-
)
|
|
744
|
-
.all(axis=2)
|
|
745
|
-
.any(axis=1)
|
|
758
|
+
mask_gts_with_tp_override = _isin(
|
|
759
|
+
data=groundtruths[mask_misclf],
|
|
760
|
+
subset=groundtruths[mask_tp],
|
|
746
761
|
)
|
|
747
|
-
mask_pds_with_tp_override = (
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
== data[mask_tp][:, [0, 2]].reshape(1, -1, 2)
|
|
751
|
-
)
|
|
752
|
-
.all(axis=2)
|
|
753
|
-
.any(axis=1)
|
|
762
|
+
mask_pds_with_tp_override = _isin(
|
|
763
|
+
data=predictions[mask_misclf],
|
|
764
|
+
subset=predictions[mask_tp],
|
|
754
765
|
)
|
|
755
766
|
mask_misprd[mask_misclf] |= (
|
|
756
767
|
~mask_gts_with_tp_override & mask_pds_with_tp_override
|
|
@@ -8,7 +8,7 @@ valor_lite/classification/manager.py,sha256=7NKk4syQHH5hBEUDWTD0zIFkJSNdOMzJn8a8
|
|
|
8
8
|
valor_lite/classification/metric.py,sha256=m9_zD82YGl0QhuMql943YNKg67NZ6bsrR8ggs6_JZms,11728
|
|
9
9
|
valor_lite/object_detection/__init__.py,sha256=PiKfemo8FkZRzBhPSjhil8ahGURLy0Vk_iV25CB4UBU,1139
|
|
10
10
|
valor_lite/object_detection/annotation.py,sha256=o6VfiRobiB0ljqsNBLAYMXgi32RSIR7uTA-dgxq6zBI,8248
|
|
11
|
-
valor_lite/object_detection/computation.py,sha256=
|
|
11
|
+
valor_lite/object_detection/computation.py,sha256=ZW83XT-aemRg-5ZdISmrj0bRD9wWmYCU3gkSlfXlNZc,27747
|
|
12
12
|
valor_lite/object_detection/manager.py,sha256=vb4JpynNF0JcnFwNmReFjls9UGAquigN2hpEbG89J04,38991
|
|
13
13
|
valor_lite/object_detection/metric.py,sha256=tHRVnpBqw_w1VwnNkTCmu1yv7Max9FRlf5uh0wYew4s,24046
|
|
14
14
|
valor_lite/semantic_segmentation/__init__.py,sha256=IdarTHKUuUMDvMBmInQu12Mm_NMCbql6Hf0nL5b56Ak,424
|
|
@@ -17,8 +17,8 @@ valor_lite/semantic_segmentation/computation.py,sha256=iJkEmTNmw9HwQCxSnpJkQsAdV
|
|
|
17
17
|
valor_lite/semantic_segmentation/manager.py,sha256=aJk6edWZWKqrzl6hVmEUSZVYhHLuyihxWgAIXsCXkZ0,17361
|
|
18
18
|
valor_lite/semantic_segmentation/metric.py,sha256=Y8M3z92SaABEe9TwBUN37TFsh9DR5WoIxO-TfXVwz8I,6289
|
|
19
19
|
valor_lite/text_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
valor_lite-0.33.
|
|
21
|
-
valor_lite-0.33.
|
|
22
|
-
valor_lite-0.33.
|
|
23
|
-
valor_lite-0.33.
|
|
24
|
-
valor_lite-0.33.
|
|
20
|
+
valor_lite-0.33.11.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
21
|
+
valor_lite-0.33.11.dist-info/METADATA,sha256=QniFV86iMnaqPtJElufV4tkF3-kI1sS6EXKRzupWavc,5632
|
|
22
|
+
valor_lite-0.33.11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
23
|
+
valor_lite-0.33.11.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
|
|
24
|
+
valor_lite-0.33.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|