code-loader 1.0.21__py3-none-any.whl → 1.0.23__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.
@@ -122,6 +122,7 @@ class MetadataHandler:
122
122
  class PredictionTypeHandler:
123
123
  name: str
124
124
  labels: List[str]
125
+ channel_dim: int
125
126
 
126
127
 
127
128
  @dataclass
@@ -62,6 +62,7 @@ class CustomLayerInstance:
62
62
  class PredictionTypeInstance:
63
63
  name: str
64
64
  labels: List[str]
65
+ channel_dim: int
65
66
 
66
67
 
67
68
  @dataclass
@@ -3,7 +3,6 @@ from typing import Callable, List, Optional, Dict, Any, Type, Union
3
3
 
4
4
  import numpy as np
5
5
  import numpy.typing as npt
6
- from typeguard import typechecked
7
6
 
8
7
  from code_loader.contract.datasetclasses import SectionCallableInterface, InputHandler, \
9
8
  GroundTruthHandler, MetadataHandler, DatasetIntegrationSetup, VisualizerHandler, PreprocessResponse, \
@@ -45,7 +44,6 @@ class LeapBinder:
45
44
  self.set_visualizer(function=default_text_mask_visualizer, name=DefaultVisualizer.TextMask.value,
46
45
  visualizer_type=LeapDataType.TextMask)
47
46
 
48
- @typechecked
49
47
  def set_visualizer(self, function: VisualizerCallableInterface,
50
48
  name: str,
51
49
  visualizer_type: LeapDataType,
@@ -85,27 +83,22 @@ class LeapBinder:
85
83
  VisualizerHandler(name, function, visualizer_type, arg_names, heatmap_visualizer))
86
84
  self._visualizer_names.append(name)
87
85
 
88
- @typechecked
89
86
  def set_preprocess(self, function: Callable[[], List[PreprocessResponse]]) -> None:
90
87
  self.setup_container.preprocess = PreprocessHandler(function)
91
88
 
92
- @typechecked
93
89
  def set_unlabeled_data_preprocess(self, function: Callable[[], PreprocessResponse]) -> None:
94
90
  self.setup_container.unlabeled_data_preprocess = UnlabeledDataPreprocessHandler(function)
95
91
 
96
- @typechecked
97
92
  def set_input(self, function: SectionCallableInterface, name: str) -> None:
98
93
  function = to_numpy_return_wrapper(function)
99
94
  self.setup_container.inputs.append(InputHandler(name, function))
100
95
 
101
96
  self._encoder_names.append(name)
102
97
 
103
- @typechecked
104
98
  def add_custom_loss(self, function: CustomCallableInterface, name: str) -> None:
105
99
  arg_names = inspect.getfullargspec(function)[0]
106
100
  self.setup_container.custom_loss_handlers.append(CustomLossHandler(name, function, arg_names))
107
101
 
108
- @typechecked
109
102
  def add_custom_metric(self,
110
103
  function: Union[CustomCallableInterfaceMultiArgs,
111
104
  CustomMultipleReturnCallableInterfaceMultiArgs,
@@ -114,22 +107,18 @@ class LeapBinder:
114
107
  arg_names = inspect.getfullargspec(function)[0]
115
108
  self.setup_container.metrics.append(MetricHandler(name, function, arg_names))
116
109
 
117
- @typechecked
118
- def add_prediction(self, name: str, labels: List[str]) -> None:
119
- self.setup_container.prediction_types.append(PredictionTypeHandler(name, labels))
110
+ def add_prediction(self, name: str, labels: List[str], channel_dim=-1) -> None:
111
+ self.setup_container.prediction_types.append(PredictionTypeHandler(name, labels, channel_dim))
120
112
 
121
- @typechecked
122
113
  def set_ground_truth(self, function: SectionCallableInterface, name: str) -> None:
123
114
  function = to_numpy_return_wrapper(function)
124
115
  self.setup_container.ground_truths.append(GroundTruthHandler(name, function))
125
116
 
126
117
  self._encoder_names.append(name)
127
118
 
128
- @typechecked
129
119
  def set_metadata(self, function: MetadataSectionCallableInterface, name: str) -> None:
130
120
  self.setup_container.metadata.append(MetadataHandler(name, function))
131
121
 
132
- @typechecked
133
122
  def set_custom_layer(self, custom_layer: Type[Any], name: str, inspect_layer: bool = False,
134
123
  kernel_index: Optional[int] = None) -> None:
135
124
  if inspect_layer and kernel_index is not None:
code_loader/leaploader.py CHANGED
@@ -256,7 +256,8 @@ class LeapLoader:
256
256
 
257
257
  prediction_types = []
258
258
  for prediction_type in setup.prediction_types:
259
- pred_type_inst = PredictionTypeInstance(prediction_type.name, prediction_type.labels)
259
+ pred_type_inst = PredictionTypeInstance(prediction_type.name, prediction_type.labels,
260
+ prediction_type.channel_dim)
260
261
  prediction_types.append(pred_type_inst)
261
262
 
262
263
  metrics = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.21
3
+ Version: 1.0.23
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Requires-Dist: numpy (>=1.22.3,<2.0.0)
17
17
  Requires-Dist: psutil (>=5.9.5,<6.0.0)
18
- Requires-Dist: typeguard (>=4.1.5,<5.0.0)
19
18
  Project-URL: Repository, https://github.com/tensorleap/code-loader
20
19
  Description-Content-Type: text/markdown
21
20
 
@@ -1,18 +1,18 @@
1
1
  LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
2
2
  code_loader/__init__.py,sha256=V3DEXSN6Ie6PlGeSAbzjp9ufRj0XPJLpD7pDLLYxk6M,122
3
3
  code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- code_loader/contract/datasetclasses.py,sha256=h02sNsg4p-ypf5Dh00lIe1D3Bw1tnVMbKs2yO8X-2Vg,4433
4
+ code_loader/contract/datasetclasses.py,sha256=xuPrL3cKZ-tNBMQ5FsSh7oI8U6ITA_QPI57LN2T8aF8,4454
5
5
  code_loader/contract/enums.py,sha256=KDIeNl79e8rCp4ybJat7U03j50McrcBTWUxko5SXrug,1481
6
6
  code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F4RiyQ,51
7
- code_loader/contract/responsedataclasses.py,sha256=thIxKSx3mwoKHYICULGaeh2-S56L1xBlmDThCE11yT4,2658
7
+ code_loader/contract/responsedataclasses.py,sha256=0bo4iLbfu6-3tpgzeKakIH2i_1jtR8BiLdupa1TVT0o,2679
8
8
  code_loader/contract/visualizer_classes.py,sha256=1FjVO744J_EMuJfHWXGdvSz6vl3Vu7iS3CDfs8MzEEQ,5138
9
9
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
10
- code_loader/inner_leap_binder/leapbinder.py,sha256=oFpWLket1zqdvhJ1wWsERCtIkADQUPsDL26AuUfzSLI,12708
11
- code_loader/leaploader.py,sha256=eyCxajK7hdkFQHRhmXUjppT1BJ4dRcTRmGXxeHiaZKQ,15322
10
+ code_loader/inner_leap_binder/leapbinder.py,sha256=C3276VCZaeOQ4WZnSB0aB9N3o_HqZgq-NXjViieJR10,12533
11
+ code_loader/leaploader.py,sha256=XUziFXq89AFbqUoWnlh5sYkoGA8jqUziORcOQA6W0GQ,15403
12
12
  code_loader/utils.py,sha256=lluWgGpG7sYB-o9Wk9vZlm4uQqb7qbPZBa_qnSe0BkU,1933
13
13
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  code_loader/visualizers/default_visualizers.py,sha256=HqWx2qfTrroGl2n8Fpmr_4X-rk7tE2oGapjO3gzz4WY,2226
15
- code_loader-1.0.21.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
16
- code_loader-1.0.21.dist-info/METADATA,sha256=96ga8rPCjW1oriXIBhqn53oxOAvVFawNHr7Xpa0Mgvo,810
17
- code_loader-1.0.21.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
18
- code_loader-1.0.21.dist-info/RECORD,,
15
+ code_loader-1.0.23.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
16
+ code_loader-1.0.23.dist-info/METADATA,sha256=wMwTiGzMTNC6jcLy2AKsv4etK70592Uhscajkr2zGic,768
17
+ code_loader-1.0.23.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
18
+ code_loader-1.0.23.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.7.0
2
+ Generator: poetry-core 1.8.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any