From fd0c9b94f43200d7bc53ff7a907f1a845be7cf3d Mon Sep 17 00:00:00 2001 From: JiaQi Xu <47347516+bubbliiiing@users.noreply.github.com> Date: Wed, 20 May 2020 23:36:16 +0800 Subject: [PATCH] Update loss.py --- nets/loss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nets/loss.py b/nets/loss.py index 43b54ed..8de636c 100644 --- a/nets/loss.py +++ b/nets/loss.py @@ -7,7 +7,7 @@ from nets.ious import box_ciou # 平滑标签 #---------------------------------------------------# def _smooth_labels(y_true, label_smoothing): - num_classes = K.shape(y_true)[-1] + num_classes = tf.cast(K.shape(y_true)[-1], dtype=K.floatx()) label_smoothing = K.constant(label_smoothing, dtype=K.floatx()) return y_true * (1.0 - label_smoothing) + label_smoothing / num_classes #---------------------------------------------------# -- GitLab