set_ground_truth

code_loader.leap_binder.set_ground_truth

The leap_binder.set_ground_truth binding function points to the Ground Truth Encoder and name for reference.

code_loader.leap_binder.set_ground_truth(
    function=Callable[[int, PreprocessingResponse], np.ndarray]
    name=str
)
Args

function

name

(str) with the given name of the input, e.g. image

Examples

Basic Usage

from code_loader import leap_binder
from code_loader.contract.datasetclasses import PreprocessResponse

...
def gt_encoder(idx: int, preprocessing: Union[PreprocessResponse, list]) -> np.ndarray:
    return preprocessing.data.iloc[idx]['ground_truth'].astype('float32')

leap_binder.set_ground_truth(
    function=gt_encoder,
    gt_name='classes'
)

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