Documentation
¶
Index ¶
- func CompareJPEG(path1, path2 string, threshold float64) bool
- func CompareTIFF(path1, path2 string, threshold float64) bool
- func Equal3Dim(e1, e2, e3, i1, i2, i3 int) bool
- func EqualVolDim(v1, v2 Volume) bool
- func Odd3Dim(i1, i2, i3 int) bool
- func Round(val float64, places int) (newVal float64)
- func SaveVolumeToJPEG(path string, vol Volume)
- func SaveVolumeToTIFF(path string, vol Volume)
- func SigmoidFast(x float64) float64
- func VolumeToImage(vol Volume) image.Image
- type ConvLayer
- type D3Volume
- func (vol *D3Volume) Apply(kern Kernel, strideR, strideC int)
- func (vol *D3Volume) Collumns() int
- func (vol *D3Volume) Depth() int
- func (vol *D3Volume) Elems() int
- func (vol *D3Volume) EqualSize(a Volume) bool
- func (vol *D3Volume) Equals(in Volume) bool
- func (vol *D3Volume) GetAt(r, c, d int) float64
- func (vol D3Volume) Max() float64
- func (vol D3Volume) Min() float64
- func (vol *D3Volume) MulElem(v1 Volume)
- func (vol *D3Volume) Norm(max float64)
- func (vol *D3Volume) PointReflect()
- func (vol *D3Volume) Print()
- func (vol *D3Volume) Reflect()
- func (vol *D3Volume) Rows() int
- func (vol *D3Volume) SetAll(v Volume)
- func (vol *D3Volume) SetAt(r, c, d int, val float64)
- func (vol *D3Volume) Shape() (int, int, int)
- func (vol *D3Volume) SimilarTo(in Volume, threshold float64) bool
- func (vol *D3Volume) SubVolume(tR, tC, r, c int) Volume
- func (vol D3Volume) SubVolumePadded(cR, cC, r, c int) Volume
- type FCLayer
- type InputLayer
- type Kernel
- type Layer
- type LayerFields
- type Net
- type NormLayer
- type PoolLayer
- type ReluLayer
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareJPEG ¶
CompareJPEG compares two JPEGs pixel-wise. A threshold (0-255) is specified. 0 means the two images are identical
func CompareTIFF ¶
CompareTIFF compares two TIFFs pixel-wise. A threshold (0-255) is specified. 0 means the two images are identical
func EqualVolDim ¶
EqualVolDim checks if two given volumes have the same dimensions
func SaveVolumeToJPEG ¶
SaveVolumeToJPEG saves a volume to a given JPEG-file
func SaveVolumeToTIFF ¶
SaveVolumeToTIFF saves a volume to a given TIFF-file
func SigmoidFast ¶
SigmoidFast calcultes the value for activation using a fast sigmoid approximation
func VolumeToImage ¶
VolumeToImage converts a volume to a image. Values are rounded to 2 decimal palaces
Types ¶
type ConvLayer ¶
type ConvLayer struct { LayerFields // contains filtered or unexported fields }
ConvLayer basic type for a convolutional layer The layer will compute the output of neurons that are connected to local regions in the input, each computing a dot product between their weights and a small region they are connected to in the input volume. This may result in volume such as [32x32x12] if we decided to use 12 filters.
type D3Volume ¶
D3Volume implements Volume
func NewWithData ¶
NewWithData generates a D3Volume of fixed size filled with custom data
func (*D3Volume) Apply ¶
Apply applys the given kernel to the whole volume, returnung a D3Volume with 1 depth
func (*D3Volume) PointReflect ¶
func (vol *D3Volume) PointReflect()
PointReflect calculates the pointreflection of a volume
func (*D3Volume) Print ¶
func (vol *D3Volume) Print()
Print prints the D3Volume to the console in a pretty format
func (*D3Volume) Reflect ¶
func (vol *D3Volume) Reflect()
Reflect calculates the reflectio of a volume (left-right)
func (*D3Volume) SubVolume ¶
SubVolume returns a part of the original D3Volume. tR and tC determine the center of copying, r and c the size of the subvolume. If the size exceeds the underlying volume the an error will be thrown, padding is not allowed.
func (D3Volume) SubVolumePadded ¶
SubVolumePadded returns a part of the original D3Volume. cR and cC determine the center of copying, r and c the size of the subvolume. If the size exceeds the underlying volume the submodule is filled(padded with Zeros.
type FCLayer ¶
type FCLayer struct {
LayerFields
}
FCLayer (i.e. fully-connected) layer will compute the class scores, resulting in volume of size [1x1x10], where each of the 10 numbers correspond to a class score, such as among the 10 categories of CIFAR-10. As with ordinary Neural Networks and as the name implies, each neuron in this layer will be connected to all the numbers in the previous volume.
type InputLayer ¶
type InputLayer struct {
LayerFields
}
InputLayer [32x32x3] will hold the raw pixel values of the image, in this case an image of width 32, height 32, and with three color channels R,G,B.
func (*InputLayer) Calculate ¶
func (lay *InputLayer) Calculate()
Calculate method fir inputlaters, sets the ouput to input
type Kernel ¶
type Kernel struct {
Volume
}
Kernel represets a basic conv kernel
func NewKernelFilled ¶
NewKernelFilled creates a new kernel initialized with random values
func NewKernelRandom ¶
NewKernelRandom creates a new kernel initialized with random values
func (Kernel) Apply ¶
Apply applys the kernel to a equally sized chunk of a volume Only kernels of the same size as the volume can be applied
type LayerFields ¶
type LayerFields struct {
// contains filtered or unexported fields
}
LayerFields basic data fields every layertype should have
func (*LayerFields) Input ¶
func (lf *LayerFields) Input(vol Volume)
Input is the Default method for Setting the input of a layer
func (*LayerFields) Output ¶
func (lf *LayerFields) Output() Volume
Output is the default method for retrieving the output of a layer
type NormLayer ¶
type NormLayer struct { LayerFields NormVal float64 }
NormLayer is a normalisation layer
type PoolLayer ¶
type PoolLayer struct { LayerFields SizeR int SizeC int StrideR int StrideC int }
PoolLayer will perform a downsampling operation along the spatial dimensions (width, height), resulting in volume such as [16x16x12].
type ReluLayer ¶
type ReluLayer struct {
LayerFields
}
ReluLayer will apply an elementwise activation function, such as the max(0,x)max(0,x) thresholding at zero. This leaves the size of the volume unchanged ([32x32x12]).
type Volume ¶
type Volume interface { //New() Volume //NewFull() Volume //NewRand() Volume Apply(Kernel, int, int) Collumns() int Depth() int Elems() int EqualSize(Volume) bool Equals(Volume) bool GetAt(int, int, int) float64 Max() float64 Min() float64 MulElem(Volume) Norm(float64) PointReflect() Print() Reflect() Rows() int SetAll(Volume) SetAt(int, int, int, float64) Shape() (int, int, int) SimilarTo(Volume, float64) bool SubVolume(int, int, int, int) Volume SubVolumePadded(int, int, int, int) Volume }
Volume is a basic type to hold the layer's info
func ImageToVolume ¶
ImageToVolume creates a volume from a image.Image
func VolumeFromJPEG ¶
VolumeFromJPEG creates a volume from a given file
func VolumeFromTIFF ¶
VolumeFromTIFF creates a volume from a given file