Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hello,
I am using monai librairy for segmentation and I've been looking for the cleanest way to log at each epoch:

  • mean loss computation on train dataset
  • mean metrics computations on train dataset
  • mean loss computation on eval dataset
  • mean metrics computations on eval dataset
  • learning rate

I am using engine SupervisedTrainer and SupervisedEvaluator and the trickest part is that the output_transforms are different for loss computation (no postprocessing) and metrics computation (activation + asdiscrete).
Also I coudn't manage to get the loss values into the csv.

A typical csv file sould contain the following columns (if we use the MeanDice metric for exemple)

Epoch | MeanDice_train | MeanDice_eval | Loss_train | Loss_eval |

Thank you so much for your help.

Anaïs

You must be logged in to vote

Replies: 1 comment

Comment options

Hi @anais2390 you can use the MetricLogger class to capture all the metric and loss data during training and evaluation, probably with two separate instances. These will capture the values which can then be used to fill in a csv file afterward. You can also use event handlers to trigger at the end of an epoch to record the learning rate to a data structure somewhere, something like this:

opt = SomeOptimizer()
epoch_lrs=[]
...

@trainer.on(Events.EPOCH_COMPLETED)
def get_lr(engine):
    epoch_lrs.append(opt.lr)
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.