I am trying to build a CNN for classifying multiple objects in images. I'm on keras and I use the COCO dataset. my net takes in input a 256x256 image and outputs the vector of the predictions of each label.
Initially, I used a binary cross entropy as a loss function, but in this way function the network assigns to all the labels of the instances the value 0 (object not present).
To solve the problem I tried to use the weighed binary cross entropy as loss funtion, where the weight given to a label corresponds to its inverse frequency. With this change the network continues to predict all 0.
If I try to put a greater punishment on the missclassified labels with value 1, then I obtain all 1. I have used different combinations of hyperparameters for my network, but this problem still to occur.
Can you tell me where I'm wrong, or give me some advice to understand where the problem is?