valor-lite 0.32.2a2__tar.gz → 0.33.1__tar.gz

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.

Potentially problematic release.


This version of valor-lite might be problematic. Click here for more details.

Files changed (39) hide show
  1. {valor_lite-0.32.2a2/valor_lite.egg-info → valor_lite-0.33.1}/PKG-INFO +1 -1
  2. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/benchmarks/benchmark_objdet.py +9 -9
  3. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/conftest.py +326 -0
  4. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_average_precision.py +246 -68
  5. valor_lite-0.33.1/tests/detection/test_average_recall.py +434 -0
  6. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_counts.py +55 -55
  7. valor_lite-0.33.1/tests/detection/test_detailed_counts.py +1830 -0
  8. valor_lite-0.33.1/tests/detection/test_evaluator.py +98 -0
  9. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_filtering.py +33 -15
  10. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_pr_curve.py +15 -15
  11. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_precision.py +65 -65
  12. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_recall.py +55 -55
  13. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/detection/__init__.py +4 -6
  14. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/detection/computation.py +104 -46
  15. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/detection/manager.py +126 -93
  16. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/detection/metric.py +77 -77
  17. {valor_lite-0.32.2a2 → valor_lite-0.33.1/valor_lite.egg-info}/PKG-INFO +1 -1
  18. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite.egg-info/SOURCES.txt +1 -1
  19. valor_lite-0.32.2a2/tests/detection/test_average_recall.py +0 -246
  20. valor_lite-0.32.2a2/tests/detection/test_detailed_pr_curve.py +0 -882
  21. valor_lite-0.32.2a2/tests/detection/test_evaluator.py +0 -31
  22. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/LICENSE +0 -0
  23. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/README.md +0 -0
  24. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/benchmarks/.gitignore +0 -0
  25. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/examples/.gitignore +0 -0
  26. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/examples/coco-yolo.ipynb +0 -0
  27. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/pyproject.toml +0 -0
  28. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/setup.cfg +0 -0
  29. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/__init__.py +0 -0
  30. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_dataloader.py +0 -0
  31. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_iou.py +0 -0
  32. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_schemas.py +0 -0
  33. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/tests/detection/test_stability.py +0 -0
  34. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/__init__.py +0 -0
  35. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/detection/annotation.py +0 -0
  36. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite/schemas.py +0 -0
  37. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite.egg-info/dependency_links.txt +0 -0
  38. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite.egg-info/requires.txt +0 -0
  39. {valor_lite-0.32.2a2 → valor_lite-0.33.1}/valor_lite.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valor-lite
3
- Version: 0.32.2a2
3
+ Version: 0.33.1
4
4
  Summary: Compute valor metrics directly in your client.
5
5
  License: MIT License
6
6
 
@@ -164,7 +164,7 @@ class Benchmark:
164
164
  "total": f"{round(self.ingestion + self.precomputation, 2)} seconds",
165
165
  },
166
166
  "base_evaluation": f"{round(self.evaluation, 2)} seconds",
167
- "detailed_pr_curve": [
167
+ "detailed_evaluation": [
168
168
  {
169
169
  "n_points": 10,
170
170
  "n_examples": curve[0],
@@ -258,14 +258,14 @@ def run_benchmarking_analysis(
258
258
  f"Base precomputation timed out with limit of {limit}."
259
259
  )
260
260
 
261
- # test detailed pr curve with no samples
262
- detailed_pr_curve_time_no_samples, _ = time_it(
263
- evaluator.compute_detailed_pr_curve
261
+ # test detailed counts with no samples
262
+ detailed_counts_time_no_samples, _ = time_it(
263
+ evaluator.compute_detailed_counts
264
264
  )()
265
265
 
266
- # test detailed pr curve with 3 samples
267
- detailed_pr_curve_time_three_samples, _ = time_it(
268
- evaluator.compute_detailed_pr_curve
266
+ # test detailed counts with 3 samples
267
+ detailed_counts_time_three_samples, _ = time_it(
268
+ evaluator.compute_detailed_counts
269
269
  )(n_samples=3)
270
270
 
271
271
  # evaluate
@@ -291,8 +291,8 @@ def run_benchmarking_analysis(
291
291
  precomputation=finalization_time,
292
292
  evaluation=eval_time,
293
293
  detailed_curves=[
294
- (0, detailed_pr_curve_time_no_samples),
295
- (3, detailed_pr_curve_time_three_samples),
294
+ (0, detailed_counts_time_no_samples),
295
+ (3, detailed_counts_time_three_samples),
296
296
  ],
297
297
  ).result()
298
298
  )
@@ -502,3 +502,329 @@ def false_negatives_two_images_one_only_with_different_class_high_confidence_of_
502
502
  ],
503
503
  ),
504
504
  ]
505
+
506
+
507
+ @pytest.fixture
508
+ def detections_fp_hallucination_edge_case() -> list[Detection]:
509
+ return [
510
+ Detection(
511
+ uid="uid1",
512
+ groundtruths=[
513
+ BoundingBox(
514
+ xmin=0,
515
+ xmax=5,
516
+ ymin=0,
517
+ ymax=5,
518
+ labels=[("k1", "v1")],
519
+ )
520
+ ],
521
+ predictions=[
522
+ BoundingBox(
523
+ xmin=0,
524
+ xmax=5,
525
+ ymin=0,
526
+ ymax=5,
527
+ labels=[("k1", "v1")],
528
+ scores=[0.8],
529
+ )
530
+ ],
531
+ ),
532
+ Detection(
533
+ uid="uid2",
534
+ groundtruths=[
535
+ BoundingBox(
536
+ xmin=0,
537
+ xmax=5,
538
+ ymin=0,
539
+ ymax=5,
540
+ labels=[("k1", "v1")],
541
+ )
542
+ ],
543
+ predictions=[
544
+ BoundingBox(
545
+ xmin=10,
546
+ xmax=20,
547
+ ymin=10,
548
+ ymax=20,
549
+ labels=[("k1", "v1")],
550
+ scores=[0.8],
551
+ )
552
+ ],
553
+ ),
554
+ ]
555
+
556
+
557
+ @pytest.fixture
558
+ def detections_tp_deassignment_edge_case() -> list[Detection]:
559
+ return [
560
+ Detection(
561
+ uid="uid0",
562
+ groundtruths=[
563
+ BoundingBox(
564
+ xmin=10,
565
+ xmax=20,
566
+ ymin=10,
567
+ ymax=20,
568
+ labels=[("k1", "v1")],
569
+ ),
570
+ BoundingBox(
571
+ xmin=10,
572
+ xmax=15,
573
+ ymin=20,
574
+ ymax=25,
575
+ labels=[("k1", "v1")],
576
+ ),
577
+ ],
578
+ predictions=[
579
+ BoundingBox(
580
+ xmin=10,
581
+ xmax=20,
582
+ ymin=10,
583
+ ymax=20,
584
+ labels=[("k1", "v1")],
585
+ scores=[0.78],
586
+ ),
587
+ BoundingBox(
588
+ xmin=10,
589
+ xmax=20,
590
+ ymin=12,
591
+ ymax=22,
592
+ labels=[("k1", "v1")],
593
+ scores=[0.96],
594
+ ),
595
+ BoundingBox(
596
+ xmin=10,
597
+ xmax=20,
598
+ ymin=12,
599
+ ymax=22,
600
+ labels=[("k1", "v1")],
601
+ scores=[0.96],
602
+ ),
603
+ BoundingBox(
604
+ xmin=101,
605
+ xmax=102,
606
+ ymin=101,
607
+ ymax=102,
608
+ labels=[("k1", "v1")],
609
+ scores=[0.87],
610
+ ),
611
+ ],
612
+ ),
613
+ ]
614
+
615
+
616
+ @pytest.fixture
617
+ def detection_ranked_pair_ordering() -> Detection:
618
+
619
+ gts = {
620
+ "boxes": [
621
+ (2, 10, 2, 10),
622
+ (2, 10, 2, 10),
623
+ (2, 10, 2, 10),
624
+ ],
625
+ "label_values": ["label1", "label2", "label3"],
626
+ }
627
+
628
+ # labels 1 and 2 have IOU==1, labels 3 and 4 have IOU==0
629
+ preds = {
630
+ "boxes": [
631
+ (2, 10, 2, 10),
632
+ (2, 10, 2, 10),
633
+ (0, 1, 0, 1),
634
+ (0, 1, 0, 1),
635
+ ],
636
+ "label_values": ["label1", "label2", "label3", "label4"],
637
+ "scores": [
638
+ 0.3,
639
+ 0.93,
640
+ 0.92,
641
+ 0.94,
642
+ ],
643
+ }
644
+
645
+ groundtruths = [
646
+ BoundingBox(
647
+ xmin=xmin,
648
+ xmax=xmax,
649
+ ymin=ymin,
650
+ ymax=ymax,
651
+ labels=[("class", label_value)],
652
+ )
653
+ for (xmin, xmax, ymin, ymax), label_value in zip(
654
+ gts["boxes"], gts["label_values"]
655
+ )
656
+ ]
657
+
658
+ predictions = [
659
+ BoundingBox(
660
+ xmin=xmin,
661
+ xmax=xmax,
662
+ ymin=ymin,
663
+ ymax=ymax,
664
+ labels=[("class", label_value)],
665
+ scores=[score],
666
+ )
667
+ for (xmin, xmax, ymin, ymax), label_value, score in zip(
668
+ preds["boxes"], preds["label_values"], preds["scores"]
669
+ )
670
+ ]
671
+
672
+ return Detection(
673
+ uid="uid1", groundtruths=groundtruths, predictions=predictions
674
+ )
675
+
676
+
677
+ @pytest.fixture
678
+ def detections_no_groundtruths() -> list[Detection]:
679
+ return [
680
+ Detection(
681
+ uid="uid",
682
+ groundtruths=[],
683
+ predictions=[
684
+ BoundingBox(
685
+ xmin=0,
686
+ xmax=10,
687
+ ymin=0,
688
+ ymax=10,
689
+ labels=[("k1", "v1")],
690
+ scores=[1.0],
691
+ ),
692
+ BoundingBox(
693
+ xmin=0,
694
+ xmax=10,
695
+ ymin=0,
696
+ ymax=10,
697
+ labels=[("k2", "v2")],
698
+ scores=[1.0],
699
+ ),
700
+ ],
701
+ ),
702
+ Detection(
703
+ uid="uid",
704
+ groundtruths=[],
705
+ predictions=[
706
+ BoundingBox(
707
+ xmin=0,
708
+ xmax=10,
709
+ ymin=0,
710
+ ymax=10,
711
+ labels=[("k1", "v1")],
712
+ scores=[1.0],
713
+ ),
714
+ ],
715
+ ),
716
+ ]
717
+
718
+
719
+ @pytest.fixture
720
+ def detections_no_predictions() -> list[Detection]:
721
+ return [
722
+ Detection(
723
+ uid="uid",
724
+ groundtruths=[
725
+ BoundingBox(
726
+ xmin=0, xmax=10, ymin=0, ymax=10, labels=[("k1", "v1")]
727
+ ),
728
+ BoundingBox(
729
+ xmin=0, xmax=10, ymin=0, ymax=10, labels=[("k2", "v2")]
730
+ ),
731
+ ],
732
+ predictions=[],
733
+ ),
734
+ Detection(
735
+ uid="uid",
736
+ groundtruths=[
737
+ BoundingBox(
738
+ xmin=0, xmax=10, ymin=0, ymax=10, labels=[("k1", "v1")]
739
+ ),
740
+ ],
741
+ predictions=[],
742
+ ),
743
+ ]
744
+
745
+
746
+ @pytest.fixture
747
+ def detections_for_detailed_counting(
748
+ rect1: tuple[float, float, float, float],
749
+ rect2: tuple[float, float, float, float],
750
+ rect3: tuple[float, float, float, float],
751
+ rect4: tuple[float, float, float, float],
752
+ rect5: tuple[float, float, float, float],
753
+ ) -> list[Detection]:
754
+
755
+ return [
756
+ Detection(
757
+ uid="uid1",
758
+ groundtruths=[
759
+ BoundingBox(
760
+ xmin=rect1[0],
761
+ xmax=rect1[1],
762
+ ymin=rect1[2],
763
+ ymax=rect1[3],
764
+ labels=[("k1", "v1")],
765
+ ),
766
+ BoundingBox(
767
+ xmin=rect2[0],
768
+ xmax=rect2[1],
769
+ ymin=rect2[2],
770
+ ymax=rect2[3],
771
+ labels=[("k1", "missed_detection")],
772
+ ),
773
+ BoundingBox(
774
+ xmin=rect3[0],
775
+ xmax=rect3[1],
776
+ ymin=rect3[2],
777
+ ymax=rect3[3],
778
+ labels=[("k1", "v2")],
779
+ ),
780
+ ],
781
+ predictions=[
782
+ BoundingBox(
783
+ xmin=rect1[0],
784
+ xmax=rect1[1],
785
+ ymin=rect1[2],
786
+ ymax=rect1[3],
787
+ labels=[("k1", "v1")],
788
+ scores=[0.5],
789
+ ),
790
+ BoundingBox(
791
+ xmin=rect5[0],
792
+ xmax=rect5[1],
793
+ ymin=rect5[2],
794
+ ymax=rect5[3],
795
+ labels=[("k1", "not_v2")],
796
+ scores=[0.3],
797
+ ),
798
+ BoundingBox(
799
+ xmin=rect4[0],
800
+ xmax=rect4[1],
801
+ ymin=rect4[2],
802
+ ymax=rect4[3],
803
+ labels=[("k1", "hallucination")],
804
+ scores=[0.1],
805
+ ),
806
+ ],
807
+ ),
808
+ Detection(
809
+ uid="uid2",
810
+ groundtruths=[
811
+ BoundingBox(
812
+ xmin=rect1[0],
813
+ xmax=rect1[1],
814
+ ymin=rect1[2],
815
+ ymax=rect1[3],
816
+ labels=[("k1", "low_iou")],
817
+ ),
818
+ ],
819
+ predictions=[
820
+ BoundingBox(
821
+ xmin=rect2[0],
822
+ xmax=rect2[1],
823
+ ymin=rect2[2],
824
+ ymax=rect2[3],
825
+ labels=[("k1", "low_iou")],
826
+ scores=[0.5],
827
+ ),
828
+ ],
829
+ ),
830
+ ]