RestrictDict

class hybrid_learning.datasets.transforms.dict_transforms.RestrictDict(selected_keys)[source]

Bases: DictTransform

Restrict the annotation dictionary to the annotation items with featuring one of the selected keys.

Public Data Attributes:

settings

Settings to reproduce the instance.

Inherited from : py: class:DictTransform

settings

Settings to reproduce the instance.

Inherited from : py: class:Transform

IDENTITY_CLASS

The identity class or classes for composition / addition.

settings

Settings to reproduce the instance.

Public Methods:

apply_to(annotations)

Restrict the annotation dict to the selected keys.

Inherited from : py: class:DictTransform

apply_to(annotations)

Restrict the annotation dict to the selected keys.

Inherited from : py: class:Transform

apply_to(annotations)

Restrict the annotation dict to the selected keys.

Special Methods:

__init__(selected_keys)

Init.

Inherited from : py: class:DictTransform

__call__(annotations)

Call method modifying a given dictionary.

Inherited from : py: class:Transform

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

__copy__()

Return a shallow copy of self using settings.

__add__(other)

Return a flat composition of self with other.

__radd__(other)

Return a flat composition of other and self.

__call__(annotations)

Call method modifying a given dictionary.


Parameters

selected_keys (Iterable[str]) –

__init__(selected_keys)[source]

Init.

Parameters

selected_keys (Iterable[str]) – see selected_keys

apply_to(annotations)[source]

Restrict the annotation dict to the selected keys. Selected keys are stored in selected_keys.

Parameters

annotations (Dict[str, Any]) –

Return type

Dict[str, Any]

selected_keys: Iterable[str]

The keys to restrict the dict to.

property settings: Dict[str, Any]

Settings to reproduce the instance.