Commit 21bab854 authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): add more docs

parent d8e0a9cd
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -730,6 +730,22 @@ def create_pillow_transforms(tvalue: Union[list, dict]):
        ...     'std': [0.229, 0.224, 0.225],
        ... })
        PillowNormalize(mean=[0.485 0.456 0.406], std=[0.229 0.224 0.225])
        >>> create_pillow_transforms([
        ...     {'antialias': True,
        ...      'interpolation': 'bicubic',
        ...      'max_size': None,
        ...      'size': 384,
        ...      'type': 'resize'},
        ...     {'size': (224, 224), 'type': 'center_crop'},
        ...     {'type': 'maybe_to_tensor'},
        ...     {'mean': 0.5, 'std': 0.5, 'type': 'normalize'}
        ... ])
        PillowCompose(
            PillowResize(size=384, interpolation=bicubic, max_size=None, antialias=True)
            PillowCenterCrop(size=(224, 224))
            PillowMaybeToTensor()
            PillowNormalize(mean=[0.5], std=[0.5])
        )
    """
    if isinstance(tvalue, list):
        return PillowCompose([create_pillow_transforms(titem) for titem in tvalue])
+16 −0
Original line number Diff line number Diff line
@@ -352,6 +352,22 @@ def create_torchvision_transforms(tvalue: Union[list, dict]):
        ...     'std': [0.229, 0.224, 0.225],
        ... })
        Normalize(mean=tensor([0.4850, 0.4560, 0.4060]), std=tensor([0.2290, 0.2240, 0.2250]))
        >>> create_torchvision_transforms([
        ...     {'antialias': True,
        ...      'interpolation': 'bicubic',
        ...      'max_size': None,
        ...      'size': 384,
        ...      'type': 'resize'},
        ...     {'size': (224, 224), 'type': 'center_crop'},
        ...     {'type': 'maybe_to_tensor'},
        ...     {'mean': 0.5, 'std': 0.5, 'type': 'normalize'}
        ... ])
        Compose(
            Resize(size=384, interpolation=bicubic, max_size=None, antialias=True)
            CenterCrop(size=(224, 224))
            MaybeToTensor()
            Normalize(mean=0.5, std=0.5)
        )

    .. note::
        Currently the following transforms are supported: