From ab4fa16c5b8dec59de37b550a199ca7782e3ca08 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Tue, 25 Apr 2017 19:47:08 +0200 Subject: [PATCH] update the experiments --- experiments.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/experiments.py b/experiments.py index 708f0ee..adf76b1 100644 --- a/experiments.py +++ b/experiments.py @@ -62,7 +62,7 @@ def features_from_wav(tg, wavp, typ='mfcc', winlen=0.025, winstep=0.01): i += 1 return (data, labels) -def run(typ, winlen, winstep, modelfun): +def run(typ, winlen, winstep, modelfun, modelname): datas = [] labels = [] @@ -91,7 +91,9 @@ def run(typ, winlen, winstep, modelfun): verbose=0) #Test - return model.evaluate(testdata, testlabels, batch_size=32, verbose=0) + loss, acc = model.evaluate(testdata, testlabels, batch_size=32, verbose=0) + print('{}\t{}\t{}\t{}\t{}\n'.format( + winlen, winstep, modelname, loss, acc)) def simplemodel(d): model = Sequential() @@ -114,10 +116,7 @@ def bottlemodel(d): return model if __name__ == '__main__': - #print(run('mfcc', 0.025, 0.01, simplemodel)) - #print(run('mfcc', 0.1, 0.04, simplemodel)) - #print(run('mfcc', 0.2, 0.08, simplemodel)) - - print(run('mfcc', 0.025, 0.01, bottlemodel)) - print(run('mfcc', 0.1, 0.04, bottlemodel)) - print(run('mfcc', 0.2, 0.08, bottlemodel)) + print('winlen\twinstep\tmodel\tloss\taccuracy\n') + for winlen, winstep in ((0.025, 0.01), (0.1, 0.04), (0.2, 0.08)): + for name, model in (('simple', simplemodel), ('bottle', bottlemodel)): + run('mfcc', winlen, winstep, model, name) -- 2.20.1