plismbench.models.extractor module#
Core abstract method for feature extractors.
- class plismbench.models.extractor.Extractor(*args, **kwargs)[source]#
Bases:
ABCA base class for
plismbenchextractors.- property feature_extractor: Module#
Feature extractor module.
- Returns:
feature_extractor
- Return type:
torch.nn.Module
- property transform: Callable[[ndarray], Tensor]#
Transform method to apply element wise. Inputs should be numpy.ndarray.
This function is applied on
numpy.ndarrayand notPIL.Image.Imageas HuggingFace data is stored as numpy arrays for pickle checking purposes. If your model needs image resizing, then you will need to add a firsttransforms.ToPILImage()operation, then resizing and finallytransforms.ToTensor(). If your model is best working on images of shape 224x224, then no need for rescaling as PLISM tiles have 224x224 shapes.Default is identity.
- Returns:
transform
- Return type:
collections.abc.Callable[[numpy.ndarray], torch.Tensor]