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

Function run_detector

yolo_detector/darknet_opt/examples/detector.c:639–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637}
638
639void run_detector(int argc, char **argv)
640{
641 char *prefix = find_char_arg(argc, argv, "-prefix", 0);
642 float thresh = find_float_arg(argc, argv, "-thresh", .24);
643 float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
644 int cam_index = find_int_arg(argc, argv, "-c", 0);
645 int frame_skip = find_int_arg(argc, argv, "-s", 0);
646 int avg = find_int_arg(argc, argv, "-avg", 3);
647 if(argc < 4){
648 fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
649 return;
650 }
651 char *gpu_list = find_char_arg(argc, argv, "-gpus", 0);
652 char *outfile = find_char_arg(argc, argv, "-out", 0);
653 int *gpus = 0;
654 int gpu = 0;
655 int ngpus = 0;
656 if(gpu_list){
657 printf("%s\n", gpu_list);
658 int len = strlen(gpu_list);
659 ngpus = 1;
660 int i;
661 for(i = 0; i < len; ++i){
662 if (gpu_list[i] == ',') ++ngpus;
663 }
664 gpus = calloc(ngpus, sizeof(int));
665 for(i = 0; i < ngpus; ++i){
666 gpus[i] = atoi(gpu_list);
667 gpu_list = strchr(gpu_list, ',')+1;
668 }
669 } else {
670 gpu = gpu_index;
671 gpus = &gpu;
672 ngpus = 1;
673 }
674
675 int clear = find_arg(argc, argv, "-clear");
676 int fullscreen = find_arg(argc, argv, "-fullscreen");
677 int width = find_int_arg(argc, argv, "-w", 0);
678 int height = find_int_arg(argc, argv, "-h", 0);
679 int fps = find_int_arg(argc, argv, "-fps", 0);
680
681 char *datacfg = argv[3];
682 char *cfg = argv[4];
683 char *weights = (argc > 5) ? argv[5] : 0;
684 char *filename = (argc > 6) ? argv[6]: 0;
685 if(0==strcmp(argv[2], "test")) test_detector(datacfg, cfg, weights, filename, thresh, hier_thresh, outfile, fullscreen);
686 else if(0==strcmp(argv[2], "train")) train_detector(datacfg, cfg, weights, gpus, ngpus, clear);
687 else if(0==strcmp(argv[2], "valid")) validate_detector(datacfg, cfg, weights, outfile);
688 else if(0==strcmp(argv[2], "valid2")) validate_detector_flip(datacfg, cfg, weights, outfile);
689 else if(0==strcmp(argv[2], "recall")) validate_detector_recall(cfg, weights);
690 else if(0==strcmp(argv[2], "demo")) {
691 list *options = read_data_cfg(datacfg);
692 int classes = option_find_int(options, "classes", 20);
693 char *name_list = option_find_str(options, "names", "data/names.list");
694 char **names = get_labels(name_list);
695 demo(cfg, weights, thresh, cam_index, filename, names, classes, frame_skip, prefix, avg, hier_thresh, width, height, fps, fullscreen);
696 }

Callers 1

mainFunction · 0.85

Calls 14

find_char_argFunction · 0.85
find_float_argFunction · 0.85
find_int_argFunction · 0.85
find_argFunction · 0.85
test_detectorFunction · 0.85
train_detectorFunction · 0.85
validate_detectorFunction · 0.85
validate_detector_flipFunction · 0.85
validate_detector_recallFunction · 0.85
read_data_cfgFunction · 0.85
option_find_intFunction · 0.85
option_find_strFunction · 0.85

Tested by

no test coverage detected