sleap.nn.data.general#

General purpose transformers for common pipeline processing tasks.

class sleap.nn.data.general.KeyDeviceMover(keys: List[str] = NOTHING, device_name: str = '/cpu:0')[source]#

Transformer for moving example keys to a device.

property input_keys: List[str]#

Return the keys that incoming elements are expected to have.

property output_keys: List[str]#

Return the keys that outgoing elements will have.

transform_dataset(input_ds: DatasetV2) DatasetV2[source]#

Create a dataset that contains data but moved to cpu.

class sleap.nn.data.general.KeyFilter(keep_keys: List[str] = NOTHING)[source]#

Transformer for filtering example keys.

property input_keys: List[str]#

Return the keys that incoming elements are expected to have.

property output_keys: List[str]#

Return the keys that outgoing elements will have.

transform_dataset(input_ds: DatasetV2) DatasetV2[source]#

Create a dataset that contains filtered data.

class sleap.nn.data.general.KeyRenamer(old_key_names: List[str] = NOTHING, new_key_names: List[str] = NOTHING, drop_old: bool = True)[source]#

Transformer for renaming example keys.

property input_keys: List[str]#

Return the keys that incoming elements are expected to have.

property output_keys: List[str]#

Return the keys that outgoing elements will have.

transform_dataset(input_ds: DatasetV2) DatasetV2[source]#

Create a dataset that contains filtered data.

class sleap.nn.data.general.LambdaMap(func: Callable[[Dict[str, Tensor]], Dict[str, Tensor]], input_key_names: List[str] = NOTHING, output_key_names: List[str] = NOTHING)[source]#

Transformer for mapping an arbitrary function to the dataset.

func#

A callable of the form func(example) -> example, where the input and output are each a dictionary of tensors.

Type:

Callable[[Dict[str, tensorflow.python.framework.ops.Tensor]], Dict[str, tensorflow.python.framework.ops.Tensor]]

input_key_names#

List of input key names that the function expects to find in the example.

Type:

List[str]

output_key_names#

List of output key names that the function will return.

Type:

List[str]

property input_keys: List[str]#

Return the keys that incoming elements are expected to have.

property output_keys: List[str]#

Return the keys that outgoing elements will have.

transform_dataset(input_ds: DatasetV2) DatasetV2[source]#

Create a dataset that contains transformed data.