| | |
| | | #ifndef CONVOLUTIONAL_LAYER_H |
| | | #define CONVOLUTIONAL_LAYER_H |
| | | |
| | | #include "cuda.h" |
| | | #include "params.h" |
| | | #include "image.h" |
| | | #include "activations.h" |
| | | #include "layer.h" |
| | | #include "network.h" |
| | | |
| | | typedef struct { |
| | | int h,w,c; |
| | | int out_h, out_w, out_c; |
| | | int n; |
| | | int size; |
| | | int stride; |
| | | float *filters; |
| | | float *filter_updates; |
| | | float *filter_momentum; |
| | | typedef layer convolutional_layer; |
| | | |
| | | float *biases; |
| | | float *bias_updates; |
| | | float *bias_momentum; |
| | | #ifdef GPU |
| | | void forward_convolutional_layer_gpu(convolutional_layer layer, network_state state); |
| | | void backward_convolutional_layer_gpu(convolutional_layer layer, network_state state); |
| | | void update_convolutional_layer_gpu(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay); |
| | | |
| | | float *col_image; |
| | | float *delta; |
| | | float *output; |
| | | void push_convolutional_layer(convolutional_layer layer); |
| | | void pull_convolutional_layer(convolutional_layer layer); |
| | | |
| | | ACTIVATION activation; |
| | | } convolutional_layer; |
| | | void add_bias_gpu(float *output, float *biases, int batch, int n, int size); |
| | | void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size); |
| | | #endif |
| | | |
| | | convolutional_layer *make_convolutional_layer(int h, int w, int c, int n, int size, int stride, ACTIVATION activation); |
| | | void forward_convolutional_layer(const convolutional_layer layer, float *in); |
| | | void learn_convolutional_layer(convolutional_layer layer); |
| | | void update_convolutional_layer(convolutional_layer layer, float step, float momentum, float decay); |
| | | void visualize_convolutional_layer(convolutional_layer layer, char *window); |
| | | convolutional_layer make_convolutional_layer(int batch, int h, int w, int c, int n, int size, int stride, int pad, ACTIVATION activation, int batch_normalization); |
| | | void denormalize_convolutional_layer(convolutional_layer l); |
| | | void resize_convolutional_layer(convolutional_layer *layer, int w, int h); |
| | | void forward_convolutional_layer(const convolutional_layer layer, network_state state); |
| | | void update_convolutional_layer(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay); |
| | | image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_filters); |
| | | |
| | | void backward_convolutional_layer(convolutional_layer layer, float *delta); |
| | | void backward_convolutional_layer(convolutional_layer layer, network_state state); |
| | | |
| | | //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); |
| | | void bias_output(float *output, float *biases, int batch, int n, int size); |
| | | void backward_bias(float *bias_updates, float *delta, int batch, int n, int size); |
| | | |
| | | image get_convolutional_image(convolutional_layer layer); |
| | | image get_convolutional_delta(convolutional_layer layer); |
| | | image get_convolutional_filter(convolutional_layer layer, int i); |
| | | |
| | | int convolutional_out_height(convolutional_layer layer); |
| | | int convolutional_out_width(convolutional_layer layer); |
| | | void rescale_filters(convolutional_layer l, float scale, float trans); |
| | | void rgbgr_filters(convolutional_layer l); |
| | | |
| | | #endif |
| | | |