From 5d616450a43f4b5fdf130f57cdaab105cf2563e2 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Fri, 20 Apr 2018 02:04:02 +0300 Subject: [PATCH] Usage of calc_anchors --- src/detector.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/detector.c b/src/detector.c index 082b7489..407c8beb 100644 --- a/src/detector.c +++ b/src/detector.c @@ -846,6 +846,11 @@ int anchors_comparator(const void *pa, const void *pb) void calc_anchors(char *datacfg, int num_of_clusters, int width, int height, int show) { printf("\n num_of_clusters = %d, width = %d, height = %d \n", num_of_clusters, width, height); + if (width < 0 || height < 0) { + printf("Usage: darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -height 416 \n"); + printf("Error: set width and height \n"); + return; + } //float pointsdata[] = { 1,1, 2,2, 6,6, 5,5, 10,10 }; float *rel_width_height_array = calloc(1000, sizeof(float)); @@ -1106,8 +1111,8 @@ void run_detector(int argc, char **argv) int cam_index = find_int_arg(argc, argv, "-c", 0); int frame_skip = find_int_arg(argc, argv, "-s", 0); int num_of_clusters = find_int_arg(argc, argv, "-num_of_clusters", 5); - int width = find_int_arg(argc, argv, "-width", 13); - int height = find_int_arg(argc, argv, "-height", 13); + int width = find_int_arg(argc, argv, "-width", -1); + int height = find_int_arg(argc, argv, "-height", -1); if(argc < 4){ fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]); return;