I’ve model with two output layers, age and gender prediction layers. I want to assign different weight values for each output layer’s loss. I’ve the following line of code to do so.
My question is what is the effect of loss weights on performance of a model? How can I configure the loss weights so that the model can perform better on age prediction?
As stated in the book Deep Learning with Python by François Chollet:
The mean squared error (MSE) loss used for the age-regression task
typically takes a value around 3–5, whereas the crossentropy loss used
for the gender-classification task can be as low as 0.1. In such a
situation, to balance the contribution of the different losses, you
can assign a weight of 10 to the crossentropy loss and a weight of
0.25 to the MSE loss.
Answered By – Grigorios Kalliatakis