Hello Frank,
Thanks for your answer. Yes, you are right about the clamp-log
.I have implemented it, and I am getting same error values. Just for someone need to check, this is the code:
def BCE_Loss(x, y, weight):
clamp_log_x = np.log(x)
clamp_log_x[clamp_log_x <-100] = -100
clamp_log_1_x = np.log(1-x)
clamp_log_1_x[clamp_log_1_x <-100] = -100
cal_loss = np.multiply(y, clamp_log_x) + np.multiply(1-y, clamp_log_1_x)
cal_loss = np.multiply(cal_loss, -1*weight).sum()
return cal_loss
The above function, calculate the BCE loss with weighting.