Skip to content

WARNING

该页面尚未翻译。 以下内容为英文原版。

tensorplay.vision.transforms

Classes

class CenterCrop [source]

python
CenterCrop(size)
Methods

__init__(self, size) [source]

Initialize self. See help(type(self)) for accurate signature.


class ColorJitter [source]

python
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]

python
Compose(transforms)
Methods

__init__(self, transforms) [source]

Initialize self. See help(type(self)) for accurate signature.


class GaussianBlur [source]

python
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]

python
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]

python
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]

python
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]

python
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]

python
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]

python
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]

python
Resize(size, interpolation=2)
Methods

__init__(self, size, interpolation=2) [source]

Initialize self. See help(type(self)) for accurate signature.


class ToTensor [source]

python
ToTensor()

Convert a PIL Image or numpy.ndarray to tensor.

Functions

from_file() [source]

python
from_file(path, backend=None)

Read an image from path and return a Tensor.

from_image() [source]

python
from_image(img)

Directly create a Tensor from a PIL Image or NumPy array. Uses optimized C++ path if possible.

get_backend() [source]

python
get_backend()

Get the current image processing backend.

基于 Apache 2.0 许可发布。

📚DeepWiki