Skip to content

Commit

Permalink
Extract learning rate from training log
Browse files Browse the repository at this point in the history
  • Loading branch information
kloudkl committed Feb 11, 2014
1 parent 796c588 commit 32126b8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scripts/parselog.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@

if [ "$#" -lt 1 ]
then
echo "Usage parselog.sh /path_to/caffe.log"
echo "Usage parselog.sh /path/to/your.log"
exit
fi
LOG=`basename $1`
grep -B 2 'Test ' $1 > aux.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
echo '# Iters TestAccuracy TestLoss'> $LOG.test
paste aux0.txt aux1.txt aux2.txt | column -t >> $LOG.test
rm aux.txt aux0.txt aux1.txt aux2.txt

grep ', loss = ' $1 > aux.txt
grep 'Iteration ' aux.txt | sed 's/.*Iteration \([[:digit:]]*\).*/\1/g' > aux0.txt
grep ', loss = ' $1 | awk '{print $9}' > aux1.txt
grep ', lr = ' $1 | awk '{print $9}' > aux2.txt
echo '# Iters TrainingLoss LearningRate'> $LOG.train
paste aux0.txt aux1.txt aux2.txt | column -t >> $LOG.train
rm aux.txt aux0.txt aux1.txt aux2.txt

0 comments on commit 32126b8

Please sign in to comment.