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

Function train_segmenter

yolo_detector/darknet_opt/examples/segmenter.c:5–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <assert.h>
4
5void train_segmenter(char *datacfg, char *cfgfile, char *weightfile, int *gpus, int ngpus, int clear, int display)
6{
7 int i;
8
9 float avg_loss = -1;
10 char *base = basecfg(cfgfile);
11 printf("%s\n", base);
12 printf("%d\n", ngpus);
13 network **nets = calloc(ngpus, sizeof(network*));
14
15 srand(time(0));
16 int seed = rand();
17 for(i = 0; i < ngpus; ++i){
18 srand(seed);
19#ifdef GPU
20 cuda_set_device(gpus[i]);
21#endif
22 nets[i] = load_network(cfgfile, weightfile, clear);
23 nets[i]->learning_rate *= ngpus;
24 }
25 srand(time(0));
26 network *net = nets[0];
27 image pred = get_network_image(net);
28
29 int div = net->w/pred.w;
30 assert(pred.w * div == net->w);
31 assert(pred.h * div == net->h);
32
33 int imgs = net->batch * net->subdivisions * ngpus;
34
35 printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);
36 list *options = read_data_cfg(datacfg);
37
38 char *backup_directory = option_find_str(options, "backup", "/backup/");
39 char *train_list = option_find_str(options, "train", "data/train.list");
40
41 list *plist = get_paths(train_list);
42 char **paths = (char **)list_to_array(plist);
43 printf("%d\n", plist->size);
44 int N = plist->size;
45 clock_t time;
46
47 load_args args = {0};
48 args.w = net->w;
49 args.h = net->h;
50 args.threads = 32;
51 args.scale = div;
52
53 args.min = net->min_crop;
54 args.max = net->max_crop;
55 args.angle = net->angle;
56 args.aspect = net->aspect;
57 args.exposure = net->exposure;
58 args.saturation = net->saturation;
59 args.hue = net->hue;
60 args.size = net->w;
61 args.classes = 80;
62

Callers 1

run_segmenterFunction · 0.85

Calls 15

basecfgFunction · 0.85
timeFunction · 0.85
cuda_set_deviceFunction · 0.85
load_networkFunction · 0.85
get_network_imageFunction · 0.85
read_data_cfgFunction · 0.85
option_find_strFunction · 0.85
get_pathsFunction · 0.85
list_to_arrayFunction · 0.85
load_dataFunction · 0.85
get_current_batchFunction · 0.85
secFunction · 0.85

Tested by

no test coverage detected