Can I use this loss function for YOLO
def myLoss(y_actual,y_pred):
a = tf.keras.losses.BinaryCrossentropy()(y_actual[:,:,:,0],y_pred[:,:,:,0])
b = tf.keras.losses.MeanSquaredError()(y_actual[:,:,:,1:], y_pred[:,:,:,1:]*y_actual[:,:,:,:1])
loss= a + b
return loss
where y_actual = [Pc,bx,by,bw,bh,c1,c2,c3]
pc = probability that one of c1,c2,c3 exists in a particular grid,
bx,by,bw,bh are bounding box parameters for a particular grid,
c1,c2,c3 are 3 classes i want to predict, eg: 0,0,1 for class 3
I read somewhere that when Pc_actual=0 the loss doesnt care about the bounding box and class prediction and so i multiplied them with Pc_actual so that when pc_actual is 0 loss corresponding to those terms are 0.
Please correct me if I am wrong