Skip to content

Transforms

Reference information for the model Transforms API.

eva.models.transforms.ExtractCLSFeatures

Extracts the CLS token from a ViT model output.

Parameters:

Name Type Description Default
cls_index int

The index of the CLS token in the output tensor.

0
Source code in src/eva/core/models/transforms/extract_cls_features.py
def __init__(self, cls_index: int = 0) -> None:
    """Initializes the transformation.

    Args:
        cls_index: The index of the CLS token in the output tensor.
    """
    self._cls_index = cls_index

eva.models.transforms.ExtractPatchFeatures

Extracts the patch features from a ViT model output.

Parameters:

Name Type Description Default
ignore_remaining_dims bool

If set to True, ignore the remaining dimensions of the patch grid if it is not a square number.

False
Source code in src/eva/core/models/transforms/extract_patch_features.py
def __init__(self, ignore_remaining_dims: bool = False) -> None:
    """Initializes the transformation.

    Args:
        ignore_remaining_dims: If set to `True`, ignore the remaining dimensions
            of the patch grid if it is not a square number.
    """
    self._ignore_remaining_dims = ignore_remaining_dims