1. The first is to extract the training log file;
2. Then the MATLAB code:
clear all; close all; Clc;log_file='/home/wangxiao/downloads/43_attribute_baseline.log'; FID= fopen (Log_file,'R'); Fid_accuracy= fopen ('/home/wangxiao/downloads/output_accuracy.txt','W'); Fid_loss= fopen ('/home/wangxiao/downloads/output_loss.txt','W'); Iteration={};loss={};accuracy={};p ath='/home/wangxiao/downloads/'; Fid_= fopen ([path,'Loss_file_.txt'],'a'); while(~feof (FID)) Tline=Fgetl (FID); %%ifStrfind (Tline,'Sgd_solver.cpp:') Iter_index= Strfind (Tline,'Iteration'); Rest= Tline ((iter_index+9): End); Iter_current= Strtok (Rest,','); %iteration number; Iteration= [Iteration iter_current]; %count the iteration; Lr_index= Strfind (Tline,'lr ='); Lr_current= Tline ((lr_index+4): End); %Learning rate; End%%ifStrfind (Tline,'solver.cpp:228]') Iter_index= Strfind (Tline,'loss ='); Loss_current= Tline ((iter_index+7): End); fprintf (Fid_,'%s \ n', loss_current); Loss= [loss loss_current]; %count the iteration; EndifStrfind (Tline,'aver_accuracy:') Aver_accuracy_index= Strfind (Tline,'aver_accuracy:'); Aver_accuracy_current= Tline ((aver_accuracy_index+ the): End); Accuracy=[accuracy aver_accuracy_current]; EndEnd Loss_file_path= ImportData ('/home/wangxiao/downloads/loss_file_.txt'); Plot (Loss_file_path)
3. Results show:
Use MATLAB to draw the loss curve of Caffe training