mirror of https://github.com/AlexeyAB/darknet.git
Parameter (max) in the cfg-file has an effect on the Yolo-training
This commit is contained in:
parent
cd8a3dcb4c
commit
a2071e1585
|
@ -238,16 +238,17 @@ layer parse_region(list *options, size_params params)
|
|||
int coords = option_find_int(options, "coords", 4);
|
||||
int classes = option_find_int(options, "classes", 20);
|
||||
int num = option_find_int(options, "num", 1);
|
||||
int max_boxes = option_find_int_quiet(options, "max", 30);
|
||||
|
||||
layer l = make_region_layer(params.batch, params.w, params.h, num, classes, coords);
|
||||
layer l = make_region_layer(params.batch, params.w, params.h, num, classes, coords, max_boxes);
|
||||
assert(l.outputs == params.inputs);
|
||||
|
||||
l.log = option_find_int_quiet(options, "log", 0);
|
||||
l.sqrt = option_find_int_quiet(options, "sqrt", 0);
|
||||
|
||||
l.small_object = option_find_int(options, "small_object", 0);
|
||||
l.small_object = option_find_int_quiet(options, "small_object", 0);
|
||||
l.softmax = option_find_int(options, "softmax", 0);
|
||||
l.max_boxes = option_find_int_quiet(options, "max",30);
|
||||
//l.max_boxes = option_find_int_quiet(options, "max",30);
|
||||
l.jitter = option_find_float(options, "jitter", .2);
|
||||
l.rescore = option_find_int_quiet(options, "rescore",0);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#define DOABS 1
|
||||
|
||||
region_layer make_region_layer(int batch, int w, int h, int n, int classes, int coords)
|
||||
region_layer make_region_layer(int batch, int w, int h, int n, int classes, int coords, int max_boxes)
|
||||
{
|
||||
region_layer l = {0};
|
||||
l.type = REGION;
|
||||
|
@ -27,7 +27,8 @@ region_layer make_region_layer(int batch, int w, int h, int n, int classes, int
|
|||
l.bias_updates = calloc(n*2, sizeof(float));
|
||||
l.outputs = h*w*n*(classes + coords + 1);
|
||||
l.inputs = l.outputs;
|
||||
l.truths = 30*(5);
|
||||
l.max_boxes = max_boxes;
|
||||
l.truths = max_boxes*(5);
|
||||
l.delta = calloc(batch*l.outputs, sizeof(float));
|
||||
l.output = calloc(batch*l.outputs, sizeof(float));
|
||||
int i;
|
||||
|
@ -187,7 +188,7 @@ void forward_region_layer(const region_layer l, network_state state)
|
|||
for (b = 0; b < l.batch; ++b) {
|
||||
if(l.softmax_tree){
|
||||
int onlyclass = 0;
|
||||
for(t = 0; t < 30; ++t){
|
||||
for(t = 0; t < l.max_boxes; ++t){
|
||||
box truth = float_to_box(state.truth + t*5 + b*l.truths);
|
||||
if(!truth.x) break;
|
||||
int class = state.truth[t*5 + b*l.truths + 4];
|
||||
|
@ -219,7 +220,7 @@ void forward_region_layer(const region_layer l, network_state state)
|
|||
box pred = get_region_box(l.output, l.biases, n, index, i, j, l.w, l.h);
|
||||
float best_iou = 0;
|
||||
int best_class = -1;
|
||||
for(t = 0; t < 30; ++t){
|
||||
for(t = 0; t < l.max_boxes; ++t){
|
||||
box truth = float_to_box(state.truth + t*5 + b*l.truths);
|
||||
if(!truth.x) break;
|
||||
float iou = box_iou(pred, truth);
|
||||
|
@ -256,7 +257,7 @@ void forward_region_layer(const region_layer l, network_state state)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(t = 0; t < 30; ++t){
|
||||
for(t = 0; t < l.max_boxes; ++t){
|
||||
box truth = float_to_box(state.truth + t*5 + b*l.truths);
|
||||
|
||||
if(!truth.x) break;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
typedef layer region_layer;
|
||||
|
||||
region_layer make_region_layer(int batch, int h, int w, int n, int classes, int coords);
|
||||
region_layer make_region_layer(int batch, int h, int w, int n, int classes, int coords, int max_boxes);
|
||||
void forward_region_layer(const region_layer l, network_state state);
|
||||
void backward_region_layer(const region_layer l, network_state state);
|
||||
void get_region_boxes(layer l, int w, int h, float thresh, float **probs, box *boxes, int only_objectness, int *map);
|
||||
|
|
Loading…
Reference in New Issue