@tensorleap_gt_encoder
code_loader.inner_leap_binder.leapbinder_decorators.tensorleap_preprocess.tensorleap_gt_encoder
The tensorleap_gt_encoder
decorates a Ground Truth Encoder.
@tensorleap_gt_encoder(name='classes')
def gt_encoder(idx: int, preprocessing: PreprocessResponse) -> np.ndarray:
pass
Args
name
(str) The name of the ground truth, e.g. classes
Returns:
a np.ndarray gt (without a batch dimension)
Examples
Basic Usage
import numpy as np
from code_loader.contract.datasetclasses import PreprocessResponse
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_gt_encoder
...
@tensorleap_gt_encoder('classes')
def gt_encoder(idx: int, preprocessing: PreprocessResponse) -> np.ndarray:
return preprocessing.data['labels'][idx].astype('float32')
Usage within the full script can be found at Integration Script.
Guides
Full examples can be found at the Dataset Integration section of the following guides:
Last updated
Was this helpful?