code-loader 1.0.86a0__py3-none-any.whl → 1.0.86.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.
@@ -7,7 +7,7 @@ import numpy.typing as npt
7
7
  from code_loader.contract.enums import DataStateType, DataStateEnum, LeapDataType, ConfusionMatrixValue, \
8
8
  MetricDirection, DatasetMetadataType
9
9
  from code_loader.contract.visualizer_classes import LeapImage, LeapText, LeapGraph, LeapHorizontalBar, \
10
- LeapTextMask, LeapImageMask, LeapImageWithBBox, LeapImageWithHeatmap
10
+ LeapTextMask, LeapImageMask, LeapImageWithBBox, LeapImageWithHeatmap, LeapVideo
11
11
 
12
12
  custom_latent_space_attribute = "custom_latent_space"
13
13
 
@@ -40,9 +40,6 @@ class PreprocessResponse:
40
40
  sample_id_type: Optional[Union[Type[str], Type[int]]] = None
41
41
 
42
42
  def __post_init__(self) -> None:
43
- def is_valid_string(s: str) -> bool:
44
- return bool(re.match(r'^[A-Za-z0-9_]+$', s))
45
-
46
43
  if self.length is not None and self.sample_ids is None:
47
44
  self.sample_ids = [i for i in range(self.length)]
48
45
  self.sample_id_type = int
@@ -53,8 +50,6 @@ class PreprocessResponse:
53
50
  if self.sample_id_type == str:
54
51
  for sample_id in self.sample_ids:
55
52
  assert isinstance(sample_id, str), f"Sample id should be of type str. Got: {type(sample_id)}"
56
- if not is_valid_string(sample_id):
57
- raise Exception(f"Sample id should contain only letters (A-Z, a-z), numbers or '_'. Got: {sample_id}")
58
53
  else:
59
54
  raise Exception("length is deprecated.")
60
55
 
@@ -94,6 +89,7 @@ class UnlabeledDataPreprocessHandler:
94
89
 
95
90
  VisualizerCallableInterface = Union[
96
91
  Callable[..., LeapImage],
92
+ Callable[..., LeapVideo],
97
93
  Callable[..., LeapText],
98
94
  Callable[..., LeapGraph],
99
95
  Callable[..., LeapHorizontalBar],
@@ -104,7 +100,7 @@ VisualizerCallableInterface = Union[
104
100
  ]
105
101
 
106
102
  LeapData = Union[LeapImage, LeapText, LeapGraph, LeapHorizontalBar, LeapImageMask, LeapTextMask, LeapImageWithBBox,
107
- LeapImageWithHeatmap]
103
+ LeapImageWithHeatmap, LeapVideo]
108
104
 
109
105
  CustomCallableInterface = Callable[..., Any]
110
106
 
@@ -20,7 +20,7 @@ from code_loader.utils import to_numpy_return_wrapper, get_shape
20
20
  from code_loader.visualizers.default_visualizers import DefaultVisualizer, \
21
21
  default_graph_visualizer, \
22
22
  default_image_visualizer, default_horizontal_bar_visualizer, default_word_visualizer, \
23
- default_image_mask_visualizer, default_text_mask_visualizer, default_raw_data_visualizer
23
+ default_image_mask_visualizer, default_text_mask_visualizer, default_raw_data_visualizer, default_video_visualizer
24
24
 
25
25
 
26
26
  class LeapBinder:
@@ -48,6 +48,8 @@ class LeapBinder:
48
48
  def _extend_with_default_visualizers(self) -> None:
49
49
  self.set_visualizer(function=default_image_visualizer, name=DefaultVisualizer.Image.value,
50
50
  visualizer_type=LeapDataType.Image)
51
+ self.set_visualizer(function=default_video_visualizer, name=DefaultVisualizer.Video.value,
52
+ visualizer_type=LeapDataType.Video)
51
53
  self.set_visualizer(function=default_graph_visualizer, name=DefaultVisualizer.Graph.value,
52
54
  visualizer_type=LeapDataType.Graph)
53
55
  self.set_visualizer(function=default_raw_data_visualizer, name=DefaultVisualizer.RawData.value,
@@ -516,7 +518,7 @@ class LeapBinder:
516
518
  raise Exception(f"Metadata {single_metadata_name} is None and no metadata type is provided")
517
519
  metadata_type = dataset_base_handler.metadata_type[single_metadata_name]
518
520
  else:
519
- raise Exception(f"Metadata {single_metadata_name} is None and no metadata type is provided")
521
+ raise Exception(f"Metadata {single_metadata_name} is None and metadata type is not a dict")
520
522
 
521
523
  result_shape = get_shape(single_metadata_result)
522
524
  metadata_test_result.shape = result_shape
@@ -4,12 +4,13 @@ import numpy as np
4
4
  import numpy.typing as npt
5
5
 
6
6
  from code_loader.contract.visualizer_classes import LeapImage, LeapGraph, LeapHorizontalBar, LeapText, \
7
- LeapImageMask, LeapTextMask
7
+ LeapImageMask, LeapTextMask, LeapVideo
8
8
  from code_loader.utils import rescale_min_max
9
9
 
10
10
 
11
11
  class DefaultVisualizer(Enum):
12
12
  Image = 'Image'
13
+ Video = 'Video'
13
14
  Graph = 'Graph'
14
15
  HorizontalBar = 'HorizontalBar'
15
16
  Text = 'Text'
@@ -23,6 +24,10 @@ def default_image_visualizer(data: npt.NDArray[np.float32]) -> LeapImage:
23
24
  return LeapImage(rescaled_data)
24
25
 
25
26
 
27
+ def default_video_visualizer(data: npt.NDArray[np.float32]) -> LeapVideo:
28
+ return LeapVideo(data)
29
+
30
+
26
31
  def default_graph_visualizer(data: npt.NDArray[np.float32]) -> LeapGraph:
27
32
  return LeapGraph(data)
28
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.86a0
3
+ Version: 1.0.86.dev0
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
2
2
  code_loader/__init__.py,sha256=6MMWr0ObOU7hkqQKgOqp4Zp3I28L7joGC9iCbQYtAJg,241
3
3
  code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- code_loader/contract/datasetclasses.py,sha256=rpsccWddYksLQhB0fDZKZsiuclb32wtAraLtvXZ0teM,7912
4
+ code_loader/contract/datasetclasses.py,sha256=3BWSCHaKtNWlKucMkPKSMiuvZosnnQgXFq2R-GbVOgg,7679
5
5
  code_loader/contract/enums.py,sha256=GEFkvUMXnCNt-GOoz7NJ9ecQZ2PPDettJNOsxsiM0wk,1622
6
6
  code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F4RiyQ,51
7
7
  code_loader/contract/responsedataclasses.py,sha256=RSx9m_R3LawhK5o1nAcO3hfp2F9oJYtxZr_bpP3bTmw,4005
@@ -19,14 +19,14 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
19
19
  code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
20
20
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
21
21
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
22
- code_loader/inner_leap_binder/leapbinder.py,sha256=q0nSOOL-yYO4DYZUy4O3sEkzb3SeF1__0POWyZUuh1o,30627
22
+ code_loader/inner_leap_binder/leapbinder.py,sha256=-LaQNJ2EVJA7HnxaTJyEYthZgOE7kvaq60OXcDwWgJE,30815
23
23
  code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=qcYyekpIN1hgbmSqTrN7o6IMpfu8ZWp2J_lhMEoV8I8,22598
24
24
  code_loader/leaploader.py,sha256=t9ITSzECPg5sGXHxsYkcr45tDipd79hJw6lhwo4yEIE,25412
25
25
  code_loader/leaploaderbase.py,sha256=VH0vddRmkqLtcDlYPCO7hfz1_VbKo43lUdHDAbd4iJc,4198
26
26
  code_loader/utils.py,sha256=4tXLum2AT3Z1ldD6BeYScNg0ATyE4oM8cuIGQxrXyjM,3163
27
27
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- code_loader/visualizers/default_visualizers.py,sha256=Ffx5VHVOe5ujBOsjBSxN_aIEVwFSQ6gbhTMG5aUS-po,2305
29
- code_loader-1.0.86a0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
30
- code_loader-1.0.86a0.dist-info/METADATA,sha256=TPsMOP2_3KsFNE3wTtf329tFw-K2y_kEiaFDBSALuTI,851
31
- code_loader-1.0.86a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- code_loader-1.0.86a0.dist-info/RECORD,,
28
+ code_loader/visualizers/default_visualizers.py,sha256=f95WzLYO2KU8endWxrmtwjHx7diDfm8AaWjucYHT7GI,2439
29
+ code_loader-1.0.86.dev0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
30
+ code_loader-1.0.86.dev0.dist-info/METADATA,sha256=cF-s4EglKkisMEpQdK5UVTWTuMT7sO06aAPWVY0hPH4,854
31
+ code_loader-1.0.86.dev0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ code_loader-1.0.86.dev0.dist-info/RECORD,,