2013-11-04 23:11:01 +04:00
|
|
|
// Oh boy, why am I about to do this....
|
|
|
|
#ifndef NETWORK_H
|
|
|
|
#define NETWORK_H
|
|
|
|
|
|
|
|
#include "image.h"
|
2013-11-13 22:50:38 +04:00
|
|
|
#include "data.h"
|
2013-11-04 23:11:01 +04:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CONVOLUTIONAL,
|
|
|
|
CONNECTED,
|
2013-12-03 04:41:40 +04:00
|
|
|
MAXPOOL,
|
|
|
|
SOFTMAX
|
2013-11-04 23:11:01 +04:00
|
|
|
} LAYER_TYPE;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int n;
|
|
|
|
void **layers;
|
|
|
|
LAYER_TYPE *types;
|
2013-12-07 01:26:09 +04:00
|
|
|
int outputs;
|
|
|
|
double *output;
|
2013-11-04 23:11:01 +04:00
|
|
|
} network;
|
|
|
|
|
2013-11-07 04:09:41 +04:00
|
|
|
network make_network(int n);
|
2013-11-13 22:50:38 +04:00
|
|
|
void forward_network(network net, double *input);
|
2013-12-07 01:26:09 +04:00
|
|
|
void backward_network(network net, double *input, double *truth);
|
|
|
|
void update_network(network net, double step, double momentum, double decay);
|
|
|
|
double train_network_sgd(network net, data d, double step, double momentum,double decay);
|
|
|
|
void train_network(network net, data d, double step, double momentum, double decay);
|
|
|
|
double network_accuracy(network net, data d);
|
2013-11-07 04:09:41 +04:00
|
|
|
double *get_network_output(network net);
|
|
|
|
double *get_network_output_layer(network net, int i);
|
2013-11-13 22:50:38 +04:00
|
|
|
double *get_network_delta_layer(network net, int i);
|
|
|
|
double *get_network_delta(network net);
|
2013-11-07 04:09:41 +04:00
|
|
|
int get_network_output_size_layer(network net, int i);
|
2013-11-13 22:50:38 +04:00
|
|
|
int get_network_output_size(network net);
|
2013-11-04 23:11:01 +04:00
|
|
|
image get_network_image(network net);
|
2013-11-07 04:09:41 +04:00
|
|
|
image get_network_image_layer(network net, int i);
|
2013-12-07 01:26:09 +04:00
|
|
|
int get_predicted_class_network(network net);
|
2013-12-03 04:41:40 +04:00
|
|
|
void print_network(network net);
|
|
|
|
void visualize_network(network net);
|
2013-11-04 23:11:01 +04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|