code-loader 1.0.91.dev10__py3-none-any.whl → 1.0.91.dev11__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/datasetclasses.py +6 -2
- code_loader/inner_leap_binder/leapbinder.py +0 -1
- code_loader/inner_leap_binder/leapbinder_decorators.py +1 -0
- code_loader/leaploader.py +3 -2
- code_loader/utils.py +6 -5
- {code_loader-1.0.91.dev10.dist-info → code_loader-1.0.91.dev11.dist-info}/METADATA +1 -1
- {code_loader-1.0.91.dev10.dist-info → code_loader-1.0.91.dev11.dist-info}/RECORD +9 -9
- {code_loader-1.0.91.dev10.dist-info → code_loader-1.0.91.dev11.dist-info}/LICENSE +0 -0
- {code_loader-1.0.91.dev10.dist-info → code_loader-1.0.91.dev11.dist-info}/WHEEL +0 -0
@@ -68,9 +68,13 @@ class PreprocessResponse:
|
|
68
68
|
assert self.sample_ids is not None
|
69
69
|
return len(self.sample_ids)
|
70
70
|
|
71
|
+
@dataclass
|
72
|
+
class ElementInstance:
|
73
|
+
name: str
|
74
|
+
mask: npt.NDArray[np.float32]
|
71
75
|
|
72
76
|
SectionCallableInterface = Callable[[Union[int, str], PreprocessResponse], npt.NDArray[np.float32]]
|
73
|
-
InstanceCallableInterface = Callable[[int, PreprocessResponse], List[
|
77
|
+
InstanceCallableInterface = Callable[[int, PreprocessResponse], List[ElementInstance]]
|
74
78
|
|
75
79
|
MetadataSectionCallableInterface = Union[
|
76
80
|
Callable[[Union[int, str], PreprocessResponse], int],
|
@@ -248,5 +252,5 @@ class DatasetSample:
|
|
248
252
|
metadata_is_none: Dict[str, bool]
|
249
253
|
index: Union[int, str]
|
250
254
|
state: DataStateEnum
|
251
|
-
instance_masks: Optional[Dict[str, List[
|
255
|
+
instance_masks: Optional[Dict[str, List[ElementInstance]]] = None
|
252
256
|
|
@@ -258,7 +258,6 @@ class LeapBinder:
|
|
258
258
|
function = to_numpy_return_masks_wrapper(function)
|
259
259
|
self.setup_container.instance_masks.append(ElementInstanceMasksHandler(name, function))
|
260
260
|
|
261
|
-
self._encoder_names.append(name)
|
262
261
|
|
263
262
|
def add_custom_loss(self, function: CustomCallableInterface, name: str) -> None:
|
264
263
|
"""
|
@@ -294,6 +294,7 @@ def tensorleap_element_instance_preprocess(instance_mask_encoder: Callable[[int,
|
|
294
294
|
|
295
295
|
leap_binder.set_preprocess(user_function_instance)
|
296
296
|
|
297
|
+
|
297
298
|
def _validate_input_args(*args, **kwargs):
|
298
299
|
assert len(args) == 0 and len(kwargs) == 0, \
|
299
300
|
(f'tensorleap_preprocess validation failed: '
|
code_loader/leaploader.py
CHANGED
@@ -14,7 +14,8 @@ import numpy.typing as npt
|
|
14
14
|
from code_loader.contract.datasetclasses import DatasetSample, DatasetBaseHandler, GroundTruthHandler, \
|
15
15
|
PreprocessResponse, VisualizerHandler, LeapData, \
|
16
16
|
PredictionTypeHandler, MetadataHandler, CustomLayerHandler, MetricHandler, VisualizerHandlerData, MetricHandlerData, \
|
17
|
-
MetricCallableReturnType, CustomLossHandlerData, CustomLossHandler, RawInputsForHeatmap, SamplePreprocessResponse
|
17
|
+
MetricCallableReturnType, CustomLossHandlerData, CustomLossHandler, RawInputsForHeatmap, SamplePreprocessResponse, \
|
18
|
+
ElementInstance
|
18
19
|
from code_loader.contract.enums import DataStateEnum, TestingSectionEnum, DataStateType, DatasetMetadataType
|
19
20
|
from code_loader.contract.exceptions import DatasetScriptException
|
20
21
|
from code_loader.contract.responsedataclasses import DatasetIntegParseResult, DatasetTestResultPayload, \
|
@@ -453,7 +454,7 @@ class LeapLoader(LeapLoaderBase):
|
|
453
454
|
def _get_inputs(self, state: DataStateEnum, sample_id: Union[int, str]) -> Dict[str, npt.NDArray[np.float32]]:
|
454
455
|
return self._get_dataset_handlers(global_leap_binder.setup_container.inputs, state, sample_id)
|
455
456
|
|
456
|
-
def _get_masks(self, state: DataStateEnum, sample_id: Union[int, str]) -> Dict[str, List[
|
457
|
+
def _get_masks(self, state: DataStateEnum, sample_id: Union[int, str]) -> Dict[str, List[ElementInstance]]:
|
457
458
|
preprocess_result = self._preprocess_result()
|
458
459
|
preprocess_state = preprocess_result[state]
|
459
460
|
result_agg = {}
|
code_loader/utils.py
CHANGED
@@ -7,7 +7,7 @@ import numpy as np
|
|
7
7
|
import numpy.typing as npt
|
8
8
|
|
9
9
|
from code_loader.contract.datasetclasses import SectionCallableInterface, PreprocessResponse, \
|
10
|
-
InstanceCallableInterface
|
10
|
+
InstanceCallableInterface, ElementInstance
|
11
11
|
|
12
12
|
|
13
13
|
def to_numpy_return_wrapper(encoder_function: SectionCallableInterface) -> SectionCallableInterface:
|
@@ -19,11 +19,12 @@ def to_numpy_return_wrapper(encoder_function: SectionCallableInterface) -> Secti
|
|
19
19
|
return numpy_encoder_function
|
20
20
|
|
21
21
|
def to_numpy_return_masks_wrapper(encoder_function: InstanceCallableInterface) -> Callable[
|
22
|
-
[Union[int, str], PreprocessResponse], List[
|
23
|
-
def numpy_encoder_function(idx: Union[int, str], samples: PreprocessResponse) -> List[
|
22
|
+
[Union[int, str], PreprocessResponse], List[ElementInstance]]:
|
23
|
+
def numpy_encoder_function(idx: Union[int, str], samples: PreprocessResponse) -> List[ElementInstance]:
|
24
24
|
result = encoder_function(idx, samples)
|
25
|
-
|
26
|
-
|
25
|
+
for res in result:
|
26
|
+
res.mask = np.array(res.mask)
|
27
|
+
return result
|
27
28
|
return numpy_encoder_function
|
28
29
|
|
29
30
|
|
@@ -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
|
4
|
+
code_loader/contract/datasetclasses.py,sha256=RWXBIPE35N5dWpgvCYPym3t7h__-9JkUJ9Kj7v8vFr0,8657
|
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/mapping.py,sha256=e11h_sprwOyE32PcqgRq9JvyahQrPzwqgkhmbQLKLQY,1165
|
@@ -20,14 +20,14 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
|
|
20
20
|
code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
|
21
21
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
22
22
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
23
|
-
code_loader/inner_leap_binder/leapbinder.py,sha256=
|
24
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
25
|
-
code_loader/leaploader.py,sha256=
|
23
|
+
code_loader/inner_leap_binder/leapbinder.py,sha256=eHnjPfJvYQDQsBM55sf63kI-NC2M-lOB4cwxjYHNTkk,32766
|
24
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=jb4UtLN8m5xRz-OpKzEOw5f6PWZjET4Ysp49vd81Wlw,28807
|
25
|
+
code_loader/leaploader.py,sha256=K532J4Z8YUjyBpTagJPff4PD0dkuwT9szgBbwBiWwwY,28846
|
26
26
|
code_loader/leaploaderbase.py,sha256=tpMVEd97675b_var4hvesjN7EgQzoCbPEayNBut6AvI,4551
|
27
|
-
code_loader/utils.py,sha256=
|
27
|
+
code_loader/utils.py,sha256=_j8b60pimoNAvWMRj7hEkkT6C76qES6cZoBFHpXHMxA,2698
|
28
28
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
code_loader/visualizers/default_visualizers.py,sha256=669lBpLISLO6my5Qcgn1FLDDeZgHumPf252m4KHY4YM,2555
|
30
|
-
code_loader-1.0.91.
|
31
|
-
code_loader-1.0.91.
|
32
|
-
code_loader-1.0.91.
|
33
|
-
code_loader-1.0.91.
|
30
|
+
code_loader-1.0.91.dev11.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
31
|
+
code_loader-1.0.91.dev11.dist-info/METADATA,sha256=qEJ9pgcAFdwKoxGPsjpHac4T9YOYiXth3MC0uJS-PSw,855
|
32
|
+
code_loader-1.0.91.dev11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
33
|
+
code_loader-1.0.91.dev11.dist-info/RECORD,,
|
File without changes
|
File without changes
|