未验证 提交 fd0c9b94 编写于 作者: J JiaQi Xu 提交者: GitHub

Update loss.py

上级 27a50a58
...@@ -7,7 +7,7 @@ from nets.ious import box_ciou ...@@ -7,7 +7,7 @@ from nets.ious import box_ciou
# 平滑标签 # 平滑标签
#---------------------------------------------------# #---------------------------------------------------#
def _smooth_labels(y_true, label_smoothing): 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()) label_smoothing = K.constant(label_smoothing, dtype=K.floatx())
return y_true * (1.0 - label_smoothing) + label_smoothing / num_classes return y_true * (1.0 - label_smoothing) + label_smoothing / num_classes
#---------------------------------------------------# #---------------------------------------------------#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册