-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model5.py
54 lines (31 loc) · 1.2 KB
/
Model5.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
51
# coding: utf-8
# In[ ]:
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.layers import Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten
from keras.optimizers import SGD
from keras.preprocessing.image import ImageDataGenerator
from keras.utils.layer_utils import layer_from_config
from scipy import ndimage, misc
import numpy as np
# In[ ]:
def model5(weights_path=None, channels=3, width=224, height=224):
model = Sequential()
model.add(Convolution2D(32, 3, 3, border_mode='same', input_shape=(channels, width, height),
activation='relu'))
model.add(Convolution2D(32, 3, 3, border_mode='same', activation='relu'))
model.add(MaxPooling2D((2,2)))
model.add(Flatten())
model.add(Dropout(0.25))
model.add(Dense(10, activation='softmax'))
if weights_path:
model.load_weights(weights_path)
return model
if __name__=="__main__":
get_ipython().system('ipython nbconvert --to script Model5.ipynb')
model = model5()
print('Shape is: ', model.output_shape)
# print('Weights are: ', len(model.get_weights()))
# print('layer.get_config()')
# In[ ]:
# In[ ]: