-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodels.py
50 lines (31 loc) · 1.09 KB
/
models.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
45
46
47
48
49
50
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Reshape, Dense, Activation, Conv2D, MaxPooling2D, Dropout
import utils
def deepnet1():
model = Sequential()
model.add(Flatten(input_shape=utils.IMG_SHAPE))
model.add(Dense(utils.NUM_CLASSES))
model.add(Activation("softmax"))
return model
def deepnet2():
model = Sequential()
model.add(Flatten(input_shape=utils.IMG_SHAPE))
model.add(Dense(128))
model.add(Activation("relu"))
model.add(Dense(utils.NUM_CLASSES))
model.add(Activation("softmax"))
return model
def convnet():
model = Sequential()
model.add(Reshape((*utils.IMG_SHAPE, 1), input_shape=utils.IMG_SHAPE))
model.add(Conv2D(32, kernel_size=(3, 3)))
model.add(Activation("relu"))
model.add(Conv2D(64, kernel_size=(3, 3)))
model.add(Activation("relu"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(128))
model.add(Activation("relu"))
model.add(Dense(utils.NUM_CLASSES))
model.add(Activation("softmax"))
return model