Closed hzhz2020 closed 3 years ago
The code is currently set up to log all of the data to tensorboard. The easiest way would probably be to just export the tensorboard data and process it directly.
If you must do it by modifying the code, then there are two ways you could do this:
The function eval_stats
is called each epoch, and prints to stdout the train and test accuracies. You can access that directly here
https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/train.py#L245-L246
If you need the mini-batch by mini-batch train losses, you'll need to make the model
call return the loss values
https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/mixmatch.py#L104-L107
and then will need to update train_step
https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/train.py#L135
so that it requests the new loss you add and save it to disk from there.
Thanks a lot for the helpful comments!
Dear Authors
I'm wondering is there an easy way to save the train accuracies (a list of accuracies) and test accuracies (a list of accuracies) on disk, maybe as a pkl file or npy file using your codebase? I saw that the train accuracy and test accuracy of each checkpoint are calculated with the eval_stats function, and the eval_stats function is called by the add_summaries function. I know we can use tensorboard to monitor the training progress, but I'm not sure how to save those accuracies on disk (I am also not sure which function called add_summaries and when)?
Sorry, I'm relatively new to tensorflow. It would really appreciate if you can point me to the right direction.
Many thanks!