caffe学习笔记13-caffe写训练日志
2017-03-05 12:47
253 查看
caffe写训练日志(output.m)
在train的时候最后加 tee $folder_prefix/caffe.log,就可以重定向到文件夹了。
1. 你可以从系统 /tmp 文件夹获取,名字是什么 caffe.ubuntu.username.log.INFO.....之类。(参考output.m)
2. 在train的时候最后加 2>&1 | tee $folder_prefix/caffe.log,就可以重定向到文件夹了。
output.m:
% Well, this is a function that write the
% iteration vs accurancy
% iteration vs loss
% To a file
clc;
clear;
% log file of caffe model caffe.nielsen-HP-Z230-SFF-Workstation.nielsen.log.INFO.20160725-115237.8174
logName = '/tmp/caffe.nielsen-HP-Z230-SFF-Workstation.nielsen.log.INFO.20160725-115237.8174';
fid = fopen(logName, 'r');
fid_accuracy = fopen('output_accuracy.txt', 'w');
fid_loss = fopen('output_loss.txt', 'w');
tline = fgetl(fid);
str_accuracy ='';
str_index_accuracy = ''
while ischar(tline)
% Then find the loss line
k1 = strfind(tline, 'Iteration');
if (k1)
k2 = strfind(tline, 'loss');
if (k2)
indexStart = k2 + 7;
indexEnd = size(tline);
str1 = tline(indexStart:indexEnd(2));
indexStart = k1 + 10;
indexEnd = strfind(tline, ',') - 1;
str2 = tline(indexStart:indexEnd);
res_str1 = strcat(str2, '/', str1);
fprintf(fid_loss, '%s\r\n', res_str1);
end
end
% first get the number of Testing net index
k = strfind(tline, 'Testing net (#0)');
if (k)
k = strfind(tline, 'Iteration');
if(k)
indexStart = k + 10;
indexEnd = strfind(tline, ',');
str_index_accuracy = tline(indexStart : indexEnd - 1);
% second If the string contain test and accuracy at the same time
% The bias from 'accuracy' to the float number
tline = fgetl(fid);
l = strfind(tline, 'accuracy');
indexStart = l + 11;
indexEnd = size(tline);
str_accuracy = tline(indexStart : indexEnd(2));
end
% third Concatenation of two string
res_str = strcat(str_index_accuracy, '/', str_accuracy);
fprintf(fid_accuracy, '%s\r\n', res_str);
end
tline = fgetl(fid);
end
fclose(fid);
fclose(fid_accuracy);
在train的时候最后加 tee $folder_prefix/caffe.log,就可以重定向到文件夹了。
1. 你可以从系统 /tmp 文件夹获取,名字是什么 caffe.ubuntu.username.log.INFO.....之类。(参考output.m)
2. 在train的时候最后加 2>&1 | tee $folder_prefix/caffe.log,就可以重定向到文件夹了。
output.m:
% Well, this is a function that write the
% iteration vs accurancy
% iteration vs loss
% To a file
clc;
clear;
% log file of caffe model caffe.nielsen-HP-Z230-SFF-Workstation.nielsen.log.INFO.20160725-115237.8174
logName = '/tmp/caffe.nielsen-HP-Z230-SFF-Workstation.nielsen.log.INFO.20160725-115237.8174';
fid = fopen(logName, 'r');
fid_accuracy = fopen('output_accuracy.txt', 'w');
fid_loss = fopen('output_loss.txt', 'w');
tline = fgetl(fid);
str_accuracy ='';
str_index_accuracy = ''
while ischar(tline)
% Then find the loss line
k1 = strfind(tline, 'Iteration');
if (k1)
k2 = strfind(tline, 'loss');
if (k2)
indexStart = k2 + 7;
indexEnd = size(tline);
str1 = tline(indexStart:indexEnd(2));
indexStart = k1 + 10;
indexEnd = strfind(tline, ',') - 1;
str2 = tline(indexStart:indexEnd);
res_str1 = strcat(str2, '/', str1);
fprintf(fid_loss, '%s\r\n', res_str1);
end
end
% first get the number of Testing net index
k = strfind(tline, 'Testing net (#0)');
if (k)
k = strfind(tline, 'Iteration');
if(k)
indexStart = k + 10;
indexEnd = strfind(tline, ',');
str_index_accuracy = tline(indexStart : indexEnd - 1);
% second If the string contain test and accuracy at the same time
% The bias from 'accuracy' to the float number
tline = fgetl(fid);
l = strfind(tline, 'accuracy');
indexStart = l + 11;
indexEnd = size(tline);
str_accuracy = tline(indexStart : indexEnd(2));
end
% third Concatenation of two string
res_str = strcat(str_index_accuracy, '/', str_accuracy);
fprintf(fid_accuracy, '%s\r\n', res_str);
end
tline = fgetl(fid);
end
fclose(fid);
fclose(fid_accuracy);
相关文章推荐
- 【caffe学习笔记二】学习搭建自己的网络 MNIST 在 caffe 上进行训练与学习
- Caffe学习笔记13:数据可视化环境(python接口)配置
- Caffe学习笔记3——制作并训练自己的数据集
- 薛开宇学习笔记一之总结笔记(CIFAR-10 在 在 caffe 上进行训练与学习)--Linux语法总结
- caffe学习笔记4-- 手写数字mnist训练过程
- 薛开宇学习笔记二之总结笔记--caffe imagenet训练中train_val.prototxt中数据层及其参数设置
- 深度学习Caffe实战笔记(20)Windows平台 Faster-RCNN 训练自己的数据集
- caffe学习(2)------caffe训练日志
- caffe学习笔记:mnist数据集的训练和测试
- 深度学习21天实战caffe学习笔记《13:Caffe 实用工具》
- 深度学习caffe实战笔记(13)利用MATLAB可视化mnist数据集
- 【深度学习】笔记13 win10+cuda7.5+caffe+vs2013环境搭建(GPU版本)
- Caffe_Windows学习笔记(五)用训练好的caffemodel来进行分类
- 【深度学习】【caffe实用工具4】笔记26 windows下使用Caffe中的源代码进行【训练】和【预测】
- Caffe学习笔记(一):CIFRA-10在Caffe上进行训练学习
- caffe学习笔记2-caffe命令行训练与测试
- caffe学习笔记4-matcaffe训练与测试
- 深度学习Caffe实战笔记(21)Windows平台 Faster-RCNN 训练好的模型测试数据
- caffe学习笔记4:训练自己数据的完整流程
- caffe学习笔记之Caffe for Windows 训练cifar10