-
Notifications
You must be signed in to change notification settings - Fork 2
/
saveParameters.py
44 lines (31 loc) · 1.8 KB
/
saveParameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pickle
import sys
from architecture.parameters.contextEncoderParameters import ContextEncoderParameters
sys.path.append('.') # In case we launch this from the base folder
__author__ = 'Andres'
from architecture.parameters.convNetworkParams import ConvNetworkParams
from architecture.parameters.fullyLayerParams import FullyLayerParams
"Simple script to save parameters"
architecturesParametersFile = "magnitude_network_parameters.pkl"
batchSize = 256
signalLength = 5120
gapLength = 1024
fftWindowLength = 512
fftHopSize = 128
encoderParams = ConvNetworkParams(filterShapes=[(7, 89), (3, 17), (2, 11),
(1, 9), (1, 5), (2, 5)],
channels=[4, 32, 128, 512,
256, 160, 128],
strides=[[1, 2, 2, 1], [1, 2, 3, 1], [1, 2, 3, 1],
[1, 1, 2, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
name='Encoder')
fullyParams = FullyLayerParams(inputShape=(batchSize, 128, 2, 8), outputShape=(batchSize, 8, 8, 32), name="Fully")
decoderParams = ConvNetworkParams(filterShapes=[(8, 8), (5, 5), (3, 3), (5, 67), (11, 257)],
channels=[32, 128, 512, 257, 11, 1],
strides=[[1, 2, 2, 1], [1, 2, 2, 1], [1, 1, 1, 1],
[1, 2, 2, 1], [1, 1, 1, 1]],
name='Decoder')
contextEncoderParameters = ContextEncoderParameters(batchSize, signalLength, gapLength, fftWindowLength, fftHopSize,
encoderParams, fullyParams, decoderParams)
with open(architecturesParametersFile, 'wb') as fiModel:
pickle.dump(contextEncoderParameters, fiModel)