code-loader 1.0.186.dev4__py3-none-any.whl → 1.0.187.dev0__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.
@@ -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)
@@ -31,6 +31,31 @@ from code_loader.visualizers.default_visualizers import DefaultVisualizer, \
31
31
  mapping_runtime_mode_env_var_mame = '__MAPPING_RUNTIME_MODE__'
32
32
 
33
33
 
34
+ def _stringized_annotation_type_name(annotation: Any) -> Optional[str]:
35
+ """Return the bare type name when ``annotation`` is a *stringized* annotation
36
+ (e.g. produced by ``from __future__ import annotations`` or a quoted hint),
37
+ otherwise ``None``. code_loader inspects raw annotations expecting real classes,
38
+ so a stringized annotation silently breaks type detection."""
39
+ if isinstance(annotation, str):
40
+ return annotation.split("[")[0].strip().rsplit(".", 1)[-1]
41
+ return None
42
+
43
+
44
+ def _reject_stringized_sample_preprocess_response(function: Callable, arg_name: str, annotation: Any) -> None:
45
+ """Fail fast when a ``SamplePreprocessResponse`` argument was stringized. Otherwise
46
+ ``arg_type == SamplePreprocessResponse`` silently evaluates to ``False`` and the
47
+ argument is mis-wired as a regular input — a bug that only surfaces on the platform.
48
+ Fires only on the actual damage (a stringized SamplePreprocessResponse), not merely
49
+ because the file uses future annotations."""
50
+ if _stringized_annotation_type_name(annotation) == SamplePreprocessResponse.__name__:
51
+ raise Exception(
52
+ f"Argument '{arg_name}' of function '{function.__name__}' is annotated with a string "
53
+ f"('{annotation}') instead of the SamplePreprocessResponse type. This usually means the "
54
+ f"file uses 'from __future__ import annotations' (or a quoted hint), which stringizes "
55
+ f"annotations and breaks Tensorleap type detection. Remove that import (or the quotes) so "
56
+ f"SamplePreprocessResponse is referenced as a real type.")
57
+
58
+
34
59
 
35
60
 
36
61
  class LeapBinder:
@@ -123,6 +148,7 @@ class LeapBinder:
123
148
  regular_arg_names = inspect.getfullargspec(function)[0]
124
149
  preprocess_response_arg_name = None
125
150
  for arg_name, arg_type in inspect.getfullargspec(function).annotations.items():
151
+ _reject_stringized_sample_preprocess_response(function, arg_name, arg_type)
126
152
  if arg_type == SamplePreprocessResponse:
127
153
  if preprocess_response_arg_name is not None:
128
154
  raise Exception("only one argument can be of type SamplePreprocessResponse")
@@ -155,6 +181,13 @@ class LeapBinder:
155
181
  f"https://docs.python.org/3/library/typing.html")
156
182
  else:
157
183
  return_type = func_annotations["return"]
184
+ if isinstance(return_type, str):
185
+ raise Exception(
186
+ f"The return type hint of function '{function.__name__}' is a string "
187
+ f"('{return_type}') instead of a type. This usually means the file uses "
188
+ f"'from __future__ import annotations' (or a quoted return hint), which stringizes "
189
+ f"annotations and prevents Tensorleap from detecting the visualizer type. Remove "
190
+ f"that import (or the quotes) so the return type is a real class.")
158
191
  if return_type not in LeapData.__args__: # type: ignore[attr-defined]
159
192
  raise Exception(
160
193
  f'The return type of function {function.__name__} is invalid. current return type: {return_type}, ' # type: ignore[attr-defined]
@@ -296,6 +329,7 @@ class LeapBinder:
296
329
  regular_arg_names = inspect.getfullargspec(function)[0]
297
330
  preprocess_response_arg_name = None
298
331
  for arg_name, arg_type in inspect.getfullargspec(function).annotations.items():
332
+ _reject_stringized_sample_preprocess_response(function, arg_name, arg_type)
299
333
  if arg_type == SamplePreprocessResponse:
300
334
  if preprocess_response_arg_name is not None:
301
335
  raise Exception("only one argument can be of type SamplePreprocessResponse")
@@ -339,6 +373,7 @@ class LeapBinder:
339
373
  regular_arg_names = inspect.getfullargspec(function)[0]
340
374
  preprocess_response_arg_name = None
341
375
  for arg_name, arg_type in inspect.getfullargspec(function).annotations.items():
376
+ _reject_stringized_sample_preprocess_response(function, arg_name, arg_type)
342
377
  if arg_type == SamplePreprocessResponse:
343
378
  if preprocess_response_arg_name is not None:
344
379
  raise Exception("only one argument can be of type SamplePreprocessResponse")
@@ -380,6 +415,7 @@ class LeapBinder:
380
415
  regular_arg_names = inspect.getfullargspec(function)[0]
381
416
  preprocess_response_arg_name = None
382
417
  for arg_name, arg_type in inspect.getfullargspec(function).annotations.items():
418
+ _reject_stringized_sample_preprocess_response(function, arg_name, arg_type)
383
419
  if arg_type == SamplePreprocessResponse:
384
420
  if preprocess_response_arg_name is not None:
385
421
  raise Exception("only one argument can be of type SamplePreprocessResponse")
@@ -1102,19 +1102,33 @@ def _viz_prefix(viz_name: str, leap_type_name: str) -> str:
1102
1102
  return f"Visualizer '{viz_name}' ({leap_type_name}):"
1103
1103
 
1104
1104
 
1105
+ def _warn_nonfinite(arr, viz_name: str, leap_type_name: str, field_name: str = "image data") -> None:
1106
+ """Warn when a float array contains NaN/Inf. Applies to every image-like visualizer, including
1107
+ ImageMask (whose min-max normalization also can't render non-finite values)."""
1108
+ if not isinstance(arr, np.ndarray) or arr.size == 0:
1109
+ return
1110
+ if np.issubdtype(arr.dtype, np.floating) and not np.all(np.isfinite(arr)):
1111
+ store_general_warning(
1112
+ key=("viz_nonfinite", viz_name, leap_type_name, field_name),
1113
+ message=f"{_viz_prefix(viz_name, leap_type_name)} {field_name} contains NaN or Inf values, "
1114
+ f"which will render incorrectly.",
1115
+ link_to_docs=_VIZ_DOCS,
1116
+ )
1117
+
1118
+
1105
1119
  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 will render near-black or clipped."""
1120
+ """Warn when still-image pixel values sit in a range that renders near-black or clipped.
1121
+
1122
+ Applies to Image / ImageWithBBox / ImageWithHeatmap, which the engine encodes with cv2
1123
+ (saturate_cast float->uint8, no scaling). Float is therefore expected in [0, 255]; a
1124
+ normalized [0, 1] float renders near-black. (Video and ImageMask use different conventions.)
1125
+ """
1107
1126
  if not isinstance(image, np.ndarray) or image.size == 0:
1108
1127
  return
1109
1128
  prefix = _viz_prefix(viz_name, leap_type_name)
1110
1129
 
1111
1130
  if np.issubdtype(image.dtype, np.floating):
1112
- if not np.all(np.isfinite(image)):
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
- )
1131
+ _warn_nonfinite(image, viz_name, leap_type_name, field_name)
1118
1132
  finite = image[np.isfinite(image)]
1119
1133
  if finite.size == 0:
1120
1134
  return
@@ -1147,6 +1161,42 @@ def _warn_image_value_range(image, viz_name: str, leap_type_name: str, field_nam
1147
1161
  )
1148
1162
 
1149
1163
 
1164
+ def _warn_video_value_range(video, viz_name: str, leap_type_name: str, field_name: str = "video data") -> None:
1165
+ """Warn when video pixel values won't survive the engine's float->uint8 scaling.
1166
+
1167
+ Unlike still images, the engine scales float video by 255 (videoencoder.py), so float is
1168
+ expected in [0, 1]; values above 1 saturate to white and negatives clip to black. uint8 is
1169
+ used as-is in [0, 255].
1170
+ """
1171
+ if not isinstance(video, np.ndarray) or video.size == 0:
1172
+ return
1173
+ prefix = _viz_prefix(viz_name, leap_type_name)
1174
+
1175
+ if np.issubdtype(video.dtype, np.floating):
1176
+ _warn_nonfinite(video, viz_name, leap_type_name, field_name)
1177
+ finite = video[np.isfinite(video)]
1178
+ if finite.size == 0:
1179
+ return
1180
+ mn, mx = float(finite.min()), float(finite.max())
1181
+ if mn < 0.0 or mx > 1.0:
1182
+ store_general_warning(
1183
+ key=("viz_video_range", viz_name, leap_type_name, field_name),
1184
+ message=(f"{prefix} {field_name} is float with values in [{mn:.3g}, {mx:.3g}], outside the "
1185
+ f"expected [0,1] range. Tensorleap scales float video by 255, so values > 1 saturate "
1186
+ f"to white and negatives clip to black. Provide float video in [0,1], or uint8 in [0,255]."),
1187
+ link_to_docs=_VIZ_DOCS,
1188
+ )
1189
+ elif np.issubdtype(video.dtype, np.integer):
1190
+ mn, mx = int(video.min()), int(video.max())
1191
+ if mx <= 1:
1192
+ store_general_warning(
1193
+ key=("viz_video_int_low", viz_name, leap_type_name, field_name),
1194
+ message=(f"{prefix} {field_name} is uint8 but values span only [{mn}, {mx}] - this will appear "
1195
+ f"near-black. uint8 video is used as-is in [0,255]; scale to [0,255] before casting."),
1196
+ link_to_docs=_VIZ_DOCS,
1197
+ )
1198
+
1199
+
1150
1200
  def _warn_bbox_coords(bounding_boxes, viz_name: str, leap_type_name: str) -> None:
1151
1201
  """Warn when bbox coords are not relative [0,1] (i.e. look like absolute pixels)."""
1152
1202
  for bbox in bounding_boxes:
@@ -1247,9 +1297,14 @@ def _emit_visualizer_warnings(result, viz_name: str, visualizer_type: LeapDataTy
1247
1297
  _warn_image_value_range(result.data, viz_name, leap_type_name)
1248
1298
  _warn_bbox_coords(result.bounding_boxes, viz_name, leap_type_name)
1249
1299
  elif visualizer_type == LeapDataType.Video:
1250
- _warn_image_value_range(result.data, viz_name, leap_type_name, field_name="video data")
1300
+ # Engine scales float video by 255 (videoencoder.py), so float is expected in [0,1] here,
1301
+ # the opposite of the still-image convention.
1302
+ _warn_video_value_range(result.data, viz_name, leap_type_name)
1251
1303
  elif visualizer_type == LeapDataType.ImageMask:
1252
- _warn_image_value_range(result.image, viz_name, leap_type_name)
1304
+ # Engine min-max normalizes the mask image (MaskEngineVisualizer._rescale_min_max), so any
1305
+ # finite value range renders fine - no range warning here. NaN/Inf still break normalization,
1306
+ # so keep that check alongside the structural mask checks.
1307
+ _warn_nonfinite(result.image, viz_name, leap_type_name)
1253
1308
  _warn_image_mask(result, viz_name, leap_type_name)
1254
1309
  elif visualizer_type == LeapDataType.ImageWithHeatmap:
1255
1310
  _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, allow_partial=False):
450
- # type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool, bool) -> Dict[str, Any]
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()
@@ -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
- extend_preprocess=True, allow_partial=False):
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 = leap_data.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
 
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: code-loader
3
- Version: 1.0.186.dev4
3
+ Version: 1.0.187.dev0
4
4
  Summary:
5
- Home-page: https://github.com/tensorleap/code-loader
6
5
  License: MIT
7
6
  Author: dorhar
8
7
  Author-email: doron.harnoy@tensorleap.ai
@@ -20,6 +19,7 @@ Requires-Dist: numpy (>=2.3.2,<3.0.0) ; python_version >= "3.11" and python_vers
20
19
  Requires-Dist: psutil (>=5.9.5,<6.0.0)
21
20
  Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
22
21
  Requires-Dist: requests (>=2.32.3,<3.0.0)
22
+ Project-URL: Homepage, https://github.com/tensorleap/code-loader
23
23
  Project-URL: Repository, https://github.com/tensorleap/code-loader
24
24
  Description-Content-Type: text/markdown
25
25
 
@@ -1,4 +1,3 @@
1
- LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
2
1
  code_loader/__init__.py,sha256=outxRQ0M-zMfV0QGVJmAed5qWfRmyD0TV6-goEGAzBw,406
3
2
  code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
3
  code_loader/contract/datasetclasses.py,sha256=RYZcnX7vLMYhyQtCbX2PscVFNAYULxgAA9U4DRRfLqA,10456
@@ -7,7 +6,7 @@ code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F
7
6
  code_loader/contract/mapping.py,sha256=sWJhpng-IkOzQnWQdMT5w2ZZ3X1Z_OOzSwCLXIS7oxE,1446
8
7
  code_loader/contract/responsedataclasses.py,sha256=5VFgGjRubMW8ItMPils3rkBNejunCGLaa192AIi-xko,4925
9
8
  code_loader/contract/sim_config.py,sha256=le8KMALZiP0WU4UcuKnTOSWBW2rNjpnWYfII502NqDM,3493
10
- code_loader/contract/visualizer_classes.py,sha256=Wz9eItmoRaKEHa3p0aW0Ypxx4_xUmaZyLBznnTuxwi0,15425
9
+ code_loader/contract/visualizer_classes.py,sha256=cWXkBBYk_YP7-VdNwLJvSPQfvBAvoNWircgIuZwHQVc,16519
11
10
  code_loader/default_losses.py,sha256=NoOQym1106bDN5dcIk56Elr7ZG5quUHArqfP5-Nyxyo,1139
12
11
  code_loader/default_metrics.py,sha256=2XSlyNw_XLDGSJDoz5W_Evi5wbL0dhwq24pPr15vSPc,5025
13
12
  code_loader/experiment_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,18 +20,18 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
21
20
  code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
22
21
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
23
22
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
24
- code_loader/inner_leap_binder/leapbinder.py,sha256=XLYYcV50qjMvoC1S6WW0tLBch_0g5gl1UyHiVSWYbvg,40491
25
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=8a7aJ1o4f60VnlErNjX_4RbUXpLWt91pgGcIDLBvOWc,115314
26
- code_loader/leaploader.py,sha256=8Jkmn2k2vyUdRbKM5bTxFFUrUBYZdkHp54kQa5LCdWM,45744
27
- code_loader/leaploaderbase.py,sha256=QynV_LE0l4HnsXLZKjM8p4w2VQL4Fo8dnjQ618OgGjs,6708
23
+ code_loader/inner_leap_binder/leapbinder.py,sha256=aboZWAUr56mjD7iZZFqFARWBxlrugOwz3OqFgW2eyso,43013
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=qfKa--0kG_K_Eb8wRd5tIXEJ6rbKva3360gU8EU9eKo,118375
25
+ code_loader/leaploader.py,sha256=K9Q5kiCZ_A2GkS5qOEantAMvWGaz3bmO1X8buXDSpgg,44682
26
+ code_loader/leaploaderbase.py,sha256=l36qDA00GhZEG5NLKpEtAXgWJA-UQQIhNFGxywK7mUA,6530
28
27
  code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
29
28
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- code_loader/plot_functions/plot_functions.py,sha256=6Q7VWGxetL2W0EK2QeCdObVATvBuHs3YBA09H4uoIk0,14996
29
+ code_loader/plot_functions/plot_functions.py,sha256=2DC-zlVaN13P4VNx5d8csgs80C6SisaeP1-Kq2LW7iM,16075
31
30
  code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6LznoQIvi4vpo,657
32
31
  code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
33
32
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
33
  code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
35
- code_loader-1.0.186.dev4.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
36
- code_loader-1.0.186.dev4.dist-info/METADATA,sha256=qsP-4jYZ3tDf_6C8Z36Zh7fZU7qIplT0wCtSw-RR5kc,1095
37
- code_loader-1.0.186.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- code_loader-1.0.186.dev4.dist-info/RECORD,,
34
+ code_loader-1.0.187.dev0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.187.dev0.dist-info/METADATA,sha256=-aaO2OF82TaWblF2LBoSDFCUJFIlHhV_gpg6ioR3-2M,1107
36
+ code_loader-1.0.187.dev0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
37
+ code_loader-1.0.187.dev0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 TensorLeap
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
File without changes