code-loader 1.0.186.dev4__py3-none-any.whl → 1.0.187__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.
- code_loader/contract/visualizer_classes.py +15 -5
- code_loader/inner_leap_binder/leapbinder_decorators.py +75 -16
- code_loader/leaploader.py +9 -29
- code_loader/leaploaderbase.py +2 -7
- code_loader/plot_functions/plot_functions.py +25 -5
- {code_loader-1.0.186.dev4.dist-info → code_loader-1.0.187.dist-info}/METADATA +1 -1
- {code_loader-1.0.186.dev4.dist-info → code_loader-1.0.187.dist-info}/RECORD +9 -9
- {code_loader-1.0.186.dev4.dist-info → code_loader-1.0.187.dist-info}/LICENSE +0 -0
- {code_loader-1.0.186.dev4.dist-info → code_loader-1.0.187.dist-info}/WHEEL +0 -0
|
@@ -32,12 +32,14 @@ class LeapImage:
|
|
|
32
32
|
Visualizer representing an image for Tensorleap.
|
|
33
33
|
|
|
34
34
|
Attributes:
|
|
35
|
-
data (npt.NDArray[np.float32] | npt.NDArray[np.uint8]): The image data.
|
|
35
|
+
data (npt.NDArray[np.float32] | npt.NDArray[np.uint8]): The image data, shaped [H, W, 3] or [H, W, 1].
|
|
36
|
+
Expected pixel range is [0, 255]. Float values are cast to int (truncated, not scaled), so a
|
|
37
|
+
normalized [0, 1] float image renders near-black - scale it to [0, 255] or pass uint8.
|
|
36
38
|
type (LeapDataType): The data type, default is LeapDataType.Image.
|
|
37
39
|
compress: Optional[bool]: Whether to compress the image (.jpg) or not (.png)
|
|
38
40
|
|
|
39
41
|
Example:
|
|
40
|
-
image_data = np.random.rand(100, 100, 3).astype(np.float32)
|
|
42
|
+
image_data = (np.random.rand(100, 100, 3) * 255).astype(np.float32) # [0, 255]
|
|
41
43
|
leap_image = LeapImage(data=image_data)
|
|
42
44
|
"""
|
|
43
45
|
data: Union[npt.NDArray[np.float32], npt.NDArray[np.uint8]]
|
|
@@ -60,10 +62,12 @@ class LeapVideo:
|
|
|
60
62
|
|
|
61
63
|
Attributes:
|
|
62
64
|
data (npt.NDArray[np.float32] | npt.NDArray[np.uint8]): The video data, shaped [T, H, W, C], where T is the number of frames.
|
|
65
|
+
Note the range differs from still images: float video is expected in [0, 1] (it is scaled by 255),
|
|
66
|
+
while uint8 is used as-is in [0, 255]. Float values above 1 saturate to white.
|
|
63
67
|
type (LeapDataType): The data type, default is LeapDataType.Video.
|
|
64
68
|
|
|
65
69
|
Example:
|
|
66
|
-
video_data = np.random.rand(10, 100, 100, 3).astype(np.float32)
|
|
70
|
+
video_data = np.random.rand(10, 100, 100, 3).astype(np.float32) # [0, 1]
|
|
67
71
|
leap_video = LeapVideo(data=video_data)
|
|
68
72
|
"""
|
|
69
73
|
data: Union[npt.NDArray[np.float32], npt.NDArray[np.uint8]]
|
|
@@ -84,11 +88,13 @@ class LeapImageWithBBox:
|
|
|
84
88
|
|
|
85
89
|
Attributes:
|
|
86
90
|
data (npt.NDArray[np.float32] | npt.NDArray[np.uint8]): The image data, shaped [H, W, 3] or [H, W, 1].
|
|
91
|
+
Expected pixel range is [0, 255]. Float values are cast to int (truncated, not scaled), so a
|
|
92
|
+
normalized [0, 1] float image renders near-black - scale it to [0, 255] or pass uint8.
|
|
87
93
|
bounding_boxes (List[BoundingBox]): List of Tensorleap bounding boxes objects in relative size to image size.
|
|
88
94
|
type (LeapDataType): The data type, default is LeapDataType.ImageWithBBox.
|
|
89
95
|
|
|
90
96
|
Example:
|
|
91
|
-
image_data = np.random.rand(100, 100, 3).astype(np.float32)
|
|
97
|
+
image_data = (np.random.rand(100, 100, 3) * 255).astype(np.float32) # [0, 255]
|
|
92
98
|
bbox = BoundingBox(x=0.5, y=0.5, width=0.2, height=0.2, confidence=0.9, label="object")
|
|
93
99
|
leap_image_with_bbox = LeapImageWithBBox(data=image_data, bounding_boxes=[bbox])
|
|
94
100
|
"""
|
|
@@ -231,6 +237,8 @@ class LeapImageMask:
|
|
|
231
237
|
Attributes:
|
|
232
238
|
mask (npt.NDArray[np.uint8]): The mask data, shaped [H, W].
|
|
233
239
|
image (npt.NDArray[np.float32] | npt.NDArray[np.uint8]): The image data, shaped [H, W, 3] or shaped [H, W, 1].
|
|
240
|
+
Any pixel range is accepted: the image is min-max normalized to [0, 255] for display, so unlike the
|
|
241
|
+
plain Image visualizer, a normalized [0, 1] float renders fine here.
|
|
234
242
|
labels (List[str]): Labels associated with the mask regions; e.g., class names for segmented objects. The length of `labels` should match the number of unique values in `mask`.
|
|
235
243
|
type (LeapDataType): The data type, default is LeapDataType.ImageMask.
|
|
236
244
|
|
|
@@ -304,12 +312,14 @@ class LeapImageWithHeatmap:
|
|
|
304
312
|
|
|
305
313
|
Attributes:
|
|
306
314
|
image (npt.NDArray[np.float32]): The image data, shaped [H, W, C], where C is the number of channels.
|
|
315
|
+
Expected pixel range is [0, 255] (float is truncated to int, not scaled), so a normalized [0, 1] float
|
|
316
|
+
base image renders near-black - scale it to [0, 255]. The overlaid heatmaps are normalized separately.
|
|
307
317
|
heatmaps (npt.NDArray[np.float32]): The heatmap data, shaped [N, H, W], where N is the number of heatmaps.
|
|
308
318
|
labels (List[str]): Labels associated with the heatmaps; e.g., feature names or attention regions. The length of `labels` should match the number of heatmaps, N.
|
|
309
319
|
type (LeapDataType): The data type, default is LeapDataType.ImageWithHeatmap.
|
|
310
320
|
|
|
311
321
|
Example:
|
|
312
|
-
image_data = np.random.rand(100, 100, 3).astype(np.float32)
|
|
322
|
+
image_data = (np.random.rand(100, 100, 3) * 255).astype(np.float32) # [0, 255]
|
|
313
323
|
heatmaps = np.random.rand(3, 100, 100).astype(np.float32)
|
|
314
324
|
labels = ["heatmap1", "heatmap2", "heatmap3"]
|
|
315
325
|
leap_image_with_heatmap = LeapImageWithHeatmap(image=image_data, heatmaps=heatmaps, labels=labels)
|
|
@@ -768,14 +768,18 @@ def tensorleap_custom_metric(name: str,
|
|
|
768
768
|
|
|
769
769
|
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = effective_direction
|
|
770
770
|
|
|
771
|
+
if compute_insights is None:
|
|
772
|
+
effective_compute_insights = None
|
|
773
|
+
elif isinstance(compute_insights, dict):
|
|
774
|
+
effective_compute_insights = {key: compute_insights.get(key, True) for key in result_keys}
|
|
775
|
+
else:
|
|
776
|
+
effective_compute_insights = {key: compute_insights for key in result_keys}
|
|
777
|
+
|
|
778
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.compute_insights = effective_compute_insights
|
|
779
|
+
|
|
771
780
|
if defaulted_direction_keys and not _call_from_tl_platform:
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
elif isinstance(compute_insights, dict):
|
|
775
|
-
effective_compute_insights = compute_insights
|
|
776
|
-
else:
|
|
777
|
-
effective_compute_insights = {k: compute_insights for k in result_keys}
|
|
778
|
-
warning_keys = {key for key in defaulted_direction_keys if effective_compute_insights.get(key, True)}
|
|
781
|
+
warning_keys = {key for key in defaulted_direction_keys
|
|
782
|
+
if (effective_compute_insights or {}).get(key, True)}
|
|
779
783
|
if warning_keys:
|
|
780
784
|
store_warning_by_param(
|
|
781
785
|
param_name=f"direction[{warning_keys}]",
|
|
@@ -1102,19 +1106,33 @@ def _viz_prefix(viz_name: str, leap_type_name: str) -> str:
|
|
|
1102
1106
|
return f"Visualizer '{viz_name}' ({leap_type_name}):"
|
|
1103
1107
|
|
|
1104
1108
|
|
|
1109
|
+
def _warn_nonfinite(arr, viz_name: str, leap_type_name: str, field_name: str = "image data") -> None:
|
|
1110
|
+
"""Warn when a float array contains NaN/Inf. Applies to every image-like visualizer, including
|
|
1111
|
+
ImageMask (whose min-max normalization also can't render non-finite values)."""
|
|
1112
|
+
if not isinstance(arr, np.ndarray) or arr.size == 0:
|
|
1113
|
+
return
|
|
1114
|
+
if np.issubdtype(arr.dtype, np.floating) and not np.all(np.isfinite(arr)):
|
|
1115
|
+
store_general_warning(
|
|
1116
|
+
key=("viz_nonfinite", viz_name, leap_type_name, field_name),
|
|
1117
|
+
message=f"{_viz_prefix(viz_name, leap_type_name)} {field_name} contains NaN or Inf values, "
|
|
1118
|
+
f"which will render incorrectly.",
|
|
1119
|
+
link_to_docs=_VIZ_DOCS,
|
|
1120
|
+
)
|
|
1121
|
+
|
|
1122
|
+
|
|
1105
1123
|
def _warn_image_value_range(image, viz_name: str, leap_type_name: str, field_name: str = "image data") -> None:
|
|
1106
|
-
"""Warn when image pixel values sit in a range that
|
|
1124
|
+
"""Warn when still-image pixel values sit in a range that renders near-black or clipped.
|
|
1125
|
+
|
|
1126
|
+
Applies to Image / ImageWithBBox / ImageWithHeatmap, which the engine encodes with cv2
|
|
1127
|
+
(saturate_cast float->uint8, no scaling). Float is therefore expected in [0, 255]; a
|
|
1128
|
+
normalized [0, 1] float renders near-black. (Video and ImageMask use different conventions.)
|
|
1129
|
+
"""
|
|
1107
1130
|
if not isinstance(image, np.ndarray) or image.size == 0:
|
|
1108
1131
|
return
|
|
1109
1132
|
prefix = _viz_prefix(viz_name, leap_type_name)
|
|
1110
1133
|
|
|
1111
1134
|
if np.issubdtype(image.dtype, np.floating):
|
|
1112
|
-
|
|
1113
|
-
store_general_warning(
|
|
1114
|
-
key=("viz_image_nonfinite", viz_name, leap_type_name, field_name),
|
|
1115
|
-
message=f"{prefix} {field_name} contains NaN or Inf values, which will render incorrectly.",
|
|
1116
|
-
link_to_docs=_VIZ_DOCS,
|
|
1117
|
-
)
|
|
1135
|
+
_warn_nonfinite(image, viz_name, leap_type_name, field_name)
|
|
1118
1136
|
finite = image[np.isfinite(image)]
|
|
1119
1137
|
if finite.size == 0:
|
|
1120
1138
|
return
|
|
@@ -1147,6 +1165,42 @@ def _warn_image_value_range(image, viz_name: str, leap_type_name: str, field_nam
|
|
|
1147
1165
|
)
|
|
1148
1166
|
|
|
1149
1167
|
|
|
1168
|
+
def _warn_video_value_range(video, viz_name: str, leap_type_name: str, field_name: str = "video data") -> None:
|
|
1169
|
+
"""Warn when video pixel values won't survive the engine's float->uint8 scaling.
|
|
1170
|
+
|
|
1171
|
+
Unlike still images, the engine scales float video by 255 (videoencoder.py), so float is
|
|
1172
|
+
expected in [0, 1]; values above 1 saturate to white and negatives clip to black. uint8 is
|
|
1173
|
+
used as-is in [0, 255].
|
|
1174
|
+
"""
|
|
1175
|
+
if not isinstance(video, np.ndarray) or video.size == 0:
|
|
1176
|
+
return
|
|
1177
|
+
prefix = _viz_prefix(viz_name, leap_type_name)
|
|
1178
|
+
|
|
1179
|
+
if np.issubdtype(video.dtype, np.floating):
|
|
1180
|
+
_warn_nonfinite(video, viz_name, leap_type_name, field_name)
|
|
1181
|
+
finite = video[np.isfinite(video)]
|
|
1182
|
+
if finite.size == 0:
|
|
1183
|
+
return
|
|
1184
|
+
mn, mx = float(finite.min()), float(finite.max())
|
|
1185
|
+
if mn < 0.0 or mx > 1.0:
|
|
1186
|
+
store_general_warning(
|
|
1187
|
+
key=("viz_video_range", viz_name, leap_type_name, field_name),
|
|
1188
|
+
message=(f"{prefix} {field_name} is float with values in [{mn:.3g}, {mx:.3g}], outside the "
|
|
1189
|
+
f"expected [0,1] range. Tensorleap scales float video by 255, so values > 1 saturate "
|
|
1190
|
+
f"to white and negatives clip to black. Provide float video in [0,1], or uint8 in [0,255]."),
|
|
1191
|
+
link_to_docs=_VIZ_DOCS,
|
|
1192
|
+
)
|
|
1193
|
+
elif np.issubdtype(video.dtype, np.integer):
|
|
1194
|
+
mn, mx = int(video.min()), int(video.max())
|
|
1195
|
+
if mx <= 1:
|
|
1196
|
+
store_general_warning(
|
|
1197
|
+
key=("viz_video_int_low", viz_name, leap_type_name, field_name),
|
|
1198
|
+
message=(f"{prefix} {field_name} is uint8 but values span only [{mn}, {mx}] - this will appear "
|
|
1199
|
+
f"near-black. uint8 video is used as-is in [0,255]; scale to [0,255] before casting."),
|
|
1200
|
+
link_to_docs=_VIZ_DOCS,
|
|
1201
|
+
)
|
|
1202
|
+
|
|
1203
|
+
|
|
1150
1204
|
def _warn_bbox_coords(bounding_boxes, viz_name: str, leap_type_name: str) -> None:
|
|
1151
1205
|
"""Warn when bbox coords are not relative [0,1] (i.e. look like absolute pixels)."""
|
|
1152
1206
|
for bbox in bounding_boxes:
|
|
@@ -1247,9 +1301,14 @@ def _emit_visualizer_warnings(result, viz_name: str, visualizer_type: LeapDataTy
|
|
|
1247
1301
|
_warn_image_value_range(result.data, viz_name, leap_type_name)
|
|
1248
1302
|
_warn_bbox_coords(result.bounding_boxes, viz_name, leap_type_name)
|
|
1249
1303
|
elif visualizer_type == LeapDataType.Video:
|
|
1250
|
-
|
|
1304
|
+
# Engine scales float video by 255 (videoencoder.py), so float is expected in [0,1] here,
|
|
1305
|
+
# the opposite of the still-image convention.
|
|
1306
|
+
_warn_video_value_range(result.data, viz_name, leap_type_name)
|
|
1251
1307
|
elif visualizer_type == LeapDataType.ImageMask:
|
|
1252
|
-
|
|
1308
|
+
# Engine min-max normalizes the mask image (MaskEngineVisualizer._rescale_min_max), so any
|
|
1309
|
+
# finite value range renders fine - no range warning here. NaN/Inf still break normalization,
|
|
1310
|
+
# so keep that check alongside the structural mask checks.
|
|
1311
|
+
_warn_nonfinite(result.image, viz_name, leap_type_name)
|
|
1253
1312
|
_warn_image_mask(result, viz_name, leap_type_name)
|
|
1254
1313
|
elif visualizer_type == LeapDataType.ImageWithHeatmap:
|
|
1255
1314
|
_warn_image_with_heatmap(result, viz_name, leap_type_name)
|
code_loader/leaploader.py
CHANGED
|
@@ -446,8 +446,8 @@ class LeapLoader(LeapLoaderBase):
|
|
|
446
446
|
return result_payloads
|
|
447
447
|
|
|
448
448
|
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0,
|
|
449
|
-
sample_ids=None, extend_preprocess=True
|
|
450
|
-
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool
|
|
449
|
+
sample_ids=None, extend_preprocess=True):
|
|
450
|
+
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool) -> Dict[str, Any]
|
|
451
451
|
# extend_preprocess=True (default): also extend preprocess_result[additional] with the
|
|
452
452
|
# new synthetic sample_ids (producer-side behavior — synthetic worker needs this for
|
|
453
453
|
# enumeration / data_length tracking). Pass False from consumer-side populators that
|
|
@@ -474,26 +474,19 @@ class LeapLoader(LeapLoaderBase):
|
|
|
474
474
|
for sample_id in original_sample_ids:
|
|
475
475
|
for handler in global_leap_binder.setup_container.inputs:
|
|
476
476
|
per_encoder[handler.name].append(handler.function(sample_id, sim_preprocess))
|
|
477
|
-
encoded = {
|
|
478
|
-
name: np.stack(arrays) if arrays else np.empty((0,), dtype=np.float32)
|
|
479
|
-
for name, arrays in per_encoder.items()
|
|
480
|
-
}
|
|
477
|
+
encoded = {name: np.stack(arrays) for name, arrays in per_encoder.items()}
|
|
481
478
|
if sample_ids is not None:
|
|
479
|
+
if len(sample_ids) != len(original_sample_ids):
|
|
480
|
+
raise ValueError(
|
|
481
|
+
"sample_ids length ({}) does not match simulation output length ({})".format(
|
|
482
|
+
len(sample_ids), len(original_sample_ids)
|
|
483
|
+
)
|
|
484
|
+
)
|
|
482
485
|
for sid in sample_ids:
|
|
483
486
|
if not isinstance(sid, str):
|
|
484
487
|
raise TypeError(
|
|
485
488
|
"All sample_ids must be of type str. Got: {}".format(type(sid))
|
|
486
489
|
)
|
|
487
|
-
if len(sample_ids) != len(original_sample_ids):
|
|
488
|
-
if not allow_partial:
|
|
489
|
-
raise ValueError(
|
|
490
|
-
"sample_ids length ({}) does not match simulation output length ({})".format(
|
|
491
|
-
len(sample_ids), len(original_sample_ids)
|
|
492
|
-
)
|
|
493
|
-
)
|
|
494
|
-
n_bound = min(len(sample_ids), len(original_sample_ids))
|
|
495
|
-
sample_ids = list(sample_ids)[:n_bound]
|
|
496
|
-
original_sample_ids = original_sample_ids[:n_bound]
|
|
497
490
|
for synth_id, original_local_id in zip(sample_ids, original_sample_ids):
|
|
498
491
|
self._synthetic_lookup[synth_id] = (sim_preprocess, original_local_id)
|
|
499
492
|
if extend_preprocess:
|
|
@@ -503,19 +496,6 @@ class LeapLoader(LeapLoaderBase):
|
|
|
503
496
|
returned_sample_ids = original_sample_ids
|
|
504
497
|
return {"encoded": encoded, "sample_ids": returned_sample_ids}
|
|
505
498
|
|
|
506
|
-
def prune_synthetic_lookup(self, keep_ids):
|
|
507
|
-
# type: (List[str]) -> None
|
|
508
|
-
# Keep only the given synthetic sample_ids in the in-memory lookup and
|
|
509
|
-
# drop the rest, so preprocess responses don't accumulate across many
|
|
510
|
-
# run_simulation calls (e.g. a synthetic calibration loop keeps only its
|
|
511
|
-
# running top-K trials). Keep-set semantics (rather than evict-list) so
|
|
512
|
-
# the caller can bound the lookup to a known-good set each iteration
|
|
513
|
-
# without tracking everything it ever generated.
|
|
514
|
-
keep = set(keep_ids)
|
|
515
|
-
self._synthetic_lookup = {
|
|
516
|
-
sid: entry for sid, entry in self._synthetic_lookup.items() if sid in keep
|
|
517
|
-
}
|
|
518
|
-
|
|
519
499
|
def _extend_additional_preprocess(self, new_sample_ids: List[str]) -> None:
|
|
520
500
|
if self._preprocess_result_cached is None:
|
|
521
501
|
self._preprocess_result()
|
code_loader/leaploaderbase.py
CHANGED
|
@@ -154,13 +154,8 @@ class LeapLoaderBase:
|
|
|
154
154
|
pass
|
|
155
155
|
|
|
156
156
|
@abstractmethod
|
|
157
|
-
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0, sample_ids=None
|
|
158
|
-
|
|
159
|
-
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool, bool) -> Dict[str, Any]
|
|
160
|
-
pass
|
|
161
|
-
|
|
162
|
-
def prune_synthetic_lookup(self, keep_ids):
|
|
163
|
-
# type: (List[str]) -> None
|
|
157
|
+
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0, sample_ids=None):
|
|
158
|
+
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]]) -> Dict[str, Any]
|
|
164
159
|
pass
|
|
165
160
|
|
|
166
161
|
def is_custom_latent_space(self) -> bool:
|
|
@@ -21,6 +21,25 @@ import math
|
|
|
21
21
|
|
|
22
22
|
from code_loader.contract.visualizer_classes import LeapImage, LeapImageWithBBox, LeapGraph, LeapText, \
|
|
23
23
|
LeapHorizontalBar, LeapImageMask, LeapTextMask, LeapImageWithHeatmap, LeapVideo
|
|
24
|
+
from code_loader.utils import rescale_min_max
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _to_engine_image(image: np.ndarray) -> np.ndarray:
|
|
28
|
+
"""Match the engine's still-image encoding (cv2 saturate_cast): round + clip to [0,255],
|
|
29
|
+
no scaling, returned as uint8. Float is expected in [0,255]; a normalized [0,1] float
|
|
30
|
+
therefore renders near-black, exactly as it would on the platform."""
|
|
31
|
+
if np.issubdtype(image.dtype, np.floating):
|
|
32
|
+
return np.clip(np.rint(image), 0, 255).astype(np.uint8)
|
|
33
|
+
return np.clip(image, 0, 255).astype(np.uint8)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _to_engine_video(video: np.ndarray) -> np.ndarray:
|
|
37
|
+
"""Match the engine's video encoding (videoencoder.py): float is scaled by 255 then clipped,
|
|
38
|
+
uint8 is used as-is. Float is expected in [0,1]."""
|
|
39
|
+
if np.issubdtype(video.dtype, np.floating):
|
|
40
|
+
return (video * 255).clip(0, 255).astype(np.uint8)
|
|
41
|
+
return np.clip(video, 0, 255).astype(np.uint8)
|
|
42
|
+
|
|
24
43
|
|
|
25
44
|
def run_only_on_non_mapping_mode():
|
|
26
45
|
"""
|
|
@@ -51,7 +70,7 @@ def plot_image_with_b_box(leap_data: LeapImageWithBBox, title: str) -> None:
|
|
|
51
70
|
visualize(leap_image_with_bbox, title)
|
|
52
71
|
"""
|
|
53
72
|
|
|
54
|
-
image = leap_data.data
|
|
73
|
+
image = _to_engine_image(leap_data.data)
|
|
55
74
|
bounding_boxes = leap_data.bounding_boxes
|
|
56
75
|
|
|
57
76
|
# Create figure and axes
|
|
@@ -107,7 +126,7 @@ def plot_image(leap_data: LeapImage, title: str) -> None:
|
|
|
107
126
|
title = "Image"
|
|
108
127
|
visualize(leap_image, title)
|
|
109
128
|
"""
|
|
110
|
-
image_data = leap_data.data
|
|
129
|
+
image_data = _to_engine_image(leap_data.data)
|
|
111
130
|
|
|
112
131
|
# If the image has one channel, convert it to a 3-channel image for display
|
|
113
132
|
if image_data.shape[2] == 1:
|
|
@@ -305,7 +324,8 @@ def plot_image_mask(leap_data: LeapImageMask, title: str) -> None:
|
|
|
305
324
|
visualize(leap_image_mask, title)
|
|
306
325
|
"""
|
|
307
326
|
|
|
308
|
-
image
|
|
327
|
+
# Engine min-max normalizes the mask image to [0,255] (MaskEngineVisualizer._rescale_min_max)
|
|
328
|
+
image = rescale_min_max(leap_data.image)
|
|
309
329
|
mask = leap_data.mask
|
|
310
330
|
labels = leap_data.labels
|
|
311
331
|
|
|
@@ -390,7 +410,7 @@ def plot_text_mask(leap_data: LeapTextMask, title: str) -> None:
|
|
|
390
410
|
|
|
391
411
|
@run_only_on_non_mapping_mode()
|
|
392
412
|
def plot_video(leap_data: LeapVideo, title: str) -> None:
|
|
393
|
-
video_data = leap_data.data
|
|
413
|
+
video_data = _to_engine_video(leap_data.data)
|
|
394
414
|
fig, ax = plt.subplots()
|
|
395
415
|
fig.patch.set_facecolor('black')
|
|
396
416
|
ax.set_facecolor('black')
|
|
@@ -416,7 +436,7 @@ def plot_image_with_heatmap(leap_data: LeapImageWithHeatmap, title: str) -> None
|
|
|
416
436
|
title = "Image With Heatmap"
|
|
417
437
|
visualize(leap_image_with_heatmap, title)
|
|
418
438
|
"""
|
|
419
|
-
image = leap_data.image
|
|
439
|
+
image = _to_engine_image(leap_data.image)
|
|
420
440
|
heatmaps = leap_data.heatmaps
|
|
421
441
|
labels = leap_data.labels
|
|
422
442
|
|
|
@@ -7,7 +7,7 @@ code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F
|
|
|
7
7
|
code_loader/contract/mapping.py,sha256=sWJhpng-IkOzQnWQdMT5w2ZZ3X1Z_OOzSwCLXIS7oxE,1446
|
|
8
8
|
code_loader/contract/responsedataclasses.py,sha256=5VFgGjRubMW8ItMPils3rkBNejunCGLaa192AIi-xko,4925
|
|
9
9
|
code_loader/contract/sim_config.py,sha256=le8KMALZiP0WU4UcuKnTOSWBW2rNjpnWYfII502NqDM,3493
|
|
10
|
-
code_loader/contract/visualizer_classes.py,sha256=
|
|
10
|
+
code_loader/contract/visualizer_classes.py,sha256=cWXkBBYk_YP7-VdNwLJvSPQfvBAvoNWircgIuZwHQVc,16519
|
|
11
11
|
code_loader/default_losses.py,sha256=NoOQym1106bDN5dcIk56Elr7ZG5quUHArqfP5-Nyxyo,1139
|
|
12
12
|
code_loader/default_metrics.py,sha256=2XSlyNw_XLDGSJDoz5W_Evi5wbL0dhwq24pPr15vSPc,5025
|
|
13
13
|
code_loader/experiment_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -22,17 +22,17 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
|
22
22
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
23
23
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
24
24
|
code_loader/inner_leap_binder/leapbinder.py,sha256=XLYYcV50qjMvoC1S6WW0tLBch_0g5gl1UyHiVSWYbvg,40491
|
|
25
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
26
|
-
code_loader/leaploader.py,sha256=
|
|
27
|
-
code_loader/leaploaderbase.py,sha256=
|
|
25
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=8ob0KdvpeeNEzA3OZ4UL3dU3gigjB959zNfSvB8KHzw,118570
|
|
26
|
+
code_loader/leaploader.py,sha256=K9Q5kiCZ_A2GkS5qOEantAMvWGaz3bmO1X8buXDSpgg,44682
|
|
27
|
+
code_loader/leaploaderbase.py,sha256=l36qDA00GhZEG5NLKpEtAXgWJA-UQQIhNFGxywK7mUA,6530
|
|
28
28
|
code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
|
|
29
29
|
code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
code_loader/plot_functions/plot_functions.py,sha256=
|
|
30
|
+
code_loader/plot_functions/plot_functions.py,sha256=2DC-zlVaN13P4VNx5d8csgs80C6SisaeP1-Kq2LW7iM,16075
|
|
31
31
|
code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6LznoQIvi4vpo,657
|
|
32
32
|
code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
|
|
33
33
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
|
|
35
|
-
code_loader-1.0.
|
|
36
|
-
code_loader-1.0.
|
|
37
|
-
code_loader-1.0.
|
|
38
|
-
code_loader-1.0.
|
|
35
|
+
code_loader-1.0.187.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
36
|
+
code_loader-1.0.187.dist-info/METADATA,sha256=uVGw15k07GJwz-s1QIHhL6IUkfbfDv49kUaD6YlceQI,1090
|
|
37
|
+
code_loader-1.0.187.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
38
|
+
code_loader-1.0.187.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|