- 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)
+ with backend.get_session():
+ for winlen, winstep in ((0.025, 0.01), (0.1, 0.04), (0.2, 0.08)):
+ for name, model in (('simple', simplemodel), ('bottle', bottlemodel)):
+ m = run('mfcc', winlen, winstep, model, name)
+ fproot = 'model_{}_{}_{}.json'.format(winlen, winstep, name)
+ with open('{}.json'.format(fproot), 'w') as f:
+ f.write(m.to_json())
+ m.save_weights('{}.hdf5'.format(fproot))