From cdd1cb0e8c4fda3671714bb5ad6ba1825cff16d1 Mon Sep 17 00:00:00 2001
From: Puneet Kohli <punkohl@gmail.com>
Date: Sun, 06 May 2018 21:45:26 +0000
Subject: [PATCH] Change matplotlib backend to 'agg' when 'show_plot' is false. This allows the script to be run from command line without any errors (for ex, on a remote machine)
---
src/yolo.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/yolo.c b/src/yolo.c
index 289a6cc..238454e 100644
--- a/src/yolo.c
+++ b/src/yolo.c
@@ -191,7 +191,7 @@
int w = val[t].w;
int h = val[t].h;
get_detection_boxes(l, w, h, thresh, probs, boxes, 0);
- if (nms) do_nms_sort(boxes, probs, l.side*l.side*l.n, classes, iou_thresh);
+ if (nms) do_nms_sort_v2(boxes, probs, l.side*l.side*l.n, classes, iou_thresh);
print_yolo_detections(fps, id, boxes, probs, l.side*l.side*l.n, classes, w, h);
free(id);
free_image(val[t]);
@@ -322,7 +322,7 @@
network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
get_detection_boxes(l, 1, 1, thresh, probs, boxes, 0);
- if (nms) do_nms_sort(boxes, probs, l.side*l.side*l.n, l.classes, nms);
+ if (nms) do_nms_sort_v2(boxes, probs, l.side*l.side*l.n, l.classes, nms);
//draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, alphabet, 20);
draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, alphabet, 20);
save_image(im, "predictions");
@@ -340,8 +340,12 @@
void run_yolo(int argc, char **argv)
{
+ int dont_show = find_arg(argc, argv, "-dont_show");
+ int http_stream_port = find_int_arg(argc, argv, "-http_port", -1);
+ char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *prefix = find_char_arg(argc, argv, "-prefix", 0);
float thresh = find_float_arg(argc, argv, "-thresh", .2);
+ float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
if(argc < 4){
@@ -356,5 +360,6 @@
else if(0==strcmp(argv[2], "train")) train_yolo(cfg, weights);
else if(0==strcmp(argv[2], "valid")) validate_yolo(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_yolo_recall(cfg, weights);
- else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, voc_names, 20, frame_skip, prefix);
+ else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, hier_thresh, cam_index, filename, voc_names, 20, frame_skip,
+ prefix, out_filename, http_stream_port, dont_show);
}
--
Gitblit v1.10.0