tensorplay.vision.transforms
Classes
class CenterCrop [source]
CenterCrop(size)class ColorJitter [source]
ColorJitter(brightness=0, contrast=0, saturation=0, hue=0)Randomly change the brightness, contrast, saturation and hue of an image.
Methods
__init__(self, brightness=0, contrast=0, saturation=0, hue=0) [source]
Initialize self. See help(type(self)) for accurate signature.
get_params(brightness, contrast, saturation, hue) [source]
class Compose [source]
Compose(transforms)Methods
__init__(self, transforms) [source]
Initialize self. See help(type(self)) for accurate signature.
class GaussianBlur [source]
GaussianBlur(kernel_size, sigma=(0.1, 2.0))Blurs image with randomly chosen Gaussian blur.
Methods
__init__(self, kernel_size, sigma=(0.1, 2.0)) [source]
Initialize self. See help(type(self)) for accurate signature.
class Normalize [source]
Normalize(mean, std, inplace=False)Methods
__init__(self, mean, std, inplace=False) [source]
Initialize self. See help(type(self)) for accurate signature.
class Pad [source]
Pad(padding, fill=0, padding_mode='constant')Pad the given image on all sides.
Methods
__init__(self, padding, fill=0, padding_mode='constant') [source]
Initialize self. See help(type(self)) for accurate signature.
class RandomHorizontalFlip [source]
RandomHorizontalFlip(p=0.5)Horizontally flip the given PIL Image or NumPy array randomly with a given probability.
Methods
__init__(self, p=0.5) [source]
Initialize self. See help(type(self)) for accurate signature.
class RandomResizedCrop [source]
RandomResizedCrop(size, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation=2)Crop the given PIL Image or NumPy array to random size and aspect ratio.
Methods
__init__(self, size, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation=2) [source]
Initialize self. See help(type(self)) for accurate signature.
get_params(img, scale, ratio) [source]
Get parameters for crop for a random sized crop.
class RandomRotation [source]
RandomRotation(degrees, interpolation=0, expand=False, center=None, fill=0)Rotate the image by angle.
Methods
__init__(self, degrees, interpolation=0, expand=False, center=None, fill=0) [source]
Initialize self. See help(type(self)) for accurate signature.
get_params(degrees) [source]
class RandomVerticalFlip [source]
RandomVerticalFlip(p=0.5)Vertically flip the given PIL Image or NumPy array randomly with a given probability.
Methods
__init__(self, p=0.5) [source]
Initialize self. See help(type(self)) for accurate signature.
class Resize [source]
Resize(size, interpolation=2)Methods
__init__(self, size, interpolation=2) [source]
Initialize self. See help(type(self)) for accurate signature.
class ToTensor [source]
ToTensor()Convert a PIL Image or numpy.ndarray to tensor.
Functions
from_file() [source]
from_file(path, backend=None)Read an image from path and return a Tensor.
from_image() [source]
from_image(img)Directly create a Tensor from a PIL Image or NumPy array. Uses optimized C++ path if possible.
get_backend() [source]
get_backend()Get the current image processing backend.
