From 35a3870979e0d819208a3de7a24c39cc0539651d Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Wed, 25 Dec 2019 20:34:24 +0300 Subject: [PATCH] counters_per_class affects the objectness too --- src/gaussian_yolo_layer.c | 4 ++-- src/yolo_layer.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gaussian_yolo_layer.c b/src/gaussian_yolo_layer.c index 999e7990..477b0b84 100644 --- a/src/gaussian_yolo_layer.c +++ b/src/gaussian_yolo_layer.c @@ -506,7 +506,7 @@ void forward_gaussian_yolo_layer(const layer l, network_state state) int obj_index = entry_gaussian_index(l, b, mask_n*l.w*l.h + j*l.w + i, 8); avg_obj += l.output[obj_index]; - l.delta[obj_index] = l.cls_normalizer * (1 - l.output[obj_index]); + l.delta[obj_index] = class_multiplier * l.cls_normalizer * (1 - l.output[obj_index]); int class_index = entry_gaussian_index(l, b, mask_n*l.w*l.h + j*l.w + i, 9); delta_gaussian_yolo_class(l.output, l.delta, class_index, class_id, l.classes, l.w*l.h, &avg_cat, l.label_smooth_eps, l.classes_multipliers); @@ -539,7 +539,7 @@ void forward_gaussian_yolo_layer(const layer l, network_state state) int obj_index = entry_gaussian_index(l, b, mask_n*l.w*l.h + j*l.w + i, 8); avg_obj += l.output[obj_index]; - l.delta[obj_index] = l.cls_normalizer * (1 - l.output[obj_index]); + l.delta[obj_index] = class_multiplier * l.cls_normalizer * (1 - l.output[obj_index]); int class_index = entry_gaussian_index(l, b, mask_n*l.w*l.h + j*l.w + i, 9); delta_gaussian_yolo_class(l.output, l.delta, class_index, class_id, l.classes, l.w*l.h, &avg_cat, l.label_smooth_eps, l.classes_multipliers); diff --git a/src/yolo_layer.c b/src/yolo_layer.c index 7c7e7144..48562202 100644 --- a/src/yolo_layer.c +++ b/src/yolo_layer.c @@ -423,7 +423,7 @@ void forward_yolo_layer(const layer l, network_state state) int obj_index = entry_index(l, b, mask_n*l.w*l.h + j*l.w + i, 4); avg_obj += l.output[obj_index]; - l.delta[obj_index] = l.cls_normalizer * (1 - l.output[obj_index]); + l.delta[obj_index] = class_multiplier * l.cls_normalizer * (1 - l.output[obj_index]); int class_index = entry_index(l, b, mask_n*l.w*l.h + j*l.w + i, 4 + 1); delta_yolo_class(l.output, l.delta, class_index, class_id, l.classes, l.w*l.h, &avg_cat, l.focal_loss, l.label_smooth_eps, l.classes_multipliers); @@ -467,7 +467,7 @@ void forward_yolo_layer(const layer l, network_state state) int obj_index = entry_index(l, b, mask_n*l.w*l.h + j*l.w + i, 4); avg_obj += l.output[obj_index]; - l.delta[obj_index] = l.cls_normalizer * (1 - l.output[obj_index]); + l.delta[obj_index] = class_multiplier * l.cls_normalizer * (1 - l.output[obj_index]); int class_index = entry_index(l, b, mask_n*l.w*l.h + j*l.w + i, 4 + 1); delta_yolo_class(l.output, l.delta, class_index, class_id, l.classes, l.w*l.h, &avg_cat, l.focal_loss, l.label_smooth_eps, l.classes_multipliers);