From 2c806504155d4a0d61c94febe1523b5903fca71e Mon Sep 17 00:00:00 2001 From: sguada Date: Sun, 9 Feb 2014 14:01:14 -0800 Subject: [PATCH 1/3] Extract Iteration from log instead of computing it from parameters --- scripts/parselog.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/parselog.sh b/scripts/parselog.sh index 187607a70a4..def12008a48 100644 --- a/scripts/parselog.sh +++ b/scripts/parselog.sh @@ -1,12 +1,11 @@ #!/bin/bash -# Usage parselog.sh caffe.log [init_iter=0] [test_interval=1000] +# Usage parselog.sh caffe.log # It creates two files one caffe.log.test that contains the loss and test accuracy of the test and # another one caffe.log.loss that contains the loss computed during the training -# Use init_iter when the log start from a previous snapshot -# Use test_interval when the testing interval is different than 1000 + if [ "$#" -lt 1 ] then -echo "Usage parselog.sh /path_to/caffe.log [init_iter=0] [test_interval=1000]" +echo "Usage parselog.sh /path_to/caffe.log" fi if [ "$#" -gt 1 ] then @@ -21,8 +20,10 @@ else INC=1000 fi LOG=`basename $1` -grep 'Test score #0' $1 | awk -v init=$INIT -v inc=$INC '{print (NR*inc+init), $8}' > aux0.txt -grep 'Test score #1' $1 | awk '{print $8}' > aux1.txt +grep -B 2 'Test ' $1 > aux.txt +grep 'Iteration ' aux.txt | awk -F ',| ' '{print $7}' > aux0.txt +grep 'Test score #0' aux.txt | awk '{print $8}' > aux1.txt +grep 'Test score #1' aux.txt | awk '{print $8}' > aux2.txt grep ' loss =' $1 | awk '{print $6,$9}' | sed 's/,//g' | column -t > $LOG.loss -paste aux0.txt aux1.txt | column -t > $LOG.test -rm aux0.txt aux1.txt \ No newline at end of file +paste aux0.txt aux1.txt aux2.txt | column -t > $LOG.test +rm aux0.txt aux1.txt aux2.txt \ No newline at end of file From 8880cb48b058481539ba34c73df8eaaddce591fd Mon Sep 17 00:00:00 2001 From: Sergio Guadarrama Date: Sun, 9 Feb 2014 14:08:10 -0800 Subject: [PATCH 2/3] Update parselog.sh Removed parameters --- scripts/parselog.sh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/scripts/parselog.sh b/scripts/parselog.sh index def12008a48..de768ecf000 100644 --- a/scripts/parselog.sh +++ b/scripts/parselog.sh @@ -7,18 +7,6 @@ if [ "$#" -lt 1 ] then echo "Usage parselog.sh /path_to/caffe.log" fi -if [ "$#" -gt 1 ] -then - INIT=$2 -else - INIT=0 -fi -if [ "$#" -gt 2 ] -then - INC=$3 -else - INC=1000 -fi LOG=`basename $1` grep -B 2 'Test ' $1 > aux.txt grep 'Iteration ' aux.txt | awk -F ',| ' '{print $7}' > aux0.txt @@ -26,4 +14,4 @@ grep 'Test score #0' aux.txt | awk '{print $8}' > aux1.txt grep 'Test score #1' aux.txt | awk '{print $8}' > aux2.txt grep ' loss =' $1 | awk '{print $6,$9}' | sed 's/,//g' | column -t > $LOG.loss paste aux0.txt aux1.txt aux2.txt | column -t > $LOG.test -rm aux0.txt aux1.txt aux2.txt \ No newline at end of file +rm aux0.txt aux1.txt aux2.txt From 500804e00f6f5a9e3245e80000e703d45b47c412 Mon Sep 17 00:00:00 2001 From: sguada Date: Sun, 9 Feb 2014 15:46:25 -0800 Subject: [PATCH 3/3] Use sed instead of awk to find the Iteration --- scripts/parselog.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/parselog.sh b/scripts/parselog.sh index de768ecf000..ce5dd140049 100644 --- a/scripts/parselog.sh +++ b/scripts/parselog.sh @@ -9,9 +9,9 @@ echo "Usage parselog.sh /path_to/caffe.log" fi LOG=`basename $1` grep -B 2 'Test ' $1 > aux.txt -grep 'Iteration ' aux.txt | awk -F ',| ' '{print $7}' > aux0.txt +grep 'Iteration ' aux.txt | sed 's/.*Iteration \([[:digit:]]*\).*/\1/g' > aux0.txt grep 'Test score #0' aux.txt | awk '{print $8}' > aux1.txt grep 'Test score #1' aux.txt | awk '{print $8}' > aux2.txt grep ' loss =' $1 | awk '{print $6,$9}' | sed 's/,//g' | column -t > $LOG.loss paste aux0.txt aux1.txt aux2.txt | column -t > $LOG.test -rm aux0.txt aux1.txt aux2.txt +rm aux.txt aux0.txt aux1.txt aux2.txt