However, during training, loss is computed manually using gradient tape (instead of using keras' model.fit() function) with the following three loss values:
total_loss = giou_loss + conf_loss + prob_loss
Is it possible that we are missing regularizer loss here? I tested it by setting kernel_regularizer=None which resulted in the exact same total loss. I suggest manually adding the regularizer loss using:
def regularizer_loss(model):
"""Retrieve kernel regularizer loss from layers with kernel regularizer"""
loss = 0
for layer in model.layers:
if hasattr(layer, "kernel_regularizer") and layer.kernel_regularizer:
loss += layer.kernel_regularizer(layer.kernel)
return loss
total_loss = giou_loss + conf_loss + prob_loss + regularizer_loss(model)
In the model l2 kernel regularizers are defined
However, during training, loss is computed manually using gradient tape (instead of using keras' model.fit() function) with the following three loss values:
total_loss = giou_loss + conf_loss + prob_loss
Is it possible that we are missing regularizer loss here? I tested it by setting
kernel_regularizer=None
which resulted in the exact same total loss. I suggest manually adding the regularizer loss using: