You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/16 06:32:21 UTC

[GitHub] edmBernard commented on issue #1302: Draw Validation Curves

edmBernard commented on issue #1302: Draw Validation Curves
URL: https://github.com/apache/incubator-mxnet/issues/1302#issuecomment-322679127
 
 
   an old thread, there is two solution now : 
   1. parsing log as proposed here, with a script like that : 
   ```python
   import argparse
   import re
   
   import matplotlib.pyplot as plt
   import numpy as np
   
   
   def main():
       plt.style.use('seaborn-whitegrid')
       parser = argparse.ArgumentParser()
       parser.add_argument("--file", help="log file", required=True)
       clo = parser.parse_args()
   
       res_train = []
       res_test = []
       with open(clo.file, 'r') as f:
           for line in f:
               match = re.search(r"mAP ([a-z]+).*:[\W]*([0-9\.]+)", line)
               if match:
                   if match.group(1) == "train":
                       res_train += [float(match.group(2))]
                   elif match.group(1) == "test":
                       res_test += [float(match.group(2))]
   
       fig, ax = plt.subplots()
       ax.plot(res_train, label="Train")
       ax.plot(res_test, label="Test")
       ax.set_xlabel("Iteration")
       ax.set_ylabel("mAP")
       ax.set_title("Accuracy")
       ax.set_ylim([0, 1])
       ax.set_xlim([0, len(res_train)])
       ax.legend(loc=4)
       plt.show()
   
   if __name__ == '__main__':
       main()
   ```
   The matching line have this form : 
   `mAP train : 0.9876543` or `mAP test : 0.9876543`
   
   2. the second method you can use tensorboard : https://github.com/dmlc/tensorboard
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services