EIGHT_UNBALANCE = 37def weighted_binary_crossentropy(y_true, y_pred):# Calculate the binary crossentropyb_ce = K.binary_crossentropy(y_true, y_pred)# Apply the weightsweight_vector = (y_true * WEIGHT_UNBALANCE + (1.-y_true)) / 2.weighted_b_ce = weight_vector * b_cereturn K.mean(weighted_b_ce,axis=-1)