1、问题描述
在caffe中微调自己的模型时,将日志文件保存为log.txt,再对其进行解析,绘制accuracy及loss曲线;
2、matlab实现
clc;
clear;
% load the log file of caffe model
fid = fopen('log.txt', 'r');
tline = fgetl(fid);
%get arrays to draw figures
accuracyIter = [0]; %accuracy横坐标
accuracyArray = [0]; %accuracy纵坐标
lossIter = [0]; %loss横坐标
lossArray = [0]; %loss纵坐标
%record the last line
lastLine = '';
%read line
while ischar(tline)
%%%%%%%%%%%%%% the accuracy line %%%%%%%%%%%%%%
k = strfind(tline, 'Test net output');
if (k)
k = strfind(tline, 'accuracy');
if (k)
% If the string contain test and accuracy at the same time
% The bias from 'accur