-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added cross entropy support to validation training, edited metric reporting #5255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5255 +/- ##
==========================================
+ Coverage 73.49% 73.74% +0.24%
==========================================
Files 1014 1022 +8
Lines 188680 190258 +1578
Branches 20330 20468 +138
==========================================
+ Hits 138677 140308 +1631
+ Misses 44493 44429 -64
- Partials 5510 5521 +11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The print of cross-entropy looks good to me!
I'm a little skeptical that whether we train on validation set after searching this and quote "it is training data used for testing, but neither as part of the low-level training nor as part of the final testing". It seems like this case may fall into the category of low-level training: the validation set is fixed during the training(I might be wrong because I merely draw this conclusion by looking at the screenshot that the accuracy of validation set is often higher than training set's accuracy in the second screenshot). If the validation set is not fixed(something like cross-validation) then just ignore this comment.
Hey Ye, |
@@ -170,11 +170,11 @@ public sealed class TrainMetrics | |||
public override string ToString() | |||
{ | |||
if (DatasetUsed == ImageClassificationMetrics.Dataset.Train) | |||
return $"Phase: Training, Dataset used: {DatasetUsed.ToString(),10}, Batch Processed Count: {BatchProcessedCount,3}, Learning Rate: {LearningRate,10} " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added learning rate to the end of the string here for cosmetic reasons. Now there is uniform alignment of columns' statistics between training and validation. :) #Resolved
@wangyems I have removed learning rate decay for validation from my PR, and now the accuracy statistics for before and after are the same. Now cross entropy is being reported for validation, and as it should be, there is no change in learning rates during the validation phase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Fix #4807
In this PR, I've added cross entropy metric calculation & reporting during validation training in the Image Classification Trainer. Now, validation training can obtain cross entropy values for each epoch during validation training.
I have attached below screenshots of training and validation metrics with this repro.
Before (note that learning rate is constant, even when the given

ExponentialLRDecay
is used, and cross entropy during validation is reported as 0):After:

I have also edited
ToString()
to report accuracy and cross entropy for the validation phase as well. Reporting learning rate decay during validation isn't necessary, as no learning rate decay occurs in validation.I have also added tests to verify the proper decaying of the cross-entropy rate with this PR.