Uh oh!
There was an error while loading. Please reload this page.
forked from despoisj/DeepAudioClassification
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
Latest commit
34 lines (24 loc) · 1.13 KB
/
Copy pathmodel.py
File metadata and controls
34 lines (24 loc) · 1.13 KB
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
# -*- coding: utf-8 -*-
importnumpyasnp
importtflearn
fromtflearn.layers.convimportconv_2d, max_pool_2d
fromtflearn.layers.coreimportinput_data, dropout, fully_connected
fromtflearn.layers.estimatorimportregression
defcreateModel(nbClasses,imageSize):
print("[+] Creating model...")
convnet=input_data(shape=[None, imageSize, imageSize, 1], name='input')
convnet=conv_2d(convnet, 64, 2, activation='elu', weights_init="Xavier")
convnet=max_pool_2d(convnet, 2)
convnet=conv_2d(convnet, 128, 2, activation='elu', weights_init="Xavier")
convnet=max_pool_2d(convnet, 2)
convnet=conv_2d(convnet, 256, 2, activation='elu', weights_init="Xavier")
convnet=max_pool_2d(convnet, 2)
convnet=conv_2d(convnet, 512, 2, activation='elu', weights_init="Xavier")
convnet=max_pool_2d(convnet, 2)
convnet=fully_connected(convnet, 1024, activation='elu')
convnet=dropout(convnet, 0.5)
convnet=fully_connected(convnet, nbClasses, activation='softmax')
convnet=regression(convnet, optimizer='rmsprop', loss='categorical_crossentropy')
model=tflearn.DNN(convnet)
print(" Model created! ✅")
returnmodel