From 6d5addd1764a61ddb1877fe7b06d0429cab6b9d8 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Tue, 1 Dec 2020 17:28:28 +0300 Subject: [PATCH] Fixed new_coords=1 scale_x_y = 2.0 for yolov4x-mish.cfg and yolov4-csp.cfg --- build/darknet/x64/cfg/yolov4-csp.cfg | 5 ++++- build/darknet/x64/cfg/yolov4x-mish.cfg | 5 ++++- cfg/yolov4-csp.cfg | 5 ++++- cfg/yolov4x-mish.cfg | 5 ++++- src/yolo_layer.c | 8 ++++---- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/build/darknet/x64/cfg/yolov4-csp.cfg b/build/darknet/x64/cfg/yolov4-csp.cfg index 2d1f9c21..1c977dd2 100644 --- a/build/darknet/x64/cfg/yolov4-csp.cfg +++ b/build/darknet/x64/cfg/yolov4-csp.cfg @@ -26,7 +26,7 @@ mosaic=1 letter_box=1 -optimized_memory=1 +#optimized_memory=1 #23:104x104 54:52x52 85:26x26 104:13x13 for 416 @@ -1032,6 +1032,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=0 ignore_thresh = .7 truth_thresh = 1 @@ -1145,6 +1146,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 @@ -1258,6 +1260,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 diff --git a/build/darknet/x64/cfg/yolov4x-mish.cfg b/build/darknet/x64/cfg/yolov4x-mish.cfg index 0e9fb441..2e6779ca 100644 --- a/build/darknet/x64/cfg/yolov4x-mish.cfg +++ b/build/darknet/x64/cfg/yolov4x-mish.cfg @@ -26,7 +26,7 @@ mosaic=1 letter_box=1 -optimized_memory=1 +#optimized_memory=1 [convolutional] batch_normalize=1 @@ -1159,6 +1159,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=0 ignore_thresh = .7 truth_thresh = 1 @@ -1288,6 +1289,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 @@ -1417,6 +1419,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 diff --git a/cfg/yolov4-csp.cfg b/cfg/yolov4-csp.cfg index 2d1f9c21..1c977dd2 100644 --- a/cfg/yolov4-csp.cfg +++ b/cfg/yolov4-csp.cfg @@ -26,7 +26,7 @@ mosaic=1 letter_box=1 -optimized_memory=1 +#optimized_memory=1 #23:104x104 54:52x52 85:26x26 104:13x13 for 416 @@ -1032,6 +1032,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=0 ignore_thresh = .7 truth_thresh = 1 @@ -1145,6 +1146,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 @@ -1258,6 +1260,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 diff --git a/cfg/yolov4x-mish.cfg b/cfg/yolov4x-mish.cfg index 0e9fb441..2e6779ca 100644 --- a/cfg/yolov4x-mish.cfg +++ b/cfg/yolov4x-mish.cfg @@ -26,7 +26,7 @@ mosaic=1 letter_box=1 -optimized_memory=1 +#optimized_memory=1 [convolutional] batch_normalize=1 @@ -1159,6 +1159,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=0 ignore_thresh = .7 truth_thresh = 1 @@ -1288,6 +1289,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 @@ -1417,6 +1419,7 @@ anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 4 classes=80 num=9 jitter=.1 +scale_x_y = 2.0 objectness_smooth=1 ignore_thresh = .7 truth_thresh = 1 diff --git a/src/yolo_layer.c b/src/yolo_layer.c index b8f7a23f..fa0f8e93 100644 --- a/src/yolo_layer.c +++ b/src/yolo_layer.c @@ -138,8 +138,8 @@ box get_yolo_box(float *x, float *biases, int n, int index, int i, int j, int lw // w = ln(t.w * net.w / anchors_w); // w - output of previous conv-layer // h = ln(t.h * net.h / anchors_h); // h - output of previous conv-layer if (new_coords) { - b.x = (i + x[index + 0 * stride] * 2 - 0.5) / lw; - b.y = (j + x[index + 1 * stride] * 2 - 0.5) / lh; + b.x = (i + x[index + 0 * stride]) / lw; + b.y = (j + x[index + 1 * stride]) / lh; b.w = x[index + 2 * stride] * x[index + 2 * stride] * 4 * biases[2 * n] / w; b.h = x[index + 3 * stride] * x[index + 3 * stride] * 4 * biases[2 * n + 1] / h; } @@ -197,8 +197,8 @@ ious delta_yolo_box(box truth, float *x, float *biases, int n, int index, int i, float th = log(truth.h*h / biases[2 * n + 1]); if (new_coords) { - tx = (truth.x*lw - i + 0.5) / 2; - ty = (truth.y*lh - j + 0.5) / 2; + //tx = (truth.x*lw - i + 0.5) / 2; + //ty = (truth.y*lh - j + 0.5) / 2; tw = sqrt(truth.w*w / (4 * biases[2 * n])); th = sqrt(truth.h*h / (4 * biases[2 * n + 1])); }