| | |
| | | #define NETWORK_H |
| | | |
| | | #include "image.h" |
| | | #include "detection_layer.h" |
| | | #include "params.h" |
| | | #include "layer.h" |
| | | #include "data.h" |
| | | |
| | | typedef enum { |
| | | CONVOLUTIONAL, |
| | | DECONVOLUTIONAL, |
| | | CONNECTED, |
| | | MAXPOOL, |
| | | SOFTMAX, |
| | | DETECTION, |
| | | NORMALIZATION, |
| | | DROPOUT, |
| | | CROP, |
| | | COST |
| | | } LAYER_TYPE; |
| | | CONSTANT, STEP, EXP, POLY, STEPS, SIG, RANDOM |
| | | } learning_rate_policy; |
| | | |
| | | typedef struct { |
| | | typedef struct network{ |
| | | float *workspace; |
| | | int n; |
| | | int batch; |
| | | int seen; |
| | | int *seen; |
| | | float epoch; |
| | | int subdivisions; |
| | | float learning_rate; |
| | | float momentum; |
| | | float decay; |
| | | void **layers; |
| | | LAYER_TYPE *types; |
| | | layer *layers; |
| | | int outputs; |
| | | float *output; |
| | | learning_rate_policy policy; |
| | | |
| | | float learning_rate; |
| | | float gamma; |
| | | float scale; |
| | | float power; |
| | | int time_steps; |
| | | int step; |
| | | int max_batches; |
| | | float *scales; |
| | | int *steps; |
| | | int num_steps; |
| | | int burn_in; |
| | | |
| | | int inputs; |
| | | int h, w, c; |
| | | int max_crop; |
| | | int min_crop; |
| | | float angle; |
| | | float exposure; |
| | | float saturation; |
| | | float hue; |
| | | |
| | | int gpu_index; |
| | | |
| | | #ifdef GPU |
| | | float **input_gpu; |
| | |
| | | #endif |
| | | } network; |
| | | |
| | | typedef struct network_state { |
| | | float *truth; |
| | | float *input; |
| | | float *delta; |
| | | float *workspace; |
| | | int train; |
| | | int index; |
| | | network net; |
| | | } network_state; |
| | | |
| | | #ifdef GPU |
| | | float train_network_datum_gpu(network net, float *x, float *y); |
| | | float *network_predict_gpu(network net, float *input); |
| | | float * get_network_output_gpu_layer(network net, int i); |
| | | float * get_network_delta_gpu_layer(network net, int i); |
| | | float *get_network_output_gpu(network net); |
| | | void forward_network_gpu(network net, network_state state); |
| | | void backward_network_gpu(network net, network_state state); |
| | | void update_network_gpu(network net); |
| | | #endif |
| | | |
| | | float get_current_rate(network net); |
| | | int get_current_batch(network net); |
| | | void free_network(network net); |
| | | void compare_networks(network n1, network n2, data d); |
| | | char *get_layer_string(LAYER_TYPE a); |
| | | |
| | |
| | | float train_network(network net, data d); |
| | | float train_network_batch(network net, data d, int n); |
| | | float train_network_sgd(network net, data d, int n); |
| | | float train_network_datum(network net, float *x, float *y); |
| | | |
| | | matrix network_predict_data(network net, data test); |
| | | float *network_predict(network net, float *input); |
| | | float network_accuracy(network net, data d); |
| | | float *network_accuracies(network net, data d); |
| | | float *network_accuracies(network net, data d, int n); |
| | | float network_accuracy_multi(network net, data d, int n); |
| | | void top_predictions(network net, int n, int *index); |
| | | float *get_network_output(network net); |
| | |
| | | int get_predicted_class_network(network net); |
| | | void print_network(network net); |
| | | void visualize_network(network net); |
| | | int resize_network(network net, int h, int w, int c); |
| | | int resize_network(network *net, int w, int h); |
| | | void set_batch_network(network *net, int b); |
| | | int get_network_input_size(network net); |
| | | float get_network_cost(network net); |
| | | detection_layer *get_network_detection_layer(network net); |
| | | |
| | | int get_network_nuisance(network net); |
| | | int get_network_background(network net); |