Merge pull request #57 from lilohuang/Fix-crash-on-detect-command

Fix crash (SIGSEGV) on running ./darknet detect command
This commit is contained in:
Joseph Redmon 2017-05-14 00:24:08 -07:00 committed by GitHub
commit 2634051b17

View File

@ -9,7 +9,7 @@
#include "connected_layer.h" #include "connected_layer.h"
extern void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int top); extern void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int top);
extern void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh); extern void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile, int fullscreen);
extern void run_voxel(int argc, char **argv); extern void run_voxel(int argc, char **argv);
extern void run_yolo(int argc, char **argv); extern void run_yolo(int argc, char **argv);
extern void run_detector(int argc, char **argv); extern void run_detector(int argc, char **argv);
@ -423,7 +423,9 @@ int main(int argc, char **argv)
} else if (0 == strcmp(argv[1], "detect")){ } else if (0 == strcmp(argv[1], "detect")){
float thresh = find_float_arg(argc, argv, "-thresh", .24); float thresh = find_float_arg(argc, argv, "-thresh", .24);
char *filename = (argc > 4) ? argv[4]: 0; char *filename = (argc > 4) ? argv[4]: 0;
test_detector("cfg/coco.data", argv[2], argv[3], filename, thresh, .5); char *outfile = find_char_arg(argc, argv, "-out", 0);
int fullscreen = find_arg(argc, argv, "-fullscreen");
test_detector("cfg/coco.data", argv[2], argv[3], filename, thresh, .5, outfile, fullscreen);
} else if (0 == strcmp(argv[1], "cifar")){ } else if (0 == strcmp(argv[1], "cifar")){
run_cifar(argc, argv); run_cifar(argc, argv);
} else if (0 == strcmp(argv[1], "go")){ } else if (0 == strcmp(argv[1], "go")){