small_object can be used in [net] in cfg-file for objects 1x1 pix on FullHD image

This commit is contained in:
AlexeyAB
2018-03-30 14:32:41 +03:00
parent a7a2e1bb4b
commit 9fbd1936eb
5 changed files with 6 additions and 6 deletions

View File

@ -308,8 +308,8 @@ void fill_truth_detection(char *path, int num_boxes, float *truth, int classes,
box_label *boxes = read_boxes(labelpath, &count); box_label *boxes = read_boxes(labelpath, &count);
if (small_object == 1) { if (small_object == 1) {
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
if (boxes[i].w < 0.01) boxes[i].w = 0.01; if (boxes[i].w < 0.001F) boxes[i].w = 0.001F;
if (boxes[i].h < 0.01) boxes[i].h = 0.01; if (boxes[i].h < 0.001F) boxes[i].h = 0.001F;
} }
} }
randomize_boxes(boxes, count); 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; id = boxes[i].id;
// not detect small objects // 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+0] = x;
truth[i*5+1] = y; truth[i*5+1] = y;

View File

@ -88,7 +88,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
args.classes = classes; args.classes = classes;
args.jitter = jitter; args.jitter = jitter;
args.num_boxes = l.max_boxes; args.num_boxes = l.max_boxes;
args.small_object = l.small_object; args.small_object = net.small_object;
args.d = &buffer; args.d = &buffer;
args.type = DETECTION_DATA; args.type = DETECTION_DATA;
args.threads = 64; // 8 args.threads = 64; // 8

View File

@ -78,7 +78,6 @@ struct layer{
int out_h, out_w, out_c; int out_h, out_w, out_c;
int n; int n;
int max_boxes; int max_boxes;
int small_object;
int groups; int groups;
int size; int size;
int side; int side;

View File

@ -57,6 +57,7 @@ typedef struct network{
float exposure; float exposure;
float saturation; float saturation;
float hue; float hue;
int small_object;
int gpu_index; int gpu_index;
tree *hierarchy; tree *hierarchy;

View File

@ -311,7 +311,6 @@ layer parse_region(list *options, size_params params)
l.log = option_find_int_quiet(options, "log", 0); l.log = option_find_int_quiet(options, "log", 0);
l.sqrt = option_find_int_quiet(options, "sqrt", 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.softmax = option_find_int(options, "softmax", 0);
l.focal_loss = option_find_int_quiet(options, "focal_loss", 0); l.focal_loss = option_find_int_quiet(options, "focal_loss", 0);
//l.max_boxes = option_find_int_quiet(options, "max",30); //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->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->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->angle = option_find_float_quiet(options, "angle", 0);
net->aspect = option_find_float_quiet(options, "aspect", 1); net->aspect = option_find_float_quiet(options, "aspect", 1);
net->saturation = option_find_float_quiet(options, "saturation", 1); net->saturation = option_find_float_quiet(options, "saturation", 1);