qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.44k forks source link

is there any wrong about the confidence loss? #694

Open ztfmars opened 4 years ago

ztfmars commented 4 years ago

origin: *confidence_loss = object_mask K.binary_crossentropy(object_mask, raw_pred[...,4:5], from_logits=True)+ (1-object_mask) K.binary_crossentropy(object_mask, raw_pred[...,4:5], from_logits=True) ignore_mask**

i think , it means the different cross entroypy value of labels = 1 and labels=0. so the equation should be

_1x binary_crossentropy(lable=1, pred) + (1-0)xignore_maskxbinarycrossentropy(label=0, pred)

so the confidence loss may should be like following:

confidence_loss = object_mask K.binary_crossentropy(object_mask, raw_pred[...,4:5], from_logits=True)+ \ (1-object_mask) K.binary_crossentropy((1-object_mask), raw_pred[...,4:5], from_logits=True) * ignore_mask

MrSouwbauck commented 3 years ago

the second part of the equation is to verify that you don't detect any object when there is not. So when object_mask is equal to 0, raw_pred[] should too. So the equation seems correct.