Metadata Transforms

Metadata Transforms are used to alter the output of the datasets which can be certain labels, class names, or bounding box information. They only read and add the signal metadata, and do not change the signal data.

Metadata Transforms

class torchsig.transforms.metadata_transforms.MetadataTransform(required_metadata: list[str] = [], **kwargs)[source]

Bases: Transform

Base class for metadata transforms.

This class defines the basic structure of a metadata transform, which includes: - The ability to validate metadata before applying the transform. - A method for applying the transform on signal metadata. - A callable interface to apply the transform to a list of signal metadata.

required_metadata

List of metadata fields required for applying the target transform.

__validate(metadata)

Validates the signal metadata before applying the transform.

__apply(metadata)

Applies the target transform to the metadata. Should be overridden by subclasses.

__call__(signal)[source]

Applies the transform to a list of signal metadata dictionaries.

__str__()

Returns the string representation of the transform.

__repr__()[source]

Returns a detailed string representation of the transform object.

class torchsig.transforms.metadata_transforms.YOLOLabel(**kwargs)[source]

Bases: MetadataTransform

Adds a YOLO_label to a signal.

This transform adds a YOLO_label to a signal in the form of a list of tuples (cid, cx, cy, width, height).

required_metadata

List of metadata fields required for applying the transform.

targets_metadata

List of metadata fields that will be added by the transform.