Better VOC handling and resizing

This commit is contained in:
Joseph Redmon
2014-03-12 21:57:34 -07:00
parent 15e86996d6
commit 2ea63c0e99
21 changed files with 288 additions and 173 deletions

View File

@ -17,10 +17,12 @@ image get_maxpool_delta(maxpool_layer layer)
return float_to_image(h,w,c,layer.delta);
}
maxpool_layer *make_maxpool_layer(int h, int w, int c, int stride)
maxpool_layer *make_maxpool_layer(int batch, int h, int w, int c, int stride)
{
c = c*batch;
fprintf(stderr, "Maxpool Layer: %d x %d x %d image, %d stride\n", h,w,c,stride);
maxpool_layer *layer = calloc(1, sizeof(maxpool_layer));
layer->batch = batch;
layer->h = h;
layer->w = w;
layer->c = c;
@ -30,6 +32,15 @@ maxpool_layer *make_maxpool_layer(int h, int w, int c, int stride)
return layer;
}
void resize_maxpool_layer(maxpool_layer *layer, int h, int w, int c)
{
layer->h = h;
layer->w = w;
layer->c = c;
layer->output = realloc(layer->output, ((h-1)/layer->stride+1) * ((w-1)/layer->stride+1) * c * sizeof(float));
layer->delta = realloc(layer->delta, ((h-1)/layer->stride+1) * ((w-1)/layer->stride+1) * c * sizeof(float));
}
void forward_maxpool_layer(const maxpool_layer layer, float *in)
{
image input = float_to_image(layer.h, layer.w, layer.c, in);