TIML
|
Convolutional neural network. More...
Data Structures | |
struct | timlCNNPoolingParams |
struct | timlCNNLinearParams |
struct | timlCNNDataSet |
struct | timlCNNConvParams |
struct | timlCNNNonlinearParams |
struct | timlCNNNormParams |
struct | timlCNNInputParams |
struct | timlCNNDropoutParams |
struct | _timlCNNLayer_ |
struct | timlCNNTrainingParams |
struct | _timlConvNeuralNetwork_ |
Macros | |
#define | ERROR_CNN_OFFSET 4000 |
Typedefs | |
typedef struct _timlCNNLayer_ | timlCNNLayer |
typedef struct _timlConvNeuralNetwork_ | timlConvNeuralNetwork |
Functions | |
int | timlCNNInputShareParams (timlConvNeuralNetwork *cnn, timlCNNLayer *layer) |
Share the mean with other input layer. More... | |
int | timlCNNConvShareParams (timlConvNeuralNetwork *cnnShare, timlCNNLayer *layer) |
Share the parameters with other conv layer. More... | |
int | timlCNNLinearShareParams (timlConvNeuralNetwork *cnnShare, timlCNNLayer *layer) |
Share the parameters with other linear layer. More... | |
int | timlCNNConvInitialize (timlCNNLayer *layer) |
Initialize the conv layer. More... | |
int | timlCNNLinearInitialize (timlCNNLayer *layer) |
Initialize the linear layer. More... | |
int | timlCNNNonlinearInitialize (timlCNNLayer *layer) |
Initialize the nonlinear layer. More... | |
int | timlCNNInputInitialize (timlCNNLayer *layer) |
Initialize the input layer. More... | |
int | timlCNNPoolingInitialize (timlCNNLayer *layer) |
Initialize the pooling layer. More... | |
int | timlCNNNormInitialize (timlCNNLayer *layer) |
Initialize the norm layer. More... | |
int | timlCNNDropoutInitialize (timlCNNLayer *layer) |
Initialize the dropout layer. More... | |
int | timlCNNBackPropagation (timlConvNeuralNetwork *cnn, timlCNNLayer *layer) |
Back propagate the gradient from layer to the first layer of the cnn. More... | |
int | timlCNNConvBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the conv layer to the previous layer. More... | |
int | timlCNNNormBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the norm layer to the previous layer. More... | |
int | timlCNNPoolingBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the pooling layer to the previous layer. More... | |
int | timlCNNMaxPoolingBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the max pooling layer to the previous layer. More... | |
int | timlCNNMeanPoolingBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the mean pooling layer to the previous layer. More... | |
int | timlCNNNonlinearBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the nonlinear layer to the previous layer. More... | |
int | timlCNNLinearBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the linear layer to the previous layer. More... | |
int | timlCNNDropoutBackPropagation (timlCNNLayer *layer) |
Back propagate the gradient from the dropout layer to the previous layer. More... | |
int | timlCNNCostWithLabel (timlConvNeuralNetwork *cnn, int label, float *cost, timlCNNLayer **bpStartLayer) |
Calculate the cost based on the cnn output and the label. More... | |
int | timlCNNForwardPropagation (timlConvNeuralNetwork *cnn, float *data, int dim) |
Forward propagate data to the CNN. More... | |
int | timlCNNInputForwardPropagation (timlCNNLayer *layer, float *data, int dim) |
Forward propagate data to the the input layer. More... | |
int | timlCNNLinearForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNDropoutForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNNonlinearForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNNormForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNPoolingForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNMaxPoolingForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNMeanPoolingForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNConvForwardPropagation (timlCNNLayer *prevLayer) |
Forward propagate form layer to layer->next. More... | |
int | timlCNNDeleteConvLayer (timlCNNLayer *layer) |
Delete conv layer. More... | |
int | timlCNNDeleteInputLayer (timlCNNLayer *layer) |
Delete input layer. More... | |
int | timlCNNDeleteNonlinearLayer (timlCNNLayer *layer) |
Delete nonlinear layer. More... | |
int | timlCNNDeleteNormLayer (timlCNNLayer *layer) |
Delete norm layer. More... | |
int | timlCNNDeletePoolingLayer (timlCNNLayer *layer) |
Delete pooling layer. More... | |
int | timlCNNDeleteLinearLayer (timlCNNLayer *layer) |
Delete linear layer. More... | |
int | timlCNNDeleteDropoutLayer (timlCNNLayer *layer) |
Delete dropout layer. More... | |
int | timlCNNResetConvLayer (timlCNNLayer *layer) |
Reset conv layer. More... | |
int | timlCNNResetInputLayer (timlCNNLayer *layer) |
Reset input layer. More... | |
int | timlCNNResetLinearLayer (timlCNNLayer *layer) |
Reset linear layer. More... | |
int | timlCNNResetNonlinearLayer (timlCNNLayer *layer) |
Reset nonlinear layer. More... | |
int | timlCNNResetNormLayer (timlCNNLayer *layer) |
Reset norm layer. More... | |
int | timlCNNResetPoolingLayer (timlCNNLayer *layer) |
Reset pooling layer. More... | |
int | timlCNNUpdateParams (timlConvNeuralNetwork *cnn) |
Update the parameters of the cnn. More... | |
int | timlCNNLinearUpdateParams (timlCNNLayer *layer) |
Update the parameters of the linear layer. More... | |
int | timlCNNConvUpdateParams (timlCNNLayer *layer) |
Update the parameters of the conv layer. More... | |
int | timlCNNConvWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the conv layer to file(s) More... | |
int | timlCNNNonlinearWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the nonlinear layer to file(s) More... | |
int | timlCNNNormWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the norm layer to file(s) More... | |
int | timlCNNPoolingWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the pooling layer to file(s) More... | |
int | timlCNNLinearWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the linear layer to file(s) More... | |
int | timlCNNInputWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the input layer to file(s) More... | |
int | timlCNNTrainingParamsWriteToFile (FILE *fp, timlConvNeuralNetwork *cnn, const char *name, const char *floatFormat, const char *intFormat) |
Write the training params to file(s) More... | |
int | timlCNNDropoutWriteToFile (FILE *fp1, FILE *fp2, FILE *fp3, timlCNNLayer *layer, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the dropout layer to file(s) More... | |
int | timlCNNConvReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the conv layer from a Matlab compatible text file. More... | |
int | timlCNNTrainingParamsReadFromTextFile (FILE *fp, timlConvNeuralNetwork *cnn) |
Read the training params from a text file. More... | |
int | timlCNNNormReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the nonlinear layer from a text file. More... | |
int | timlCNNPoolingReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the pooling layer from a text file. More... | |
int | timlCNNNonlinearReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the nonlinear layer from a text file. More... | |
int | timlCNNLinearReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the linear layer from a text file. More... | |
int | timlCNNDropoutReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the dropout layer from a text file. More... | |
int | timlCNNInputReadFromTextFile (FILE *fp1, timlConvNeuralNetwork *cnn) |
Read the input layer from a Matlab compatible text file. More... | |
int | timlCNNConvReadFromBinaryFile (FILE *fp2, FILE *fp3, timlCNNLayer *layer) |
Read the conv layer parameters from binary files. More... | |
int | timlCNNLinearReadFromBinaryFile (FILE *fp2, FILE *fp3, timlCNNLayer *layer) |
Read the linear layer parameters from binary files. More... | |
int | timlCNNInputReadFromBinaryFile (FILE *fp2, FILE *fp3, timlCNNLayer *layer) |
Read the input layer parameters from binary files. More... | |
int | timlCNNAssignDevice (timlConvNeuralNetwork *cnn, int deviceId, int threadId) |
Assign the cnn to a specific device and thread. More... | |
const char * | timlCNNLayerTypeStr (timlCNNLayer *layer) |
Return a string that represents the layer type. More... | |
int | timlCNNMemPoolSize (timlConvNeuralNetwork *cnn) |
Return the memory pool size (byte) More... | |
int | timlCNNSupervisedTrainingWithLabelBatchModeOpenMP (timlConvNeuralNetwork *cnn, float *data, int *label, int dim, int num) |
supervised training with label using openmp More... | |
int | timlCNNClassifyTopNBatchModeOpenMP (timlConvNeuralNetwork *cnn, float *data, int dim, int num, int *label, float *percent, int topN) |
Batch classification using openmp. More... | |
int | timlCNNClassifyTopNTeamModeOpenMP (timlConvNeuralNetwork **cnnTeam, int num, float *data, int dim, int *label, float *percent, int topN) |
Batch classification using openmp. More... | |
int | timlCNNAddConvLayer (timlConvNeuralNetwork *cnn, int kernelRow, int kernelCol, int strideX, int strideY, int featureMapChannel, timlCNNConvParams params) |
Add conv layer. More... | |
int | timlCNNAddDropoutLayer (timlConvNeuralNetwork *cnn, float prob) |
Add dropout layer. More... | |
int | timlCNNAddInputLayer (timlConvNeuralNetwork *cnn, int featureMapRow, int featureMapCol, int featureMapChannel, timlCNNInputParams params) |
Add input layer. More... | |
int | timlCNNAddLinearLayer (timlConvNeuralNetwork *cnn, int dim, timlCNNLinearParams params) |
Add linear layer. More... | |
int | timlCNNAddNonlinearLayer (timlConvNeuralNetwork *cnn, timlUtilActivationType type) |
Add nonlinear layer. More... | |
int | timlCNNAddNormLayer (timlConvNeuralNetwork *cnn, timlCNNNormParams params) |
Add normalization layer. More... | |
int | timlCNNAddPoolingLayer (timlConvNeuralNetwork *cnn, int scaleRow, int scaleCol, int strideX, int strideY, timlCNNPoolingType type, timlCNNPoolingParams params) |
Add pooling layer. More... | |
int | timlCNNClassifyTop1SingleMode (timlConvNeuralNetwork *cnn, float *data, int dim) |
Classify the data. More... | |
int | timlCNNClassifyTopNBatchMode (timlConvNeuralNetwork *cnn, float *data, int dim, int num, int *label, float *percent, int topN) |
Batch classification. More... | |
timlConvNeuralNetwork * | timlCNNClone (timlConvNeuralNetwork *cnn, int deviceId) |
Clone a cnn. More... | |
timlCNNConvParams | timlCNNConvParamsDefault () |
Return the default parameters for the convolutional layer. More... | |
timlConvNeuralNetwork * | timlCNNCreateConvNeuralNetwork (timlCNNTrainingParams params, int deviceId) |
Create a cnn structure. More... | |
int | timlCNNDelete (timlConvNeuralNetwork *cnn) |
Free a cnn structure. More... | |
int | timlCNNGetLayerNum (timlConvNeuralNetwork *cnn) |
Return the number of layers of the cnn. More... | |
long | timlCNNGetParamsNum (timlConvNeuralNetwork *cnn) |
Get the number of parameters of the cnn. More... | |
int | timlCNNInitialize (timlConvNeuralNetwork *cnn) |
Allocate the memory required by the cnn. More... | |
timlCNNLinearParams | timlCNNLinearParamsDefault () |
Return the default parameters for the linear layer. More... | |
long | timlCNNMemory (timlConvNeuralNetwork *cnn) |
Return the memory in bytes required by the cnn. More... | |
timlCNNNonlinearParams | timlCNNNonlinearParamsDefault () |
Return the default parameters for the nonlinear layer. More... | |
timlCNNNormParams | timlCNNNormParamsDefault () |
Return the default parameters for the norm layer. More... | |
timlCNNPoolingParams | timlCNNPoolingParamsDefault () |
Return the default parameters for the pooling layer. More... | |
int | timlCNNPrint (timlConvNeuralNetwork *cnn) |
Print out the information of the cnn. More... | |
int | timlCNNProfile (timlConvNeuralNetwork *cnn, float *data, int dim, int num, int *label, int iter) |
Profile the CNN with both timing and memory allocation. More... | |
timlConvNeuralNetwork * | timlCNNReadFromFile (const char *fileName, int deviceId) |
Read CNN from file(s) More... | |
int | timlCNNReset (timlConvNeuralNetwork *cnn) |
Reset the parameters of the CNN. More... | |
int | timlCNNResetDropoutLayer (timlCNNLayer *layer) |
Reset dropout layer. More... | |
int | timlCNNResize (timlConvNeuralNetwork *cnn, int row, int col, int channel) |
Resize the feature map sizes to accommodate new input feature map dimensions. More... | |
int | timlCNNSetMode (timlConvNeuralNetwork *cnn, timlUtilPhase phase) |
Set the phase (train/test) of the cnn. More... | |
timlConvNeuralNetwork * | timlCNNShareParams (timlConvNeuralNetwork *cnn, int deviceId) |
Create a new CNN that shares the parameters with the input CNN. More... | |
int | timlCNNSupervisedTrainingWithLabelBatchMode (timlConvNeuralNetwork *cnn, float *data, int *label, int dim, int num) |
Supervised training with label. More... | |
timlCNNTrainingParams | timlCNNTrainingParamsDefault () |
Return the default training parameters. More... | |
int | timlCNNWriteToFile (const char *fileName, timlConvNeuralNetwork *cnn, timlUtilParamsLevel level, const char *name, const char *floatFormat, const char *intFormat) |
Write the cnn to file(s) More... | |
timlCNNInputParams | timlCNNInputParamsDefault () |
Return the default parameters for the input layer. More... | |
Convolutional neural network.
int timlCNNAddConvLayer | ( | timlConvNeuralNetwork * | cnn, |
int | kernelRow, | ||
int | kernelCol, | ||
int | strideX, | ||
int | strideY, | ||
int | featureMapChannel, | ||
timlCNNConvParams | params | ||
) |
Add conv layer.
[in,out] | cnn | CNN |
[in] | kernelRow | Kernel row size |
[in] | kernelCol | Kernel col size |
[in] | strideX | Kernel horizontal stride size |
[in] | strideY | Kernel vertical stride size |
[in] | featureMapChannel | Output feature map channel size |
[in] | params | Optional parameters |
int timlCNNAddDropoutLayer | ( | timlConvNeuralNetwork * | cnn, |
float | prob | ||
) |
Add dropout layer.
[in,out] | cnn | CNN |
[in] | prob | Dropout probability |
int timlCNNAddInputLayer | ( | timlConvNeuralNetwork * | cnn, |
int | featureMapRow, | ||
int | featureMapCol, | ||
int | featureMapChannel, | ||
timlCNNInputParams | params | ||
) |
Add input layer.
[in,out] | cnn | CNN |
[in] | featureMapRow | Output feature map row size |
[in] | featureMapCol | Output feature map col size |
[in] | featureMapChannel | Output feature map channel size |
[in] | params | Optional parameters |
int timlCNNAddLinearLayer | ( | timlConvNeuralNetwork * | cnn, |
int | dim, | ||
timlCNNLinearParams | params | ||
) |
Add linear layer.
[in,out] | cnn | CNN |
[in] | dim | Output 1D feature map dimension |
[in] | params | Optional parameters |
int timlCNNAddNonlinearLayer | ( | timlConvNeuralNetwork * | cnn, |
timlUtilActivationType | type | ||
) |
Add nonlinear layer.
[in,out] | cnn | CNN |
[in] | type | Nonlinear activation type |
int timlCNNAddNormLayer | ( | timlConvNeuralNetwork * | cnn, |
timlCNNNormParams | params | ||
) |
Add normalization layer.
[in,out] | cnn | CNN |
[in] | params | Optional parameters |
int timlCNNAddPoolingLayer | ( | timlConvNeuralNetwork * | cnn, |
int | scaleRow, | ||
int | scaleCol, | ||
int | strideX, | ||
int | strideY, | ||
timlCNNPoolingType | type, | ||
timlCNNPoolingParams | params | ||
) |
Add pooling layer.
[in,out] | cnn | CNN |
[in] | scaleRow | Scale kernel row size |
[in] | scaleCol | Scale kernel col size |
[in] | strideX | Scale kernel horizontal stride size |
[in] | strideY | Scale kernel vertical stride size |
[in] | type | Pooling type (max/mean) |
[in] | params | Optional parameters |
int timlCNNAssignDevice | ( | timlConvNeuralNetwork * | cnn, |
int | deviceId, | ||
int | threadId | ||
) |
Assign the cnn to a specific device and thread.
[in] | cnn | CNN |
[in] | deviceId | Device Id starting from 0; |
[in] | threadId | Thread Id starting from 0; |
int timlCNNBackPropagation | ( | timlConvNeuralNetwork * | cnn, |
timlCNNLayer * | layer | ||
) |
Back propagate the gradient from layer to the first layer of the cnn.
[in] | cnn | CNN |
[in] | layer | Start layer |
int timlCNNClassifyTop1SingleMode | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int | dim | ||
) |
Classify the data.
[in,out] | cnn | CNN |
[in] | data | Data |
[in] | dim | Dimension of the data |
int timlCNNClassifyTopNBatchMode | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int | dim, | ||
int | num, | ||
int * | label, | ||
float * | percent, | ||
int | topN | ||
) |
Batch classification.
[in,out] | cnn | CNN |
[in] | data | Data batch |
[in] | dim | Data dimension |
[in] | num | Data number |
[out] | label | Label array ptr, size = num*topN |
[out] | percent | Percent array ptr, size = num*topN |
[out] | topN | Output the top N labels and the corresponding percentage |
int timlCNNClassifyTopNBatchModeOpenMP | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int | dim, | ||
int | num, | ||
int * | label, | ||
float * | percent, | ||
int | topN | ||
) |
Batch classification using openmp.
[in,out] | cnn | CNN |
[in] | data | Data batch |
[in] | dim | Data dimension |
[in] | num | Data number |
[out] | label | Label array ptr, size = num*topN |
[out] | percent | Percent array ptr, size = num*topN |
[out] | topN | Output the top N labels and the corresponding percentage |
int timlCNNClassifyTopNTeamModeOpenMP | ( | timlConvNeuralNetwork ** | cnnTeam, |
int | num, | ||
float * | data, | ||
int | dim, | ||
int * | label, | ||
float * | percent, | ||
int | topN | ||
) |
Batch classification using openmp.
This is the same function as timlCNNBatchClassifyOpenMP but avoids creating and deleting the cnn team each time the function is called
[in,out] | cnnTeam | An array of CNNs that shares the same parameters |
[in] | num | Size of the CNN array as well as the data |
[in] | data | Data batch |
[in] | dim | Data dimension |
[in,out] | label | Label array ptr, size = num*topN |
[in,out] | percent | Percent array ptr, size = num*topN |
[in,out] | topN | Output the top N labels and the corresponding percentage |
timlConvNeuralNetwork* timlCNNClone | ( | timlConvNeuralNetwork * | cnn, |
int | deviceId | ||
) |
Clone a cnn.
[in] | cnn | CNN to be cloned |
[in] | deviceId | Device Id |
int timlCNNConvBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the conv layer to the previous layer.
layer->prev->delta[i] = sum_{j}(layer->delta[j] conv2full layer->kernel[i, j])
[in] | layer | Layer ptr |
int timlCNNConvForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer ptr |
int timlCNNConvInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the conv layer.
[in] | layer | Conv layer |
timlCNNConvParams timlCNNConvParamsDefault | ( | ) |
Return the default parameters for the convolutional layer.
int timlCNNConvReadFromBinaryFile | ( | FILE * | fp2, |
FILE * | fp3, | ||
timlCNNLayer * | layer | ||
) |
Read the conv layer parameters from binary files.
[in] | fp2 | FILE ptr to the level 2 parameter bin file |
[in] | fp3 | FILE ptr to the level 3 state bin file |
[in,out] | layer | Conv layer |
int timlCNNConvReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the conv layer from a Matlab compatible text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNConvShareParams | ( | timlConvNeuralNetwork * | cnnShare, |
timlCNNLayer * | layer | ||
) |
Share the parameters with other conv layer.
Add a conv layer to cnnShare that shares the same parameters as the conv layer
[in,out] | cnnShare | CNN that shares the parameters of other cnn |
[in] | layer | Target cnn layer to share its parameters |
int timlCNNConvUpdateParams | ( | timlCNNLayer * | layer | ) |
Update the parameters of the conv layer.
[in] | layer | Layer |
int timlCNNConvWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the conv layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNCostWithLabel | ( | timlConvNeuralNetwork * | cnn, |
int | label, | ||
float * | cost, | ||
timlCNNLayer ** | bpStartLayer | ||
) |
Calculate the cost based on the cnn output and the label.
[in] | cnn | CNN |
[in] | label | Label |
[in,out] | cost | Cost |
[in,out] | bpStartLayer | Back propagation start layer |
timlConvNeuralNetwork* timlCNNCreateConvNeuralNetwork | ( | timlCNNTrainingParams | params, |
int | deviceId | ||
) |
Create a cnn structure.
[in] | params | Training parameters |
[in] | deviceId | Device Id, the default value is 0 |
int timlCNNDelete | ( | timlConvNeuralNetwork * | cnn | ) |
Free a cnn structure.
[in] | cnn | CNN structure |
int timlCNNDeleteConvLayer | ( | timlCNNLayer * | layer | ) |
Delete conv layer.
[in] | layer | Layer ptr |
int timlCNNDeleteDropoutLayer | ( | timlCNNLayer * | layer | ) |
Delete dropout layer.
[in] | layer | Layer ptr |
int timlCNNDeleteInputLayer | ( | timlCNNLayer * | layer | ) |
Delete input layer.
[in] | layer | Layer ptr |
int timlCNNDeleteLinearLayer | ( | timlCNNLayer * | layer | ) |
Delete linear layer.
[in] | layer | Layer ptr |
int timlCNNDeleteNonlinearLayer | ( | timlCNNLayer * | layer | ) |
Delete nonlinear layer.
[in] | layer | Layer ptr |
int timlCNNDeleteNormLayer | ( | timlCNNLayer * | layer | ) |
Delete norm layer.
[in] | layer | Layer ptr |
int timlCNNDeletePoolingLayer | ( | timlCNNLayer * | layer | ) |
Delete pooling layer.
[in] | layer | Layer ptr |
int timlCNNDropoutBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the dropout layer to the previous layer.
[in] | layer | Layer ptr |
int timlCNNDropoutForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer ptr |
int timlCNNDropoutInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the dropout layer.
[in] | layer | Dropout layer |
int timlCNNDropoutReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the dropout layer from a text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNDropoutWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the dropout layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNForwardPropagation | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int | dim | ||
) |
Forward propagate data to the CNN.
[in,out] | cnn | |
[in] | data | Data ptr |
[in] | dim | Data dimension |
int timlCNNGetLayerNum | ( | timlConvNeuralNetwork * | cnn | ) |
Return the number of layers of the cnn.
[in] | cnn |
long timlCNNGetParamsNum | ( | timlConvNeuralNetwork * | cnn | ) |
Get the number of parameters of the cnn.
[in] | cnn | CNN |
int timlCNNInitialize | ( | timlConvNeuralNetwork * | cnn | ) |
Allocate the memory required by the cnn.
[in] | cnn | CNN |
int timlCNNInputForwardPropagation | ( | timlCNNLayer * | layer, |
float * | data, | ||
int | dim | ||
) |
Forward propagate data to the the input layer.
[in] | layer | Layer ptr |
[in] | data | Data ptr |
[in] | dim | Data dimension |
int timlCNNInputInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the input layer.
[in] | layer | Input layer |
timlCNNInputParams timlCNNInputParamsDefault | ( | ) |
Return the default parameters for the input layer.
int timlCNNInputReadFromBinaryFile | ( | FILE * | fp2, |
FILE * | fp3, | ||
timlCNNLayer * | layer | ||
) |
Read the input layer parameters from binary files.
[in] | fp2 | FILE ptr to the level 2 parameter bin file |
[in] | fp3 | FILE ptr to the level 3 state bin file |
[in,out] | layer | Input layer |
int timlCNNInputReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the input layer from a Matlab compatible text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNInputShareParams | ( | timlConvNeuralNetwork * | cnn, |
timlCNNLayer * | layer | ||
) |
Share the mean with other input layer.
Add a layer who shares the same mean as the input layer to cnn
[in,out] | cnn | CNN |
[in] | layer | Layer to share its mean |
int timlCNNInputWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the input layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
const char * timlCNNLayerTypeStr | ( | timlCNNLayer * | layer | ) |
Return a string that represents the layer type.
[in] | layer | Layer pointer |
< return unknown type
int timlCNNLinearBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the linear layer to the previous layer.
[in] | layer | Layer ptr |
int timlCNNLinearForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer ptr |
int timlCNNLinearInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the linear layer.
[in] | layer | Layer ptr |
timlCNNLinearParams timlCNNLinearParamsDefault | ( | ) |
Return the default parameters for the linear layer.
int timlCNNLinearReadFromBinaryFile | ( | FILE * | fp2, |
FILE * | fp3, | ||
timlCNNLayer * | layer | ||
) |
Read the linear layer parameters from binary files.
[in] | fp2 | FILE ptr to the level 2 parameter bin file |
[in] | fp3 | FILE ptr to the level 3 state bin file |
[in,out] | layer | Layer ptr |
int timlCNNLinearReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the linear layer from a text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNLinearShareParams | ( | timlConvNeuralNetwork * | cnnShare, |
timlCNNLayer * | layer | ||
) |
Share the parameters with other linear layer.
Add a layer to cnnShare that shares the same parameters as the linear layer
[in,out] | cnnShare | CNN that shares the same paramters with other cnn |
[in] | layer | Target linear layer to share its parameters |
int timlCNNLinearUpdateParams | ( | timlCNNLayer * | layer | ) |
Update the parameters of the linear layer.
[in,out] | layer | Layer ptr |
int timlCNNLinearWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the linear layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNMaxPoolingBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the max pooling layer to the previous layer.
[in,out] | layer | Layer ptr |
int timlCNNMaxPoolingForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer ptr |
int timlCNNMeanPoolingBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the mean pooling layer to the previous layer.
[in,out] | layer |
int timlCNNMeanPoolingForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in,out] | prevLayer | Previous layer |
long timlCNNMemory | ( | timlConvNeuralNetwork * | cnn | ) |
Return the memory in bytes required by the cnn.
[in] | cnn | CNN |
int timlCNNMemPoolSize | ( | timlConvNeuralNetwork * | cnn | ) |
Return the memory pool size (byte)
int timlCNNNonlinearBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the nonlinear layer to the previous layer.
[in,out] | layer | Layer ptr |
int timlCNNNonlinearForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer |
int timlCNNNonlinearInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the nonlinear layer.
[in] | layer | Layer ptr |
timlCNNNonlinearParams timlCNNNonlinearParamsDefault | ( | ) |
Return the default parameters for the nonlinear layer.
int timlCNNNonlinearReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the nonlinear layer from a text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNNonlinearWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the nonlinear layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNNormBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the norm layer to the previous layer.
[in] | layer | Layer ptr |
int timlCNNNormForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer |
int timlCNNNormInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the norm layer.
[in] | layer | Layer ptr |
timlCNNNormParams timlCNNNormParamsDefault | ( | ) |
Return the default parameters for the norm layer.
int timlCNNNormReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the nonlinear layer from a text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNNormWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the norm layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | format string for floats |
[in] | intFormat | format string for ints |
int timlCNNPoolingBackPropagation | ( | timlCNNLayer * | layer | ) |
Back propagate the gradient from the pooling layer to the previous layer.
[in] | layer | Layer ptr |
int timlCNNPoolingForwardPropagation | ( | timlCNNLayer * | prevLayer | ) |
Forward propagate form layer to layer->next.
[in] | prevLayer | Previous layer |
int timlCNNPoolingInitialize | ( | timlCNNLayer * | layer | ) |
Initialize the pooling layer.
[in] | layer | Layer ptr |
timlCNNPoolingParams timlCNNPoolingParamsDefault | ( | ) |
Return the default parameters for the pooling layer.
int timlCNNPoolingReadFromTextFile | ( | FILE * | fp1, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the pooling layer from a text file.
[in] | fp1 | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNPoolingWriteToFile | ( | FILE * | fp1, |
FILE * | fp2, | ||
FILE * | fp3, | ||
timlCNNLayer * | layer, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the pooling layer to file(s)
[in,out] | fp1 | FILE ptr to the level 1 text file |
[in,out] | fp2 | FILE ptr to the level 2 bin file |
[in,out] | fp3 | FILE ptr to the level 3 bin file |
[in] | layer | Layer ptr |
[in] | level | Write level |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNPrint | ( | timlConvNeuralNetwork * | cnn | ) |
Print out the information of the cnn.
[in,out] | cnn | CNN |
int timlCNNProfile | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int | dim, | ||
int | num, | ||
int * | label, | ||
int | iter | ||
) |
Profile the CNN with both timing and memory allocation.
[in] | cnn | CNN |
[in] | data | Input data batch pointer |
[in] | dim | Data dimension |
[in] | num | Data batch size |
[in] | label | Label ptr |
[in] | iter | Iterations |
timlConvNeuralNetwork* timlCNNReadFromFile | ( | const char * | fileName, |
int | deviceId | ||
) |
Read CNN from file(s)
[in] | fileName | File name |
[in] | deviceId | Device Id |
int timlCNNReset | ( | timlConvNeuralNetwork * | cnn | ) |
Reset the parameters of the CNN.
[in,out] | cnn | CNN |
int timlCNNResetConvLayer | ( | timlCNNLayer * | layer | ) |
Reset conv layer.
[in] | layer | Layer ptr |
int timlCNNResetDropoutLayer | ( | timlCNNLayer * | layer | ) |
Reset dropout layer.
[in] | layer | Layer ptr |
int timlCNNResetInputLayer | ( | timlCNNLayer * | layer | ) |
Reset input layer.
[in] | layer | Layer ptr |
int timlCNNResetLinearLayer | ( | timlCNNLayer * | layer | ) |
Reset linear layer.
[in] | layer | Layer ptr |
int timlCNNResetNonlinearLayer | ( | timlCNNLayer * | layer | ) |
Reset nonlinear layer.
[in] | layer | Layer ptr |
int timlCNNResetNormLayer | ( | timlCNNLayer * | layer | ) |
Reset norm layer.
[in] | layer | Layer ptr |
int timlCNNResetPoolingLayer | ( | timlCNNLayer * | layer | ) |
Reset pooling layer.
[in] | layer | Layer ptr |
int timlCNNResize | ( | timlConvNeuralNetwork * | cnn, |
int | row, | ||
int | col, | ||
int | channel | ||
) |
Resize the feature map sizes to accommodate new input feature map dimensions.
Linear layers will be converted to convolutional layer
[in] | cnn | CNN |
[in] | row | New input feature map row size |
[in] | col | New input feature map col size |
[in] | channel | New input feature map channel size |
int timlCNNSetMode | ( | timlConvNeuralNetwork * | cnn, |
timlUtilPhase | phase | ||
) |
Set the phase (train/test) of the cnn.
[in,out] | cnn | CNN |
[in] | phase | Phase |
timlConvNeuralNetwork* timlCNNShareParams | ( | timlConvNeuralNetwork * | cnn, |
int | deviceId | ||
) |
Create a new CNN that shares the parameters with the input CNN.
Unlike the clone operation, the returned CNN points to the parameters to the input CNN.
[in] | cnn | CNN to be share parameters with |
[in] | deviceId | Device Id |
int timlCNNSupervisedTrainingWithLabelBatchMode | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int * | label, | ||
int | dim, | ||
int | num | ||
) |
Supervised training with label.
[in,out] | cnn | CNN |
[in] | data | Data batch |
[in] | label | Label ptr |
[in] | dim | Data dimension |
[in] | num | Batch size |
int timlCNNSupervisedTrainingWithLabelBatchModeOpenMP | ( | timlConvNeuralNetwork * | cnn, |
float * | data, | ||
int * | label, | ||
int | dim, | ||
int | num | ||
) |
supervised training with label using openmp
[in,out] | cnn | |
[in] | data | data batch |
[in] | label | |
[in] | dim | data dimension |
[in] | num | data number |
timlCNNTrainingParams timlCNNTrainingParamsDefault | ( | ) |
Return the default training parameters.
int timlCNNTrainingParamsReadFromTextFile | ( | FILE * | fp, |
timlConvNeuralNetwork * | cnn | ||
) |
Read the training params from a text file.
[in] | fp | FILE ptr to the level 1 text file |
[in,out] | cnn | CNN |
int timlCNNTrainingParamsWriteToFile | ( | FILE * | fp, |
timlConvNeuralNetwork * | cnn, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the training params to file(s)
[in,out] | fp | FILE ptr to the level 1 text file |
[in] | cnn | CNN |
[in] | name | CNN name |
[in] | floatFormat | Format string for floats |
[in] | intFormat | Format string for ints |
int timlCNNUpdateParams | ( | timlConvNeuralNetwork * | cnn | ) |
Update the parameters of the cnn.
[in,out] | cnn | CNN |
int timlCNNWriteToFile | ( | const char * | fileName, |
timlConvNeuralNetwork * | cnn, | ||
timlUtilParamsLevel | level, | ||
const char * | name, | ||
const char * | floatFormat, | ||
const char * | intFormat | ||
) |
Write the cnn to file(s)
[in] | fileName | File name |
[in] | cnn | CNN |
[in] | level | Parameter write level |
[in] | name | Name of the cnn |
[in] | floatFormat | Format string for float |
[in] | intFormat | Format string for int |