valor-lite 0.36.4__tar.gz → 0.36.5__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.
- {valor_lite-0.36.4 → valor_lite-0.36.5}/PKG-INFO +1 -1
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/annotation.py +28 -20
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite.egg-info/PKG-INFO +1 -1
- {valor_lite-0.36.4 → valor_lite-0.36.5}/README.md +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/pyproject.toml +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/setup.cfg +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/LICENSE +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/annotation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/computation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/manager.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/metric.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/numpy_compatibility.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/classification/utilities.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/exceptions.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/annotation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/computation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/manager.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/metric.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/object_detection/utilities.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/profiling.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/schemas.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/benchmark.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/computation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/manager.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/metric.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/semantic_segmentation/utilities.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/annotation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/computation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/__init__.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/exceptions.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/generation.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/instructions.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/integrations.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/utilities.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/llm/validators.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/manager.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite/text_generation/metric.py +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite.egg-info/SOURCES.txt +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite.egg-info/dependency_links.txt +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite.egg-info/requires.txt +0 -0
- {valor_lite-0.36.4 → valor_lite-0.36.5}/valor_lite.egg-info/top_level.txt +0 -0
|
@@ -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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
98
|
-
|
|
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"
|
|
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 =
|
|
105
|
-
|
|
106
|
-
|
|
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 |
|
|
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
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|