Commit 7a6eb308 authored by Florian RICHOUX's avatar Florian RICHOUX

Script for spotting min val_loss

parent 49945fcf
import sys
def usage():
print("Usage: {} FILE".format(sys.argv[0]))
sys.exit(1)
def extract_min_loss(data):
lines = open(data, 'r')
min_loss = 999
epoch = ""
val_acc = ""
for line in lines.readlines():
if "val_loss" in line:
loss = float(line.split(", val_loss=")[1])
if loss < min_loss:
min_loss = loss
epoch = line.split(":")[0]
continue
if epoch in line and "val_acc" in line:
val_acc = line.split(", val_acc=")[1]
lines.close()
return epoch, min_loss, val_acc
if __name__ == '__main__':
if len(sys.argv) != 2:
usage()
epoch, val_loss, val_acc = extract_min_loss( sys.argv[1] )
print("Epoch: {}, val_loss={}, val_acc={}".format( epoch, val_loss, val_acc ) )
sys.exit(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment