File size: 743 Bytes
83c2ac2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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