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
}
A transformer that crops images to a certain size at the center
func CenterCrop ¶
func CenterCrop(height, width int64) *CenterCropTransformer
Create a new CenterCropTransformer with given height and width.
func (CenterCropTransformer) Forward ¶
func (t CenterCropTransformer) Forward(tensor *torch.Tensor) *torch.Tensor
Forward pass an image through the transformer to center crop it.
type ComposeTransformer ¶
type ComposeTransformer struct {
Transforms []ITransformer
}
A composition of many transformers in a sequential structure.
func Compose ¶
func Compose(transforms ...ITransformer) *ComposeTransformer
Create a new sequential pipeline of transformers.
func (ComposeTransformer) Forward ¶
func (composition ComposeTransformer) Forward(tensor *torch.Tensor) *torch.Tensor
Pass the tensor through the sequential transformation pipeline.
type FromTensorTransformer ¶
type FromTensorTransformer struct{}
A transformer that converts a torch Tensor to an image.Image.
func FromTensor ¶
func FromTensor() *FromTensorTransformer
Create a new FromTensorTransformer with given parameters.
func (FromTensorTransformer) Forward ¶
func (_ FromTensorTransformer) Forward(frame *torch.Tensor) image.Image
Forward pass a tensor through the transformer to convert it to an image.
type ITransformer ¶
type ITransformer interface {
Forward(*torch.Tensor) *torch.Tensor
}
An abstract transformer that performs operations on tensors.
type LongestMaxSizeTransformer ¶
type LongestMaxSizeTransformer struct {
// contains filtered or unexported fields
}
A transformer that resizes images to have a maximum size.
func LongestMaxSize ¶
func LongestMaxSize(size int64, interpolation F.InterpolateMode, alignCorners, antialias bool, ) *LongestMaxSizeTransformer
Create a new LongestMaxSizeTransformer with given parameters.
func (LongestMaxSizeTransformer) Forward ¶
func (t LongestMaxSizeTransformer) Forward(tensor *torch.Tensor) *torch.Tensor
Forward pass an image through to resize with longest max size.
type NormalizeTransformer ¶
type NormalizeTransformer struct {
// contains filtered or unexported fields
}
A Normalize transformer that stores channel-wise mean and standard deviation.
func Normalize ¶
func Normalize(mean, stddev []float32) *NormalizeTransformer
Create a new NormalizeTransformer with given mean and standard deviation.
func (NormalizeTransformer) Forward ¶
func (t NormalizeTransformer) Forward(input *torch.Tensor) *torch.Tensor
Forward pass an image through the transformer to map its data to N(0, 1).
type PadIfNeededTransformer ¶
type PadIfNeededTransformer struct {
// contains filtered or unexported fields
}
A transformer that pads images to a minimum size.
func PadIfNeeded ¶
func PadIfNeeded( min_height, min_width int64, mode F.PadMode, value ...float64, ) *PadIfNeededTransformer
Create a new PadIfNeededTransformer with given parameters.
func (PadIfNeededTransformer) Forward ¶
func (t PadIfNeededTransformer) Forward(tensor *torch.Tensor) *torch.Tensor
Forward pass an image through the transformer to pad it if needed.
type ResizeTransformer ¶
type ResizeTransformer struct {
// contains filtered or unexported fields
}
A transformer that resizes images to a certain size at the center
func Resize ¶
func Resize(height, width int64, interpolation F.InterpolateMode, alignCorners, antialias bool) *ResizeTransformer
Create a new ResizeTransformer with given parameters.
func (ResizeTransformer) Forward ¶
func (t ResizeTransformer) Forward(tensor *torch.Tensor) *torch.Tensor
Forward pass an image through the transformer to resize it.
type ToTensorTransformer ¶
type ToTensorTransformer struct{}
A transformer that converts an image.Image to a torch Tensor.
func ToTensor ¶
func ToTensor() *ToTensorTransformer
Create a new ToTensorTransformer with given parameters.
func (ToTensorTransformer) Forward ¶
func (_ ToTensorTransformer) Forward(frame image.Image) *torch.Tensor
Forward pass an image through the transformer to convert it to a tensor.