mirror of https://github.com/AlexeyAB/darknet.git
parent
892923514f
commit
db0397cfaa
35 changed files with 2635 additions and 56 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,371 @@ |
||||
[net] |
||||
batch=128 |
||||
subdivisions=1 |
||||
height=256 |
||||
width=256 |
||||
channels=3 |
||||
momentum=0.9 |
||||
decay=0.0005 |
||||
|
||||
learning_rate=0.1 |
||||
policy=poly |
||||
power=4 |
||||
max_batches=500000 |
||||
|
||||
#policy=sigmoid |
||||
#gamma=.00008 |
||||
#step=100000 |
||||
#max_batches=200000 |
||||
|
||||
[crop] |
||||
crop_height=224 |
||||
crop_width=224 |
||||
flip=1 |
||||
saturation=1 |
||||
exposure=1 |
||||
angle=0 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=7 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[maxpool] |
||||
size=3 |
||||
stride=2 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
|
||||
|
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -3 |
||||
|
||||
[avgpool] |
||||
|
||||
[connected] |
||||
output=1000 |
||||
activation=leaky |
||||
|
||||
[softmax] |
||||
groups=1 |
||||
|
||||
[cost] |
||||
type=sse |
||||
|
@ -0,0 +1,490 @@ |
||||
[net] |
||||
batch=128 |
||||
subdivisions=4 |
||||
height=256 |
||||
width=256 |
||||
channels=3 |
||||
momentum=0.9 |
||||
decay=0.0005 |
||||
|
||||
learning_rate=0.01 |
||||
|
||||
[crop] |
||||
crop_height=224 |
||||
crop_width=224 |
||||
flip=1 |
||||
saturation=1 |
||||
exposure=1 |
||||
angle=0 |
||||
|
||||
##### Conv 1 ##### |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=7 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[maxpool] |
||||
size=3 |
||||
stride=2 |
||||
|
||||
|
||||
##### Conv 2_x ##### |
||||
|
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=64 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
|
||||
##### Conv 3_x ##### |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=128 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
|
||||
##### Conv 4_x ##### |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=256 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=1024 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
|
||||
##### Conv 5_x ##### |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=2 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=2048 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=2048 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=512 |
||||
size=3 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[convolutional] |
||||
batch_normalize=1 |
||||
filters=2048 |
||||
size=1 |
||||
stride=1 |
||||
pad=1 |
||||
activation=leaky |
||||
|
||||
[shortcut] |
||||
from = -4 |
||||
|
||||
[avgpool] |
||||
|
||||
[connected] |
||||
output=1000 |
||||
activation=leaky |
||||
|
||||
[softmax] |
||||
groups=1 |
||||
|
||||
[cost] |
||||
type=sse |
||||
|
@ -1,12 +1 @@ |
||||
#ifndef PARAMS_H |
||||
#define PARAMS_H |
||||
|
||||
typedef struct { |
||||
float *truth; |
||||
float *input; |
||||
float *delta; |
||||
int train; |
||||
} network_state; |
||||
|
||||
#endif |
||||
|
||||
|
@ -0,0 +1,64 @@ |
||||
#include "shortcut_layer.h" |
||||
#include "cuda.h" |
||||
#include "blas.h" |
||||
#include <stdio.h> |
||||
#include <assert.h> |
||||
|
||||
layer make_shortcut_layer(int batch, int index, int w, int h, int c, int w2, int h2, int c2) |
||||
{ |
||||
fprintf(stderr,"Shortcut Layer: %d\n", index); |
||||
layer l = {0}; |
||||
l.type = SHORTCUT; |
||||
l.batch = batch; |
||||
l.w = w; |
||||
l.h = h; |
||||
l.c = c; |
||||
l.out_w = w; |
||||
l.out_h = h; |
||||
l.out_c = c; |
||||
l.outputs = w*h*c; |
||||
l.inputs = w*h*c; |
||||
int stride = w2 / w; |
||||
|
||||
assert(stride * w == w2); |
||||
assert(stride * h == h2); |
||||
assert(c >= c2); |
||||
|
||||
l.stride = stride; |
||||
l.n = c2; |
||||
l.index = index; |
||||
|
||||
l.delta = calloc(l.outputs*batch, sizeof(float)); |
||||
l.output = calloc(l.outputs*batch, sizeof(float));; |
||||
#ifdef GPU |
||||
l.delta_gpu = cuda_make_array(l.delta, l.outputs*batch); |
||||
l.output_gpu = cuda_make_array(l.output, l.outputs*batch); |
||||
#endif |
||||
return l; |
||||
} |
||||
|
||||
void forward_shortcut_layer(const layer l, network_state state) |
||||
{ |
||||
copy_cpu(l.outputs*l.batch, state.input, 1, l.output, 1); |
||||
shortcut_cpu(l.output, l.w, l.h, l.c, l.batch, 1, state.net.layers[l.index].output, l.stride, l.n); |
||||
} |
||||
|
||||
void backward_shortcut_layer(const layer l, network_state state) |
||||
{ |
||||
copy_cpu(l.outputs*l.batch, l.delta, 1, state.delta, 1); |
||||
shortcut_cpu(state.net.layers[l.index].delta, l.w*l.stride, l.h*l.stride, l.n, l.batch, l.stride, l.delta, 1, l.c); |
||||
} |
||||
|
||||
#ifdef GPU |
||||
void forward_shortcut_layer_gpu(const layer l, network_state state) |
||||
{ |
||||
copy_ongpu(l.outputs*l.batch, state.input, 1, l.output_gpu, 1); |
||||
shortcut_gpu(l.output_gpu, l.w, l.h, l.c, l.batch, 1, state.net.layers[l.index].output_gpu, l.stride, l.n); |
||||
} |
||||
|
||||
void backward_shortcut_layer_gpu(const layer l, network_state state) |
||||
{ |
||||
copy_ongpu(l.outputs*l.batch, l.delta_gpu, 1, state.delta, 1); |
||||
shortcut_gpu(state.net.layers[l.index].delta_gpu, l.w*l.stride, l.h*l.stride, l.n, l.batch, l.stride, l.delta_gpu, 1, l.c); |
||||
} |
||||
#endif |
@ -0,0 +1,16 @@ |
||||
#ifndef SHORTCUT_LAYER_H |
||||
#define SHORTCUT_LAYER_H |
||||
|
||||
#include "layer.h" |
||||
#include "network.h" |
||||
|
||||
layer make_shortcut_layer(int batch, int index, int w, int h, int c, int w2, int h2, int c2); |
||||
void forward_shortcut_layer(const layer l, network_state state); |
||||
void backward_shortcut_layer(const layer l, network_state state); |
||||
|
||||
#ifdef GPU |
||||
void forward_shortcut_layer_gpu(const layer l, network_state state); |
||||
void backward_shortcut_layer_gpu(const layer l, network_state state); |
||||
#endif |
||||
|
||||
#endif |
Loading…
Reference in new issue