Documentation
¶
Index ¶
- func AlexNet(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func Augmentation(t ts.Tensor, flip bool, crop int64, cutout int64) (retVal ts.Tensor)
- func DenseNet121(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func DenseNet161(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func DenseNet169(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func DenseNet201(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB0(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB1(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB2(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB3(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB4(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB5(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB6(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func EfficientNetB7(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func InceptionV3(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func Load(path string) (retVal ts.Tensor, err error)
- func LoadAndResize(path string, outW int64, outH int64) (retVal ts.Tensor, err error)
- func LoadDir(dir string, outW int64, outH int64) (retVal ts.Tensor, err error)
- func MobileNetV2(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func RandomCrop(t ts.Tensor, pad int64) (retVal ts.Tensor)
- func RandomCutout(t ts.Tensor, sz int64) (retVal ts.Tensor)
- func RandomFlip(t ts.Tensor) (retVal ts.Tensor)
- func ResNet18(path nn.Path, numClasses int64) (retVal nn.FuncT)
- func ResNet18NoFinalLayer(path nn.Path) (retVal nn.FuncT)
- func ResNet34(path nn.Path, numClasses int64) (retVal nn.FuncT)
- func ResNet34NoFinalLayer(path nn.Path) (retVal nn.FuncT)
- func ResNet50(path nn.Path, numClasses int64) (retVal ts.ModuleT)
- func ResNet50NoFinalLayer(path nn.Path) (retVal ts.ModuleT)
- func ResNet101(path nn.Path, numClasses int64) (retVal ts.ModuleT)
- func ResNet101NoFinalLayer(path nn.Path) (retVal ts.ModuleT)
- func ResNet150NoFinalLayer(path nn.Path) (retVal ts.ModuleT)
- func ResNet152(path nn.Path, numClasses int64) (retVal ts.ModuleT)
- func Resize(t ts.Tensor, outW int64, outH int64) (retVal ts.Tensor, err error)
- func ResizePreserveAspectRatio(t ts.Tensor, outW int64, outH int64) (retVal ts.Tensor, err error)
- func Save(tensor ts.Tensor, path string) (err error)
- func SqueezeNetV1_0(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func SqueezeNetV1_1(p nn.Path, nclasses int64) (retVal ts.ModuleT)
- func VGG11(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG11BN(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG13(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG13BN(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG16(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG16BN(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG19(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- func VGG19BN(path nn.Path, nclasses int64) (retVal nn.SequentialT)
- type BlockArgs
- type Dataset
- type ImageNet
- func (in ImageNet) ClassCount() (retVal int64)
- func (in ImageNet) Classes() (retVal []string)
- func (in ImageNet) LoadFromDir(path string) (retVal Dataset, err error)
- func (in ImageNet) LoadImage(path string) (retVal ts.Tensor, err error)
- func (in ImageNet) LoadImageAndResize(path string, w, h int64) (retVal ts.Tensor, err error)
- func (in ImageNet) LoadImageAndResize224(path string) (retVal ts.Tensor, err error)
- func (in ImageNet) Normalize(tensor ts.Tensor) (retVal ts.Tensor, err error)
- func (in ImageNet) SaveImage(tensor ts.Tensor, path string) (err error)
- func (in ImageNet) Top(input ts.Tensor, k int64) (retVal []TopItem)
- func (in ImageNet) UnNormalize(tensor ts.Tensor) (retVal ts.Tensor, err error)
- type TopItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Augmentation ¶
func Load ¶
Load loads an image from a file.
On success returns a tensor of shape [channel, height, width].
func LoadAndResize ¶
LoadAndResize loads and resizes an image, preserve the aspect ratio by taking a center crop.
func RandomCrop ¶
Pad the image using reflections and take some random crops. This expects a 4 dimension NCHW tensor and returns a tensor with an identical shape.
func RandomCutout ¶
Applies cutout: randomly remove some square areas in the original images. https://arxiv.org/abs/1708.04552
func RandomFlip ¶
RandomFlip randomly applies horizontal flips This expects a 4 dimension NCHW tensor and returns a tensor with an identical shape.
func Resize ¶
Resize resizes an image.
This expects as input a tensor of shape [channel, height, width] and returns a tensor of shape [channel, out_h, out_w].
func ResizePreserveAspectRatio ¶
ResizePreserveAspectRatio resizes an image, preserve the aspect ratio by taking a center crop.
This expects as input a tensor of shape [channel, height, width] and returns
Types ¶
type Dataset ¶
type Dataset struct {
TrainImages ts.Tensor
TrainLabels ts.Tensor
TestImages ts.Tensor
TestLabels ts.Tensor
Labels int64
}
func LoadMNISTDir ¶
LoadMNISTDir loads all MNIST data from a given directory to Dataset
type ImageNet ¶
type ImageNet struct {
// contains filtered or unexported fields
}
func NewImageNet ¶
func NewImageNet() ImageNet
func (ImageNet) ClassCount ¶
func (ImageNet) LoadFromDir ¶
LoadFromDir loads a dataset from a directory.
NOTE: This assumes that the directory contains two subdirectories named train and val. In each of these datasets, there should be a subdirectory per class named in the same way. The ImageNet normalization is applied, image are resized to 224x224.
func (ImageNet) LoadImageAndResize ¶
LoadImageAndResize loads an image from a file and resize it to the specified width and height.
NOTE: This will apply the ImageNet normalization.
func (ImageNet) LoadImageAndResize224 ¶
LoadImageAndResize224 loads an image from a file and resize it to 224x224.
NOTE: This will apply the ImageNet normalization.
func (ImageNet) SaveImage ¶
SaveImage saves a tensor image to a path.
NOTE: This will carry out the ImageNet unnormalization.