Do you run
ModelCheckpoint on its default parameters (besides
ModelCheckpoint has a parameter called
mode which specifies the type of metric to be used.
mode can take 3 values
'auto' (which is the default):
min: means that you want to minimize the metric (e.g. the loss function).
max: means you want to maximize the metric (e.g. accuracy).
auto: attempts to figure what to do on its own. If you look at the code, it checks if the metric's name contains
'acc' or if it starts with
'fmeasure'. If yes it sets the mode to
max, if not it sets it to
In your case, you monitor the jaccard index, which is a metric you want maximized, so you want the mode set to
max. Normally because "jaccard" contains the string "acc", even if the mode is set to
auto it should work fine.
If however you named your metric something arbitrary (e.g.
my_metric), the default mode will be set to
min, which means that it will store the weights that achieve the least performance on your metric, which should be the weights of the first epoch.
Suggestion: next time try with
mode='max' to be sure.