Return loss information for detection models#1605
Return loss information for detection models#1605Delaunay wants to merge 5 commits intopytorch:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1605 +/- ##
=========================================
Coverage ? 65.67%
=========================================
Files ? 90
Lines ? 7083
Branches ? 1074
=========================================
Hits ? 4652
Misses ? 2125
Partials ? 306
Continue to review full report at Codecov.
|
fmassa
left a comment
There was a problem hiding this comment.
Hi,
I like the idea of this change.
It will even make it easier for making the model be torchscript-compatible, because torchscript can't handle dynamic return values.
This is unfortunately a BC-breaking change, so we can't merge this as is for now. We will be cutting a new release of torchvision in the beginning of January, and that version will have a deprecation warning saying that we will be changing the return values to be always loss, detections.
One more thing is that we now have a very unintuitive behavior: if we pass the targets, we don't compute the postprocessed predictions, but if we don't, then they are postprocessed. I think we should iterate a bit on that in January, maybe by adding a new argument to the model to postprocess the outputs.
In the meantime, the training scripts in references/detection/ are now broken because of this change, and should be fixed before merge.
|
Merged the master branch to get the Todos
|
Fix for #1574
Why:
Current code assume that loss is only useful in training mode.
This is not true, users might want validation and test loss.
How:
We replace current logic of checking for training mode by checking if targets are provided.
If targets are provided then we assume users are interested in loss.
We always return a loss dictionary even if it is empty.
This makes the API consistent and users do not have to change code between eval and training mode