diff --git a/src/data.c b/src/data.c index 88d5720b..f087cd4e 100644 --- a/src/data.c +++ b/src/data.c @@ -308,8 +308,8 @@ void fill_truth_detection(char *path, int num_boxes, float *truth, int classes, box_label *boxes = read_boxes(labelpath, &count); if (small_object == 1) { for (i = 0; i < count; ++i) { - if (boxes[i].w < 0.01) boxes[i].w = 0.01; - if (boxes[i].h < 0.01) boxes[i].h = 0.01; + if (boxes[i].w < 0.001F) boxes[i].w = 0.001F; + if (boxes[i].h < 0.001F) boxes[i].h = 0.001F; } } randomize_boxes(boxes, count); @@ -326,7 +326,7 @@ void fill_truth_detection(char *path, int num_boxes, float *truth, int classes, id = boxes[i].id; // not detect small objects - if ((w < 0.001 || h < 0.001)) continue; + if ((w < 0.001F || h < 0.001F)) continue; truth[i*5+0] = x; truth[i*5+1] = y; diff --git a/src/detector.c b/src/detector.c index ac84c591..b588b6d4 100644 --- a/src/detector.c +++ b/src/detector.c @@ -88,7 +88,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i args.classes = classes; args.jitter = jitter; args.num_boxes = l.max_boxes; - args.small_object = l.small_object; + args.small_object = net.small_object; args.d = &buffer; args.type = DETECTION_DATA; args.threads = 64; // 8 diff --git a/src/layer.h b/src/layer.h index 91b893a4..5d55e1cb 100644 --- a/src/layer.h +++ b/src/layer.h @@ -78,7 +78,6 @@ struct layer{ int out_h, out_w, out_c; int n; int max_boxes; - int small_object; int groups; int size; int side; diff --git a/src/network.h b/src/network.h index f3bb5425..5b405c4a 100644 --- a/src/network.h +++ b/src/network.h @@ -57,6 +57,7 @@ typedef struct network{ float exposure; float saturation; float hue; + int small_object; int gpu_index; tree *hierarchy; diff --git a/src/parser.c b/src/parser.c index fd3d6913..5a111bf6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -311,7 +311,6 @@ layer parse_region(list *options, size_params params) l.log = option_find_int_quiet(options, "log", 0); l.sqrt = option_find_int_quiet(options, "sqrt", 0); - l.small_object = option_find_int_quiet(options, "small_object", 0); l.softmax = option_find_int(options, "softmax", 0); l.focal_loss = option_find_int_quiet(options, "focal_loss", 0); //l.max_boxes = option_find_int_quiet(options, "max",30); @@ -622,6 +621,7 @@ void parse_net_options(list *options, network *net) net->max_crop = option_find_int_quiet(options, "max_crop",net->w*2); net->min_crop = option_find_int_quiet(options, "min_crop",net->w); + net->small_object = option_find_int_quiet(options, "small_object", 0); net->angle = option_find_float_quiet(options, "angle", 0); net->aspect = option_find_float_quiet(options, "aspect", 1); net->saturation = option_find_float_quiet(options, "saturation", 1);