DeepLearning: 数据处理4:将caffe训练时屏幕输出保存到文本文件(sh文件)
2016-04-27 10:53
363 查看
Tips:代码中路径记得自己替换就行了。。。
1.训练次数比较多 的时候,屏幕好多信息可能没有及时看到,所以需呀把屏幕所有的输出都保存下来。#!/usr/bin/env sh # 删除路径下的txt文件 rm -vf ~/lilai/myDL/clothes/mymodel/model/*.txt # 运行caffe,并将屏幕输出信息结果保存到指定的txt文件中 sh train.sh 2>&1 | tee ~/lilai/myDL/clothes/mymodel/model/2016.4.17_22.04.txt
2.有时候,我们只需要更具体的损失和准确率,其他的都不需要。所以可以利用gerp正则和管道,提取我们自己需要的信息。这里只是个示范,具体的结合自己的使用就行了。。。
#!/usr/bin/env sh # 删除路径下的txt文件 rm -vf ~/lilai/myDL/clothes/mymodel/model/*.txt # 运行caffe,并将屏幕输出信息结果保存到指定的txt文件中 sh train.sh 2>&1 | tee ~/lilai/myDL/clothes/mymodel/model/2016.txt # 判定上一条语句执行是否成功,成功则$? = 0 if [ $? -eq 0 ] ; then # 统计测试准确率 echo "测试迭代次数:" > Test_accuracy.txt grep -c 'accuracy =' 2016.txt >> Test_accuracy.txt echo "测试迭代间隔:" >> Test_accuracy.txt grep 'test_interval:' 2016.txt | cut -d ' ' -f 2 >> Test_accuracy.txt echo ' ' >> Test_accuracy.txt grep 'accuracy =' 2016.txt | cut -d '#' -f 2 | cut -d ' ' -f 2,3,4 >> Test_accuracy.txt # 统计训练损失 echo "训练迭代次数:" >Train_loss.txt grep -c 'Train net output #0: loss = ' 2016.txt >> Train_loss.txt echo "训练迭代间隔:" >> Train_loss.txt grep 'display' 2016.txt | cut -d ' ' -f 2 >> Train_loss.txt echo ' ' >> Train_loss.txt grep 'Train net output #0: loss = ' 2016.txt | cut -d ':' -f 5 | cut -d '(' -f 1 | cut -d ' ' -f 2,3,4 >> Train_loss.txt # 统计测试损失 echo "测试迭代次数:" >Test_loss.txt grep -c 'Test net output #1: loss = ' 2016.txt >> Test_loss.txt echo "测试迭代间隔:" >> Test_loss.txt grep 'test_interval:' 2016.txt | cut -d ' ' -f 2 >> Test_loss.txt echo ' ' >> Test_loss.txt grep 'Test net output #1: loss = ' 2016.txt | cut -d '#' -f 2 | cut -d ' ' -f 2,3,4 >> Test_loss.txt # 移动相关文件到指定路径 mv Test_accuracy.txt ~/lilai/myDL/clothes/mymodel/model/ mv Train_loss.txt ~/lilai/myDL/clothes/mymodel/model mv Test_loss.txt ~/lilai/myDL/clothes/mymodel/model fi echo "测试 训练 Accuracy Loss 统计完毕!"
相关文章推荐
- JavaScript编码规范
- Bootstrap(四) 菜单、按钮及导航
- JSP页面元素构成
- css定位方式
- HTML打开摄像头,进行拍照上传
- jquery 字符串对比 以及each遍历
- CSS实现水平居中的5种思路
- bootstrap模版
- 【总结】CSS/CSS3常用样式小结——兼容性
- Bootstrap(三) 网格系统
- jQuery绑定事件on()与弹窗的简要概述
- 属性,样式,主题以及实践(attr, style, theme)
- HTML5 LocalStorage 本地存储
- jQuery的deferred对象详解
- 输入文本框js验证
- IE兼容性问题解决方案3--css中的overflow
- Bootstrap(二) 表单
- JS img标签本地图片预览
- 关于Chrome浏览器加载某些CSS文件超慢或超时的奇葩问题的解决办法
- JavaScript 进阶学习 3 控制语句 、函数