vision_transforms_functional

package
v0.0.0-...-8e0162c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crop

func Crop(tensor torch.Tensor, xmin, ymin, xmax, ymax int64) torch.Tensor

Crop a slice from a tensor with shape (..., H, W).

Bounding boxes are in (xmin,ymin,xmax,ymax) format.

The python syntax for this function would be: ```python tensor[..., ymin:ymax, xmin:ymax] ```

Note that the semantics of this function are (xmin,ymax,xmax,ymax), whereas the semantics for PyTorch torchvision is actually (ymin,xmin,height,width.) The semantics for edge cases are to clip to the bounds whereas in PyTorch the conventions are allow shifts past the window and larger bounds via zero padding.

func FromTensor

func FromTensor(tensor torch.Tensor) image.Image

Convert `torch.Tensor` to `image.Image`.

func LongestMaxSize

func LongestMaxSize(
	tensor torch.Tensor,
	size int64,
	interpolation F.InterpolateMode,
	alignCorners, antialias bool,
) torch.Tensor

Resize a tensor to have the longest size equal to `size`. If interpolation is required, e.g., if the tensor has max size less than or equal to `size`, use the given interpolation mode, corner alignment setting, and optional anti-aliasing.

func PadIfNeeded

func PadIfNeeded(
	tensor torch.Tensor,
	min_height, min_width int64,
	mode F.PadMode,
	value ...float64,
) torch.Tensor

Pad the input tensor to the given minimum height and width. If padding is necessary, use the given padding mode. When the padding mode is constant, use the given constant padding value.

func ToTensor

func ToTensor(frame image.Image) torch.Tensor

Convert `image.Image` to `torch.Tensor`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL