Is there an optimizer in keras based on precision or recall instead of loss?
I am developping a segmentation neural network with only two classes, 0 and 1 (0 is the background and 1 the object that I want to find on the image). On each image, there are about 80% of 1 and 20% of 0. As you can see, the dataset is unbalanced and it makes the results wrong. My accuracy is 85% and my loss is low, but that is only because my model is good at finding the background ! I would like to base the optimizer on another metric, like precision or recall which is more usefull in this case. Does anyone know how to implement this ? Alexis as our comment were not clear enough, let me give