Documentation ¶
Index ¶
- func Crop(tensor torch.Tensor, xmin, ymin, xmax, ymax int64) torch.Tensor
- func FromTensor(tensor torch.Tensor) image.Image
- func LongestMaxSize(tensor torch.Tensor, size int64, interpolation F.InterpolateMode, ...) torch.Tensor
- func PadIfNeeded(tensor torch.Tensor, min_height, min_width int64, mode F.PadMode, ...) torch.Tensor
- func ToTensor(frame image.Image) torch.Tensor
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 ¶
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.
Types ¶
This section is empty.