qubvel-hf's picture
qubvel-hf HF staff
Clean up, remove some transforms
83c2ac2
raw
history blame
743 Bytes
import albumentations as A
import inspect
from typing import Callable
FILTER_TRANSFORMS = [
A.ImageOnlyTransform,
A.DualTransform,
A.ReferenceBasedTransform,
A.TemplateTransform,
A.Lambda,
]
def is_not_supported_transform(transform_cls):
sig = inspect.signature(transform_cls)
if issubclass(transform_cls, A.ReferenceBasedTransform):
return True
for filter_transform_cls in FILTER_TRANSFORMS:
if transform_cls is filter_transform_cls:
return True
for param in sig.parameters.values():
if issubclass(type(param.annotation), type(Callable)):
return True
if param.name in ["read_fn", "reference_images"]:
return True
return False