custom keras loss function for counting non zero or one values
问题 I have a cost function in Keras which has 3 parts related to the different output of my network. suppose this is my loss function: aL1+bL2+cL3 that L1 is mse, L2 is binary cross-entropy and L3 try to make minimum the number of pixels in the output that does not have value 0 or 1(∑n (x≠0 or x≠1)) , but I do not know how can I make the last loss function?!( a,b and c are coefficients for each loss functions) The output should be a 28x28 binary image which values are 0 or 1. by adding this term