valor-lite 0.36.4__tar.gz → 0.36.6__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 (46) hide show
  1. {valor_lite-0.36.4 → valor_lite-0.36.6}/PKG-INFO +1 -1
  2. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/computation.py +0 -6
  3. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/manager.py +0 -1
  4. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/utilities.py +0 -9
  5. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/annotation.py +28 -20
  6. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite.egg-info/PKG-INFO +1 -1
  7. {valor_lite-0.36.4 → valor_lite-0.36.6}/README.md +0 -0
  8. {valor_lite-0.36.4 → valor_lite-0.36.6}/pyproject.toml +0 -0
  9. {valor_lite-0.36.4 → valor_lite-0.36.6}/setup.cfg +0 -0
  10. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/LICENSE +0 -0
  11. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/__init__.py +0 -0
  12. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/__init__.py +0 -0
  13. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/annotation.py +0 -0
  14. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/computation.py +0 -0
  15. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/manager.py +0 -0
  16. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/metric.py +0 -0
  17. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/numpy_compatibility.py +0 -0
  18. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/classification/utilities.py +0 -0
  19. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/exceptions.py +0 -0
  20. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/__init__.py +0 -0
  21. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/annotation.py +0 -0
  22. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/object_detection/metric.py +0 -0
  23. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/profiling.py +0 -0
  24. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/schemas.py +0 -0
  25. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/__init__.py +0 -0
  26. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/benchmark.py +0 -0
  27. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/computation.py +0 -0
  28. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/manager.py +0 -0
  29. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/metric.py +0 -0
  30. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/semantic_segmentation/utilities.py +0 -0
  31. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/__init__.py +0 -0
  32. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/annotation.py +0 -0
  33. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/computation.py +0 -0
  34. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/__init__.py +0 -0
  35. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/exceptions.py +0 -0
  36. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/generation.py +0 -0
  37. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/instructions.py +0 -0
  38. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/integrations.py +0 -0
  39. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/utilities.py +0 -0
  40. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/llm/validators.py +0 -0
  41. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/manager.py +0 -0
  42. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite/text_generation/metric.py +0 -0
  43. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite.egg-info/SOURCES.txt +0 -0
  44. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite.egg-info/dependency_links.txt +0 -0
  45. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite.egg-info/requires.txt +0 -0
  46. {valor_lite-0.36.4 → valor_lite-0.36.6}/valor_lite.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valor-lite
3
- Version: 0.36.4
3
+ Version: 0.36.6
4
4
  Summary: Evaluate machine learning models.
5
5
  Project-URL: homepage, https://www.striveworks.com
6
6
  Requires-Python: >=3.10
@@ -345,12 +345,6 @@ def rank_pairs(
345
345
  mask_unmatched_predictions = ~np.isin(pairs[:, 2], matched_predictions)
346
346
  pairs = pairs[mask_label_match | mask_unmatched_predictions]
347
347
 
348
- # remove predictions for labels that have no ground truths
349
- for label_idx, count in enumerate(label_metadata[:, 0]):
350
- if count > 0:
351
- continue
352
- pairs = pairs[pairs[:, 4] != label_idx]
353
-
354
348
  # only keep the highest ranked pair
355
349
  _, indices = np.unique(pairs[:, [0, 2, 4]], axis=0, return_index=True)
356
350
  pairs = pairs[indices]
@@ -410,7 +410,6 @@ class Evaluator:
410
410
  )
411
411
  return unpack_precision_recall_into_metric_lists(
412
412
  results=results,
413
- label_metadata=label_metadata,
414
413
  iou_thresholds=iou_thresholds,
415
414
  score_thresholds=score_thresholds,
416
415
  index_to_label=self.index_to_label,
@@ -23,7 +23,6 @@ def unpack_precision_recall_into_metric_lists(
23
23
  iou_thresholds: list[float],
24
24
  score_thresholds: list[float],
25
25
  index_to_label: list[str],
26
- label_metadata: NDArray[np.int32],
27
26
  ):
28
27
  (
29
28
  (
@@ -48,7 +47,6 @@ def unpack_precision_recall_into_metric_lists(
48
47
  )
49
48
  for iou_idx, iou_threshold in enumerate(iou_thresholds)
50
49
  for label_idx, label in enumerate(index_to_label)
51
- if int(label_metadata[label_idx, 0]) > 0
52
50
  ]
53
51
 
54
52
  metrics[MetricType.mAP] = [
@@ -67,7 +65,6 @@ def unpack_precision_recall_into_metric_lists(
67
65
  label=label,
68
66
  )
69
67
  for label_idx, label in enumerate(index_to_label)
70
- if int(label_metadata[label_idx, 0]) > 0
71
68
  ]
72
69
 
73
70
  # TODO - (c.zaloom) will be removed in the future
@@ -87,7 +84,6 @@ def unpack_precision_recall_into_metric_lists(
87
84
  )
88
85
  for score_idx, score_threshold in enumerate(score_thresholds)
89
86
  for label_idx, label in enumerate(index_to_label)
90
- if int(label_metadata[label_idx, 0]) > 0
91
87
  ]
92
88
 
93
89
  metrics[MetricType.mAR] = [
@@ -108,7 +104,6 @@ def unpack_precision_recall_into_metric_lists(
108
104
  label=label,
109
105
  )
110
106
  for label_idx, label in enumerate(index_to_label)
111
- if int(label_metadata[label_idx, 0]) > 0
112
107
  ]
113
108
 
114
109
  # TODO - (c.zaloom) will be removed in the future
@@ -129,13 +124,9 @@ def unpack_precision_recall_into_metric_lists(
129
124
  )
130
125
  for iou_idx, iou_threshold in enumerate(iou_thresholds)
131
126
  for label_idx, label in enumerate(index_to_label)
132
- if label_metadata[label_idx, 0] > 0
133
127
  ]
134
128
 
135
129
  for label_idx, label in enumerate(index_to_label):
136
- if label_metadata[label_idx, 0] == 0:
137
- continue
138
-
139
130
  for score_idx, score_threshold in enumerate(score_thresholds):
140
131
  for iou_idx, iou_threshold in enumerate(iou_thresholds):
141
132
 
@@ -1,3 +1,4 @@
1
+ import warnings
1
2
  from dataclasses import dataclass, field
2
3
 
3
4
  import numpy as np
@@ -79,30 +80,37 @@ class Segmentation:
79
80
  )
80
81
  self.size = self.shape[0] * self.shape[1]
81
82
 
82
- mask_accumulation = None
83
- for groundtruth in self.groundtruths:
84
- if self.shape != groundtruth.mask.shape:
85
- raise ValueError(
86
- f"ground truth masks for datum '{self.uid}' should have shape '{self.shape}'. Received mask with shape '{groundtruth.mask.shape}'"
87
- )
88
-
89
- if mask_accumulation is None:
90
- mask_accumulation = groundtruth.mask.copy()
91
- elif np.logical_and(mask_accumulation, groundtruth.mask).any():
92
- raise ValueError("ground truth masks cannot overlap")
93
- else:
94
- mask_accumulation = mask_accumulation | groundtruth.mask
83
+ self._validate_bitmasks(self.groundtruths, "ground truth")
84
+ self._validate_bitmasks(self.predictions, "prediction")
95
85
 
86
+ def _validate_bitmasks(self, bitmasks: list[Bitmask], key: str):
96
87
  mask_accumulation = None
97
- for prediction in self.predictions:
98
- if self.shape != prediction.mask.shape:
88
+ mask_overlap_accumulation = None
89
+ for idx, bitmask in enumerate(bitmasks):
90
+ if not isinstance(bitmask, Bitmask):
91
+ raise ValueError(f"expected 'Bitmask', got '{bitmask}'")
92
+ if self.shape != bitmask.mask.shape:
99
93
  raise ValueError(
100
- f"prediction masks for datum '{self.uid}' should have shape '{self.shape}'. Received mask with shape '{prediction.mask.shape}'"
94
+ f"{key} masks for datum '{self.uid}' should have shape '{self.shape}'. Received mask with shape '{bitmask.mask.shape}'"
101
95
  )
102
96
 
103
97
  if mask_accumulation is None:
104
- mask_accumulation = prediction.mask.copy()
105
- elif np.logical_and(mask_accumulation, prediction.mask).any():
106
- raise ValueError("prediction masks cannot overlap")
98
+ mask_accumulation = bitmask.mask.copy()
99
+ mask_overlap_accumulation = np.zeros_like(mask_accumulation)
100
+ elif np.logical_and(mask_accumulation, bitmask.mask).any():
101
+ mask_overlap = np.logical_and(mask_accumulation, bitmask.mask)
102
+ bitmasks[idx].mask[mask_overlap] = False
103
+ mask_overlap_accumulation = (
104
+ mask_overlap_accumulation | mask_overlap
105
+ )
107
106
  else:
108
- mask_accumulation = mask_accumulation | prediction.mask
107
+ mask_accumulation = mask_accumulation | bitmask.mask
108
+ if (
109
+ mask_overlap_accumulation is not None
110
+ and mask_overlap_accumulation.any()
111
+ ):
112
+ count = mask_overlap_accumulation.sum()
113
+ total = mask_overlap_accumulation.size
114
+ warnings.warn(
115
+ f"{key} masks for datum '{self.uid}' had {count} / {total} pixels overlapped."
116
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valor-lite
3
- Version: 0.36.4
3
+ Version: 0.36.6
4
4
  Summary: Evaluate machine learning models.
5
5
  Project-URL: homepage, https://www.striveworks.com
6
6
  Requires-Python: >=3.10
File without changes
File without changes
File without changes