MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / parse_region

Function parse_region

yolo_detector/darknet_opt/src/parser.c:274–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274layer parse_region(list *options, size_params params)
275{
276 int coords = option_find_int(options, "coords", 4);
277 int classes = option_find_int(options, "classes", 20);
278 int num = option_find_int(options, "num", 1);
279
280 layer l = make_region_layer(params.batch, params.w, params.h, num, classes, coords);
281 assert(l.outputs == params.inputs);
282
283 l.log = option_find_int_quiet(options, "log", 0);
284 l.sqrt = option_find_int_quiet(options, "sqrt", 0);
285
286 l.softmax = option_find_int(options, "softmax", 0);
287 l.background = option_find_int_quiet(options, "background", 0);
288 l.max_boxes = option_find_int_quiet(options, "max",30);
289 l.jitter = option_find_float(options, "jitter", .2);
290 l.rescore = option_find_int_quiet(options, "rescore",0);
291
292 l.thresh = option_find_float(options, "thresh", .5);
293 l.classfix = option_find_int_quiet(options, "classfix", 0);
294 l.absolute = option_find_int_quiet(options, "absolute", 0);
295 l.random = option_find_int_quiet(options, "random", 0);
296
297 l.coord_scale = option_find_float(options, "coord_scale", 1);
298 l.object_scale = option_find_float(options, "object_scale", 1);
299 l.noobject_scale = option_find_float(options, "noobject_scale", 1);
300 l.mask_scale = option_find_float(options, "mask_scale", 1);
301 l.class_scale = option_find_float(options, "class_scale", 1);
302 l.bias_match = option_find_int_quiet(options, "bias_match",0);
303
304 char *tree_file = option_find_str(options, "tree", 0);
305 if (tree_file) l.softmax_tree = read_tree(tree_file);
306 char *map_file = option_find_str(options, "map", 0);
307 if (map_file) l.map = read_map(map_file);
308
309 char *a = option_find_str(options, "anchors", 0);
310 if(a){
311 int len = strlen(a);
312 int n = 1;
313 int i;
314 for(i = 0; i < len; ++i){
315 if (a[i] == ',') ++n;
316 }
317 for(i = 0; i < n; ++i){
318 float bias = atof(a);
319 l.biases[i] = bias;
320 a = strchr(a, ',')+1;
321 }
322 }
323 return l;
324}
325detection_layer parse_detection(list *options, size_params params)
326{
327 int coords = option_find_int(options, "coords", 1);

Callers 1

parse_network_cfgFunction · 0.85

Calls 7

option_find_intFunction · 0.85
make_region_layerFunction · 0.85
option_find_int_quietFunction · 0.85
option_find_floatFunction · 0.85
option_find_strFunction · 0.85
read_treeFunction · 0.85
read_mapFunction · 0.85

Tested by

no test coverage detected