diff --git a/build/darknet/x64/calc_mAP.cmd b/build/darknet/x64/calc_mAP.cmd index 614a422a..9b4fafb3 100644 --- a/build/darknet/x64/calc_mAP.cmd +++ b/build/darknet/x64/calc_mAP.cmd @@ -1,11 +1,10 @@ rem # How to calculate mAP (mean average precision) -rem darknet.exe detector map data/voc.data cfg/yolov2-tiny-voc.cfg yolov2-tiny-voc.weights +rem darknet.exe detector map data/voc.data cfg/yolov2-tiny-voc.cfg yolov2-tiny-voc.weights -11points -darknet.exe detector map data/voc.data cfg/yolov2-voc.cfg yolo-voc.weights - +darknet.exe detector map data/voc.data cfg/yolov2-voc.cfg yolo-voc.weights -11points diff --git a/include/darknet.h b/include/darknet.h index 0a1451e3..fc56a4f1 100644 --- a/include/darknet.h +++ b/include/darknet.h @@ -767,7 +767,7 @@ LIB_API layer* get_network_layer(network* net, int i); LIB_API detection *make_network_boxes(network *net, float thresh, int *num); LIB_API void reset_rnn(network *net); LIB_API float *network_predict_image(network *net, image im); -LIB_API float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, float thresh_calc_avg_iou, const float iou_thresh, network *existing_net); +LIB_API float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, float thresh_calc_avg_iou, const float iou_thresh, const int map_11_points, network *existing_net); LIB_API void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, int ngpus, int clear, int dont_show, int calc_map, int mjpeg_port); LIB_API void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, int dont_show, int ext_output, int save_labels, char *outfile); diff --git a/src/detector.c b/src/detector.c index 82a09a8e..4f421593 100644 --- a/src/detector.c +++ b/src/detector.c @@ -301,7 +301,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i //network net_combined = combine_train_valid_networks(net, net_map); iter_map = i; - mean_average_precision = validate_detector_map(datacfg, cfgfile, weightfile, 0.25, 0.5, &net_map);// &net_combined); + mean_average_precision = validate_detector_map(datacfg, cfgfile, weightfile, 0.25, 0.5, 0, &net_map);// &net_combined); printf("\n mean_average_precision (mAP@0.5) = %f \n", mean_average_precision); draw_precision = 1; } @@ -674,7 +674,7 @@ int detections_comparator(const void *pa, const void *pb) return 0; } -float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, float thresh_calc_avg_iou, const float iou_thresh, network *existing_net) +float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, float thresh_calc_avg_iou, const float iou_thresh, const int map_11_points, network *existing_net) { int j; list *options = read_data_cfg(datacfg); @@ -1420,6 +1420,7 @@ void run_detector(int argc, char **argv) int dont_show = find_arg(argc, argv, "-dont_show"); int show = find_arg(argc, argv, "-show"); int calc_map = find_arg(argc, argv, "-map"); + int map_11_points = find_arg(argc, argv, "-11points"); check_mistakes = find_arg(argc, argv, "-check_mistakes"); int mjpeg_port = find_int_arg(argc, argv, "-mjpeg_port", -1); int json_port = find_int_arg(argc, argv, "-json_port", -1); @@ -1479,7 +1480,7 @@ void run_detector(int argc, char **argv) else if (0 == strcmp(argv[2], "train")) train_detector(datacfg, cfg, weights, gpus, ngpus, clear, dont_show, calc_map, mjpeg_port); else if (0 == strcmp(argv[2], "valid")) validate_detector(datacfg, cfg, weights, outfile); else if (0 == strcmp(argv[2], "recall")) validate_detector_recall(datacfg, cfg, weights); - else if (0 == strcmp(argv[2], "map")) validate_detector_map(datacfg, cfg, weights, thresh, iou_thresh, NULL); + else if (0 == strcmp(argv[2], "map")) validate_detector_map(datacfg, cfg, weights, thresh, iou_thresh, map_11_points, NULL); else if (0 == strcmp(argv[2], "calc_anchors")) calc_anchors(datacfg, num_of_clusters, width, height, show); else if (0 == strcmp(argv[2], "demo")) { list *options = read_data_cfg(datacfg);