Caffe accuracy and loss from the log log in Python

Source: Internet
Author: User

Import Reimport Pylab as Plimport numpy as Npif __name__== "__main__": accuracys=[] losses=[] with open (R '/home/wxl/b Nscallog.txt ', ' R ') as F:lines=f.readlines ();p rint len (lines) str= "". Join (lines) str=str.replace (' \ n ', ') Print Len (     STR) pattern1=r ' Iteration \d{4,5}, testing net \ (#0 \) \w\d{1,6} \d{2}:\d{2}:\d{2}\.\d{1,6} \d{1,6} solver\.cpp:\d{2,5}] Test NET output #0: accuracy = 0\.\d{6} ';p attern2=r ' iteration \d+, loss = 0\.\d{6} '; Accuracys=re.findall (PATTERN1,STR); l Osses=re.findall (pattern2,str);p rint len (accuracys), ' aaaa ';p rint len (losses), ' = = = ' Print Accuracys with open (R '/home /wxl/project/code/loss ', ' w+ ') as F1:for ac in Losses:f1.write (ac[10:15]) f1.write (') F1.write (ac[23:]); F1.write (' \ n ')   );‘‘‘ With open (R '/home/wxl/project/code/loss ', ' R ') as F2:lines=f2.readlines (); X=[];y=[]for line in Lines:if "," in Line:line =line.replace (', ', '); Tmp=line.strip (' \ n '). Split (') x.append (int (tmp[0))) Y.append (float (tmp[-1])) Pl.plot (x, y) Pl.show () "

Note: Python must precede the parentheses () with the transfer character \, plus a bit number to add the transpose character \

Caffe accuracy and loss from the log log in Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.