AlexeyAB
2018-03-30 35cc0aaa15b991b348cc8d9623eed5d4f8a1e435
Added max_boxes for yolo v3
3 files modified
13 ■■■■■ changed files
src/parser.c 5 ●●●●● patch | view | raw | blame | history
src/yolo_layer.c 6 ●●●●● patch | view | raw | blame | history
src/yolo_layer.h 2 ●●● patch | view | raw | blame | history
src/parser.c
@@ -268,10 +268,11 @@
    char *a = option_find_str(options, "mask", 0);
    int *mask = parse_yolo_mask(a, &num);
    layer l = make_yolo_layer(params.batch, params.w, params.h, num, total, mask, classes);
    int max_boxes = option_find_int_quiet(options, "max", 30);
    layer l = make_yolo_layer(params.batch, params.w, params.h, num, total, mask, classes, max_boxes);
    assert(l.outputs == params.inputs);
    l.max_boxes = option_find_int_quiet(options, "max", 90);
    //l.max_boxes = option_find_int_quiet(options, "max", 90);
    l.jitter = option_find_float(options, "jitter", .2);
    l.ignore_thresh = option_find_float(options, "ignore_thresh", .5);
src/yolo_layer.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <stdlib.h>
layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes)
layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes, int max_boxes)
{
    int i;
    layer l = {0};
@@ -38,7 +38,9 @@
    l.bias_updates = calloc(n*2, sizeof(float));
    l.outputs = h*w*n*(classes + 4 + 1);
    l.inputs = l.outputs;
    l.truths = 90*(4 + 1);
    l.max_boxes = max_boxes;
    printf(" l.max_boxes = %d \n", l.max_boxes);
    l.truths = l.max_boxes*(4 + 1); // 90*(4 + 1);
    l.delta = calloc(batch*l.outputs, sizeof(float));
    l.output = calloc(batch*l.outputs, sizeof(float));
    for(i = 0; i < total*2; ++i){
src/yolo_layer.h
@@ -5,7 +5,7 @@
#include "layer.h"
#include "network.h"
layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes);
layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes, int max_boxes);
void forward_yolo_layer(const layer l, network_state state);
void backward_yolo_layer(const layer l, network_state state);
void resize_yolo_layer(layer *l, int w, int h);