edu.hitsz.c102c.cnn
Class Layer
- java.lang.Object
-
- edu.hitsz.c102c.cnn.Layer
-
- All Implemented Interfaces:
- java.io.Serializable
public class Layer extends java.lang.Object implements java.io.SerializableCNN network layer.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classLayer.SizeGet sample size, only sampling layer has scaleSize, other layers are not null.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static LayerbuildConvLayer(int outMapNum, Layer.Size kernelSize)Build convolution layer.static LayerbuildInputLayer(Layer.Size mapSize)Build impot layer.static LayerbuildOutputLayer(int classNum)Construct the output layer, the number of categories, determine the number of output units according to the number of categories.static LayerbuildSampLayer(Layer.Size scaleSize)Build sampling layer.doublegetBias(int mapNo)Get Bias.intgetClassNum()Get type.double[][]getError(int mapNo)Get the mapNo map of the residual.double[][]getError(int recordId, int mapNo)Get the residual of mapNo in the recordId record.double[][][][]getErrors()Get all the residuals (each record and each map).double[][][][]getKernel()Get kernel.double[][]getKernel(int i, int j)Get the convolution kernel of the previous layer i map to the current layer j map.Layer.SizegetKernelSize()Get the size of the convolution kernel, only the kernel layer has kernelSize, and all other layers are null.double[][]getMap(int index)Get the index map matrix.double[][]getMap(int recordId, int mapNo)Set map.double[][][][]getMaps()»ñÈ¡batch¸÷¸ömap¾ØÕóLayer.SizegetMapSize()Get map size.intgetOutMapNum()Get number of maps.Layer.SizegetScaleSize()Get sample size, only sampling layer has scaleSize, other layers are not null.edu.hitsz.c102c.cnn.Layer.LayerTypegetType()Get type.voidinitBias(int frontMapNum)³õʼ»¯Æ«ÖÃvoidinitErros(int batchSize)Initiazlie errors.voidinitKernel(int frontMapNum)Subtract the size size and append a value append to x and y respectively.voidinitOutmaps(int batchSize)³õʼ»¯Êä³ömapvoidinitOutputKerkel(int frontMapNum, Layer.Size size)Randomly initialize the convolution kernel.static voidprepareForNewBatch()Prepare for the next batch of training·static voidprepareForNewRecord()Prepare the next recorded workout.voidsetBias(int mapNo, double value)Set bias.voidsetError(int mapNo, double[][] matrix)voidsetError(int mapNo, int mapX, int mapY, double value)voidsetKernel(int lastMapNo, int mapNo, double[][] kernel)voidsetMapSize(Layer.Size mapSize)Set map size.voidsetMapValue(int mapNo, double[][] outMatrix)ÒÔ¾ØÕóÐÎʽÉèÖõÚmapNo¸ömapµÄÖµvoidsetMapValue(int mapNo, int mapX, int mapY, double value)ÉèÖÃmapÖµvoidsetOutMapNum(int outMapNum)ÉèÖÃÊä³ömapµÄ¸öÊý
-
-
-
Method Detail
-
prepareForNewBatch
public static void prepareForNewBatch()
Prepare for the next batch of training·
-
prepareForNewRecord
public static void prepareForNewRecord()
Prepare the next recorded workout.
-
buildInputLayer
public static Layer buildInputLayer(Layer.Size mapSize)
Build impot layer.- Parameters:
mapSize-- Returns:
-
buildConvLayer
public static Layer buildConvLayer(int outMapNum, Layer.Size kernelSize)
Build convolution layer.- Returns:
-
buildSampLayer
public static Layer buildSampLayer(Layer.Size scaleSize)
Build sampling layer.- Parameters:
scaleSize-- Returns:
-
buildOutputLayer
public static Layer buildOutputLayer(int classNum)
Construct the output layer, the number of categories, determine the number of output units according to the number of categories.- Returns:
-
getMapSize
public Layer.Size getMapSize()
Get map size.- Returns:
-
setMapSize
public void setMapSize(Layer.Size mapSize)
Set map size.- Parameters:
mapSize-
-
getType
public edu.hitsz.c102c.cnn.Layer.LayerType getType()
Get type.- Returns:
-
getOutMapNum
public int getOutMapNum()
Get number of maps.- Returns:
-
setOutMapNum
public void setOutMapNum(int outMapNum)
ÉèÖÃÊä³ömapµÄ¸öÊý- Parameters:
outMapNum-
-
getKernelSize
public Layer.Size getKernelSize()
Get the size of the convolution kernel, only the kernel layer has kernelSize, and all other layers are null.- Returns:
-
getScaleSize
public Layer.Size getScaleSize()
Get sample size, only sampling layer has scaleSize, other layers are not null.- Returns:
-
initKernel
public void initKernel(int frontMapNum)
Subtract the size size and append a value append to x and y respectively.- Parameters:
frontMapNum-
-
initOutputKerkel
public void initOutputKerkel(int frontMapNum, Layer.Size size)Randomly initialize the convolution kernel.- Parameters:
frontMapNum-size-
-
initBias
public void initBias(int frontMapNum)
³õʼ»¯Æ«ÖÃ- Parameters:
frontMapNum-
-
initOutmaps
public void initOutmaps(int batchSize)
³õʼ»¯Êä³ömap- Parameters:
batchSize-
-
setMapValue
public void setMapValue(int mapNo, int mapX, int mapY, double value)ÉèÖÃmapÖµ- Parameters:
mapNo- µÚ¼¸¸ömapmapX- mapµÄ¸ßmapY- mapµÄ¿ívalue-
-
setMapValue
public void setMapValue(int mapNo, double[][] outMatrix)ÒÔ¾ØÕóÐÎʽÉèÖõÚmapNo¸ömapµÄÖµ- Parameters:
mapNo-outMatrix-
-
getMap
public double[][] getMap(int index)
Get the index map matrix. In performance considerations, no duplicate objects are returned, but the reference is returned directly, and the caller must be careful. Avoid modifying outmaps. If you need to modify, please call setMapValue(...)- Parameters:
index-- Returns:
-
getKernel
public double[][] getKernel(int i, int j)Get the convolution kernel of the previous layer i map to the current layer j map.- Parameters:
i- ÉÏÒ»²ãµÄmapϱêj- µ±Ç°²ãµÄmapϱê- Returns:
-
setError
public void setError(int mapNo, int mapX, int mapY, double value)- Parameters:
mapNo-mapX-mapY-value-
-
setError
public void setError(int mapNo, double[][] matrix)- Parameters:
mapNo-matrix-
-
getError
public double[][] getError(int mapNo)
Get the mapNo map of the residual. Does not return a copy of the object, but directly returns a reference, call the cautious, Avoid modifying errors. If you need to modify, please call setError(...)- Parameters:
mapNo-- Returns:
-
getErrors
public double[][][][] getErrors()
Get all the residuals (each record and each map).- Returns:
-
initErros
public void initErros(int batchSize)
Initiazlie errors.- Parameters:
batchSize-
-
setKernel
public void setKernel(int lastMapNo, int mapNo, double[][] kernel)- Parameters:
lastMapNo-mapNo-kernel-
-
getBias
public double getBias(int mapNo)
Get Bias.- Parameters:
mapNo-- Returns:
-
setBias
public void setBias(int mapNo, double value)Set bias.- Parameters:
mapNo-value-
-
getMaps
public double[][][][] getMaps()
»ñÈ¡batch¸÷¸ömap¾ØÕó- Returns:
-
getError
public double[][] getError(int recordId, int mapNo)Get the residual of mapNo in the recordId record.- Parameters:
recordId-mapNo-- Returns:
-
getMap
public double[][] getMap(int recordId, int mapNo)Set map.- Parameters:
recordId-mapNo-- Returns:
-
getClassNum
public int getClassNum()
Get type.- Returns:
-
getKernel
public double[][][][] getKernel()
Get kernel.- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG