2013-11-04 23:11:01 +04:00
|
|
|
#ifndef CONVOLUTIONAL_LAYER_H
|
|
|
|
#define CONVOLUTIONAL_LAYER_H
|
|
|
|
|
|
|
|
#include "image.h"
|
2013-11-13 22:50:38 +04:00
|
|
|
#include "activations.h"
|
2013-11-04 23:11:01 +04:00
|
|
|
|
|
|
|
typedef struct {
|
2013-11-13 22:50:38 +04:00
|
|
|
int h,w,c;
|
2013-11-04 23:11:01 +04:00
|
|
|
int n;
|
2013-12-03 04:41:40 +04:00
|
|
|
int size;
|
2013-11-04 23:11:01 +04:00
|
|
|
int stride;
|
2014-01-29 04:28:42 +04:00
|
|
|
float *filters;
|
|
|
|
float *filter_updates;
|
|
|
|
float *filter_momentum;
|
2014-01-28 11:16:56 +04:00
|
|
|
|
2014-01-29 04:28:42 +04:00
|
|
|
float *biases;
|
|
|
|
float *bias_updates;
|
|
|
|
float *bias_momentum;
|
2014-01-28 11:16:56 +04:00
|
|
|
|
2014-01-29 04:28:42 +04:00
|
|
|
float *col_image;
|
|
|
|
float *delta;
|
|
|
|
float *output;
|
2013-11-13 22:50:38 +04:00
|
|
|
|
2013-12-03 04:41:40 +04:00
|
|
|
ACTIVATION activation;
|
2013-11-04 23:11:01 +04:00
|
|
|
} convolutional_layer;
|
|
|
|
|
2013-12-03 04:41:40 +04:00
|
|
|
convolutional_layer *make_convolutional_layer(int h, int w, int c, int n, int size, int stride, ACTIVATION activation);
|
2014-01-29 04:28:42 +04:00
|
|
|
void forward_convolutional_layer(const convolutional_layer layer, float *in);
|
2014-01-28 11:16:56 +04:00
|
|
|
void learn_convolutional_layer(convolutional_layer layer);
|
2014-01-29 04:28:42 +04:00
|
|
|
void update_convolutional_layer(convolutional_layer layer, float step, float momentum, float decay);
|
2014-01-28 11:16:56 +04:00
|
|
|
void visualize_convolutional_layer(convolutional_layer layer, char *window);
|
|
|
|
|
2014-01-29 04:28:42 +04:00
|
|
|
void backward_convolutional_layer(convolutional_layer layer, float *delta);
|
2013-11-13 22:50:38 +04:00
|
|
|
|
2014-01-28 11:16:56 +04:00
|
|
|
//void backpropagate_convolutional_layer_convolve(image input, convolutional_layer layer);
|
|
|
|
//void visualize_convolutional_filters(convolutional_layer layer, char *window);
|
|
|
|
//void visualize_convolutional_layer(convolutional_layer layer);
|
2013-11-13 22:50:38 +04:00
|
|
|
|
|
|
|
image get_convolutional_image(convolutional_layer layer);
|
|
|
|
image get_convolutional_delta(convolutional_layer layer);
|
2014-01-28 11:16:56 +04:00
|
|
|
image get_convolutional_filter(convolutional_layer layer, int i);
|
2013-11-04 23:11:01 +04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|