darknet/src/layer.h

180 lines
2.9 KiB
C
Raw Normal View History

2015-05-11 23:54:58 +03:00
#ifndef BASE_LAYER_H
#define BASE_LAYER_H
#include "activations.h"
2015-12-14 22:57:10 +03:00
struct layer;
typedef struct layer layer;
2015-05-11 23:54:58 +03:00
typedef enum {
CONVOLUTIONAL,
DECONVOLUTIONAL,
CONNECTED,
MAXPOOL,
SOFTMAX,
DETECTION,
DROPOUT,
CROP,
ROUTE,
2015-07-10 01:22:14 +03:00
COST,
2015-07-14 01:04:21 +03:00
NORMALIZATION,
2015-11-14 23:34:17 +03:00
AVGPOOL,
2015-12-14 22:57:10 +03:00
LOCAL,
2016-01-19 02:40:14 +03:00
SHORTCUT,
2016-01-28 23:30:38 +03:00
ACTIVE,
RNN
2015-05-11 23:54:58 +03:00
} LAYER_TYPE;
typedef enum{
2016-01-28 23:30:38 +03:00
SSE, MASKED, SMOOTH
2015-05-11 23:54:58 +03:00
} COST_TYPE;
2015-12-14 22:57:10 +03:00
struct layer{
2015-05-11 23:54:58 +03:00
LAYER_TYPE type;
ACTIVATION activation;
COST_TYPE cost_type;
2015-11-04 06:23:17 +03:00
int batch_normalize;
2016-02-01 02:52:03 +03:00
int shortcut;
2015-05-11 23:54:58 +03:00
int batch;
2015-09-29 00:32:28 +03:00
int forced;
2015-12-14 22:57:10 +03:00
int flipped;
2015-05-11 23:54:58 +03:00
int inputs;
int outputs;
2015-09-17 00:12:10 +03:00
int truths;
2015-05-11 23:54:58 +03:00
int h,w,c;
int out_h, out_w, out_c;
int n;
int groups;
int size;
2015-09-01 21:21:01 +03:00
int side;
2015-05-11 23:54:58 +03:00
int stride;
int pad;
2015-09-17 00:12:10 +03:00
int sqrt;
2015-05-11 23:54:58 +03:00
int flip;
2015-12-14 22:57:10 +03:00
int index;
2016-01-28 23:30:38 +03:00
int binary;
int steps;
int hidden;
2015-05-11 23:54:58 +03:00
float angle;
2015-10-09 22:50:43 +03:00
float jitter;
2015-05-11 23:54:58 +03:00
float saturation;
float exposure;
2015-11-04 06:23:17 +03:00
float shift;
2015-09-17 00:12:10 +03:00
int softmax;
2015-05-11 23:54:58 +03:00
int classes;
int coords;
int background;
int rescore;
2015-06-10 10:11:41 +03:00
int objectness;
2015-05-11 23:54:58 +03:00
int does_cost;
2015-06-10 10:11:41 +03:00
int joint;
2015-07-14 09:25:08 +03:00
int noadjust;
2015-06-10 10:11:41 +03:00
2015-07-10 01:22:14 +03:00
float alpha;
float beta;
float kappa;
2015-09-22 03:30:32 +03:00
float coord_scale;
float object_scale;
float noobject_scale;
float class_scale;
2015-07-08 10:36:43 +03:00
int dontload;
2015-11-04 06:23:17 +03:00
int dontloadscales;
2015-07-08 10:36:43 +03:00
2016-01-28 23:30:38 +03:00
float temperature;
2015-05-11 23:54:58 +03:00
float probability;
float scale;
2015-09-01 21:21:01 +03:00
2015-05-11 23:54:58 +03:00
int *indexes;
float *rand;
float *cost;
float *filters;
float *filter_updates;
2016-01-28 23:30:38 +03:00
float *state;
float *binary_filters;
2015-05-11 23:54:58 +03:00
float *biases;
float *bias_updates;
2015-11-04 06:23:17 +03:00
float *scales;
float *scale_updates;
2015-05-11 23:54:58 +03:00
float *weights;
float *weight_updates;
float *col_image;
int * input_layers;
int * input_sizes;
float * delta;
float * output;
2015-07-10 01:22:14 +03:00
float * squared;
float * norms;
2015-05-11 23:54:58 +03:00
2015-11-04 06:23:17 +03:00
float * spatial_mean;
float * mean;
float * variance;
2016-01-28 23:30:38 +03:00
float * mean_delta;
float * variance_delta;
2015-11-04 06:23:17 +03:00
float * rolling_mean;
float * rolling_variance;
2016-01-28 23:30:38 +03:00
float * x;
float * x_norm;
struct layer *input_layer;
struct layer *self_layer;
struct layer *output_layer;
2015-05-11 23:54:58 +03:00
#ifdef GPU
int *indexes_gpu;
2016-01-28 23:30:38 +03:00
float * state_gpu;
2015-05-11 23:54:58 +03:00
float * filters_gpu;
float * filter_updates_gpu;
2016-01-28 23:30:38 +03:00
float *binary_filters_gpu;
float *mean_filters_gpu;
2015-11-04 06:23:17 +03:00
float * spatial_mean_gpu;
float * spatial_variance_gpu;
float * mean_gpu;
float * variance_gpu;
float * rolling_mean_gpu;
float * rolling_variance_gpu;
float * spatial_mean_delta_gpu;
float * spatial_variance_delta_gpu;
float * variance_delta_gpu;
float * mean_delta_gpu;
2015-05-11 23:54:58 +03:00
float * col_image_gpu;
2015-11-04 06:23:17 +03:00
float * x_gpu;
float * x_norm_gpu;
2015-05-11 23:54:58 +03:00
float * weights_gpu;
float * weight_updates_gpu;
2015-11-26 22:48:01 +03:00
float * biases_gpu;
2015-05-11 23:54:58 +03:00
float * bias_updates_gpu;
2015-11-26 22:48:01 +03:00
float * scales_gpu;
2015-11-04 06:23:17 +03:00
float * scale_updates_gpu;
2015-05-11 23:54:58 +03:00
float * output_gpu;
float * delta_gpu;
float * rand_gpu;
2015-07-10 01:22:14 +03:00
float * squared_gpu;
float * norms_gpu;
2015-05-11 23:54:58 +03:00
#endif
2015-12-14 22:57:10 +03:00
};
2015-05-11 23:54:58 +03:00
2015-09-01 21:21:01 +03:00
void free_layer(layer);
2015-05-11 23:54:58 +03:00
#endif