:charizard: :charizard: :charizard:

This commit is contained in:
Joseph Redmon 2016-11-05 17:27:31 -07:00
parent c14514fbc5
commit 252e3b1916
3 changed files with 8 additions and 5 deletions

View File

@ -117,6 +117,7 @@ struct layer{
float class_scale;
int bias_match;
int random;
float thresh;
int dontload;
int dontloadscales;

View File

@ -267,6 +267,8 @@ layer parse_region(list *options, size_params params)
l.jitter = option_find_float(options, "jitter", .2);
l.rescore = option_find_int_quiet(options, "rescore",0);
l.thresh = option_find_float(options, "thresh", .5);
l.coord_scale = option_find_float(options, "coord_scale", 1);
l.object_scale = option_find_float(options, "object_scale", 1);
l.noobject_scale = option_find_float(options, "noobject_scale", 1);

View File

@ -141,7 +141,7 @@ void forward_region_layer(const region_layer l, network_state state)
}
avg_anyobj += l.output[index + 4];
l.delta[index + 4] = l.noobject_scale * ((0 - l.output[index + 4]) * logistic_gradient(l.output[index + 4]));
if(best_iou > .5) l.delta[index + 4] = 0;
if(best_iou > l.thresh) l.delta[index + 4] = 0;
if(*(state.net.seen) < 12800){
box truth = {0};
@ -171,7 +171,7 @@ void forward_region_layer(const region_layer l, network_state state)
box truth_shift = truth;
truth_shift.x = 0;
truth_shift.y = 0;
printf("index %d %d\n",i, j);
//printf("index %d %d\n",i, j);
for(n = 0; n < l.n; ++n){
int index = size*(j*l.w*l.n + i*l.n + n) + b*l.outputs;
box pred = get_region_box(l.output, l.biases, n, index, i, j, l.w, l.h);
@ -179,7 +179,7 @@ void forward_region_layer(const region_layer l, network_state state)
pred.w = l.biases[2*n];
pred.h = l.biases[2*n+1];
}
printf("pred: (%f, %f) %f x %f\n", pred.x, pred.y, pred.w, pred.h);
//printf("pred: (%f, %f) %f x %f\n", pred.x, pred.y, pred.w, pred.h);
pred.x = 0;
pred.y = 0;
float iou = box_iou(pred, truth_shift);
@ -189,7 +189,7 @@ void forward_region_layer(const region_layer l, network_state state)
best_n = n;
}
}
printf("%d %f (%f, %f) %f x %f\n", best_n, best_iou, truth.x, truth.y, truth.w, truth.h);
//printf("%d %f (%f, %f) %f x %f\n", best_n, best_iou, truth.x, truth.y, truth.w, truth.h);
float iou = delta_region_box(truth, l.output, l.biases, best_n, best_index, i, j, l.w, l.h, l.delta, l.coord_scale);
if(iou > .5) recall += 1;
@ -230,7 +230,7 @@ void forward_region_layer(const region_layer l, network_state state)
++count;
}
}
printf("\n");
//printf("\n");
reorg(l.delta, l.w*l.h, size*l.n, l.batch, 0);
*(l.cost) = pow(mag_array(l.delta, l.outputs * l.batch), 2);
printf("Region Avg IOU: %f, Class: %f, Obj: %f, No Obj: %f, Avg Recall: %f, count: %d\n", avg_iou/count, avg_cat/count, avg_obj/count, avg_anyobj/(l.w*l.h*l.n*l.batch), recall/count, count);