set_metadata

code_loader.leap_binder.set_ground_truth

The leap_binder.set_metadata binding function points to Metadata Function. In addition, it defines the metadata_type and name for reference.

code_loader.leap_binder.set_metadata(
    function=MetadataSectionCallableInterface,
    metadata_type=DatasetMetadataType,
    name=str
)
Args

function

metadata_type

  • For a float ground truth, use DatasetMetadataType.float

  • For a string ground truth, use DatasetMetadataType.string

  • For a int ground truth, use DatasetMetadataType.int

  • For a boolean ground truth, use DatasetMetadataType.boolean

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 metadata_label(idx: int, subset: Union[PreprocessResponse, list]) -> str:
    return subset.data.iloc[idx]['label']

leap_binder.set_metadata(
    function=metadata_label,
    metadata_type=DatasetMetadataType.str, 
    name='label'
)

Usage within the full script can be found at Dataset Script.

Guides

Full examples can be found at the Dataset Integration section of the following guides:

Last updated