transforms

package
v0.0.0-...-9afed2f Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CenterCropTransformer

type CenterCropTransformer struct {
	// contains filtered or unexported fields
}

CenterCropTransformer crops the center of the image into some size.

func CenterCrop

func CenterCrop(height int, width ...int) *CenterCropTransformer

CenterCrop returns the CenterCropTransformer.

func (*CenterCropTransformer) Run

func (t *CenterCropTransformer) Run(input gocv.Mat) gocv.Mat

Run execute the center crop function and returns the cropped image object.

type ComposeTransformer

type ComposeTransformer struct {
	// Transform function should implement a `Run` method that does the real computation.
	Transforms []interface{}
}

ComposeTransformer composes transforms together

func Compose

func Compose(transforms ...interface{}) *ComposeTransformer

Compose returns a ComposeTransformer

func (*ComposeTransformer) Run

func (t *ComposeTransformer) Run(inputs ...interface{}) interface{}

Run executes the transformers sequentially

type NormalizeTransformer

type NormalizeTransformer struct {
	// contains filtered or unexported fields
}

NormalizeTransformer corresponds to torchvision.transforms.html#Normalize. It implements Go interface gotorch/data.Transform.

func Normalize

func Normalize(mean []float32, stddev []float32) *NormalizeTransformer

Normalize returns normalize transformer

func (*NormalizeTransformer) Run

Run normalize the input (Tensor) of size (C, H, W) using the stats value mean, stddev.

type RandomCropTransformer

type RandomCropTransformer struct {
	// contains filtered or unexported fields
}

RandomCropTransformer randomly crops a image into some size.

func RandomCrop

func RandomCrop(height int, width ...int) *RandomCropTransformer

RandomCrop returns the RandomCropTransformer.

func (*RandomCropTransformer) Run

func (t *RandomCropTransformer) Run(input gocv.Mat) gocv.Mat

Run execute the random crop function and returns the cropped image object.

type RandomHorizontalFlipTransformer

type RandomHorizontalFlipTransformer struct {
	// contains filtered or unexported fields
}

RandomHorizontalFlipTransformer randomly flips an image.

func RandomHorizontalFlip

func RandomHorizontalFlip(p float32) *RandomHorizontalFlipTransformer

RandomHorizontalFlip returns the RandomHorizontalFlipTransformer.

func (*RandomHorizontalFlipTransformer) Run

Run execute the random flip function and returns the flipped image object.

type RandomResizedCropTransformer

type RandomResizedCropTransformer struct {
	// contains filtered or unexported fields
}

RandomResizedCropTransformer randomly crops a image into some size.

func RandomResizedCrop

func RandomResizedCrop(height int, width ...int) *RandomResizedCropTransformer

RandomResizedCrop returns the RandomResizedCropTransformer.

func RandomResizedCropD

func RandomResizedCropD(height, width int, scale0, scale1, ratio0, ratio1 float64, interpolation gocv.InterpolationFlags) *RandomResizedCropTransformer

RandomResizedCropD returns a RandomResizedCropTransformer with detailed params.

func (*RandomResizedCropTransformer) Run

Run execute the random crop function and returns the cropped image object.

type RandomVerticalFlipTransformer

type RandomVerticalFlipTransformer struct {
	// contains filtered or unexported fields
}

RandomVerticalFlipTransformer randomly flips an image.

func RandomVerticalFlip

func RandomVerticalFlip(p float32) *RandomVerticalFlipTransformer

RandomVerticalFlip returns the RandomVerticalFlipTransformer

func (*RandomVerticalFlipTransformer) Run

Run execute the random flip function and returns the flipped image object.

type ResizeTransformer

type ResizeTransformer struct {
	// contains filtered or unexported fields
}

ResizeTransformer resizes the given image.

func Resize

func Resize(height int, width ...int) *ResizeTransformer

Resize returns a ResizeTransformer.

func (*ResizeTransformer) Run

func (t *ResizeTransformer) Run(input gocv.Mat) gocv.Mat

Run execute the center crop function and returns the cropped image object.

type ToTensorTransformer

type ToTensorTransformer struct{}

ToTensorTransformer transforms an image or an interger into a Tensor. If the image is of type image.Gray, the tensor has one channle; otherwise, the tensor has three channels (RGB).

func ToTensor

func ToTensor() *ToTensorTransformer

ToTensor returns ToTensorTransformer

func (ToTensorTransformer) Run

func (t ToTensorTransformer) Run(obj interface{}) torch.Tensor

Run executes the ToTensorTransformer and returns a Tensor

type Transform

type Transform interface{}

Transform interface Note: this interface only used in wrapping C dataset

Jump to

Keyboard shortcuts

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