updates and things

This commit is contained in:
Joseph Redmon
2016-09-01 16:48:41 -07:00
parent aebe937710
commit 8f1b4e0962
45 changed files with 44944 additions and 2747 deletions

View File

@ -18,7 +18,7 @@ image get_maxpool_delta(maxpool_layer l)
return float_to_image(w,h,c,l.delta);
}
maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride)
maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding)
{
fprintf(stderr, "Maxpool Layer: %d x %d x %d image, %d size, %d stride\n", h,w,c,size,stride);
maxpool_layer l = {0};
@ -27,8 +27,9 @@ maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int s
l.h = h;
l.w = w;
l.c = c;
l.out_w = (w-1)/stride + 1;
l.out_h = (h-1)/stride + 1;
l.pad = padding;
l.out_w = (w + 2*padding - size + 1)/stride + 1;
l.out_h = (h + 2*padding - size + 1)/stride + 1;
l.out_c = c;
l.outputs = l.out_h * l.out_w * l.out_c;
l.inputs = h*w*c;
@ -48,13 +49,12 @@ maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int s
void resize_maxpool_layer(maxpool_layer *l, int w, int h)
{
int stride = l->stride;
l->h = h;
l->w = w;
l->inputs = h*w*l->c;
l->out_w = (w-1)/stride + 1;
l->out_h = (h-1)/stride + 1;
l->out_w = (w + 2*l->pad - l->size + 1)/l->stride + 1;
l->out_h = (h + 2*l->pad - l->size + 1)/l->stride + 1;
l->outputs = l->out_w * l->out_h * l->c;
int output_size = l->outputs * l->batch;
@ -75,11 +75,11 @@ void resize_maxpool_layer(maxpool_layer *l, int w, int h)
void forward_maxpool_layer(const maxpool_layer l, network_state state)
{
int b,i,j,k,m,n;
int w_offset = (-l.size-1)/2 + 1;
int h_offset = (-l.size-1)/2 + 1;
int w_offset = -l.pad;
int h_offset = -l.pad;
int h = (l.h-1)/l.stride + 1;
int w = (l.w-1)/l.stride + 1;
int h = l.out_h;
int w = l.out_w;
int c = l.c;
for(b = 0; b < l.batch; ++b){
@ -112,8 +112,8 @@ void forward_maxpool_layer(const maxpool_layer l, network_state state)
void backward_maxpool_layer(const maxpool_layer l, network_state state)
{
int i;
int h = (l.h-1)/l.stride + 1;
int w = (l.w-1)/l.stride + 1;
int h = l.out_h;
int w = l.out_w;
int c = l.c;
for(i = 0; i < h*w*c*l.batch; ++i){
int index = l.indexes[i];