From 726cebd3fb67d65ec6d2d49fa6bfba4c053085df Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Mon, 2 Apr 2018 15:02:53 +0300 Subject: [PATCH] Fixed detector recall --- build/darknet/x64/darknet_web_cam_voc.cmd | 5 ++++- src/detector.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/darknet/x64/darknet_web_cam_voc.cmd b/build/darknet/x64/darknet_web_cam_voc.cmd index 7bed610b14d..1b509c12984 100644 --- a/build/darknet/x64/darknet_web_cam_voc.cmd +++ b/build/darknet/x64/darknet_web_cam_voc.cmd @@ -1,6 +1,9 @@ # play video from Web-Camera number 0 -darknet.exe detector demo data/voc.data cfg/yolov2-voc.cfg yolo-voc.weights -c 0 +rem darknet.exe detector demo data/voc.data cfg/yolov2-voc.cfg yolo-voc.weights -c 0 + + +darknet.exe detector demo data/coco.data cfg/yolov3.cfg yolov3.weights -c 0 pause \ No newline at end of file diff --git a/src/detector.c b/src/detector.c index 4ec62cd4cbe..a6a5a5d44ea 100644 --- a/src/detector.c +++ b/src/detector.c @@ -471,7 +471,7 @@ void validate_detector_recall(char *datacfg, char *cfgfile, char *weightfile) ++total; box t = { truth[j].x, truth[j].y, truth[j].w, truth[j].h }; float best_iou = 0; - for (k = 0; k < l.w*l.h*l.n; ++k) { + for (k = 0; k < nboxes; ++k) { float iou = box_iou(dets[k].bbox, t); if (dets[k].objectness > thresh && iou > best_iou) { best_iou = iou; @@ -828,7 +828,7 @@ int anchors_comparator(const void *pa, const void *pb) { anchors_t a = *(anchors_t *)pa; anchors_t b = *(anchors_t *)pb; - float diff = b.w - a.w; + float diff = b.w*b.h - a.w*a.h; if (diff < 0) return 1; else if (diff > 0) return -1; return 0;