my_model.py
Go to the documentation of this file.
1 from keras.models import Sequential
2 from keras.layers import Input, Dense, Dropout, Flatten, BatchNormalization, SeparableConv2D
3 from keras import regularizers, optimizers
4 from keras.layers.convolutional import Conv2D, MaxPooling2D, AveragePooling2D
5 
6 def my_model(input_shape=[500,500,3], classes=3):
7 
8  model = Sequential()
9 
10  # Convolutional layers
11 
12  #model.add(Dropout(0.2, input_shape=input_shape))
13 
14  model.add(Conv2D(64, kernel_size=(11,11), strides=4, padding='same', input_shape=input_shape, activation='relu'))
15  model.add(MaxPooling2D(pool_size=(4,4), strides=4))
16  model.add(BatchNormalization(axis=3))
17 
18  model.add(Conv2D(32, kernel_size=(7,7), strides=2, padding='same', activation='relu'))
19  model.add(MaxPooling2D(pool_size=(2,2), strides=1))
20  model.add(BatchNormalization(axis=3))
21 
22  model.add(Dropout(0.2))
23 
24  # Flat data to dense layers
25 
26  model.add(Flatten())
27 
28  # Hiddel layers
29 
30  model.add(Dense(1000,
31  # kernel_regularizer=regularizers.l1_l2(0.001),
32  # activity_regularizer=regularizers.l1_l2(0.001),
33  activation='relu'))
34 
35  model.add(Dropout(0.2))
36 
37  model.add(Dense(1000,
38  # kernel_regularizer=regularizers.l1_l2(0.001),
39  # activity_regularizer=regularizers.l1_l2(0.001),
40  activation='relu'))
41 
42  model.add(Dropout(0.4))
43 
44  # Output layer
45 
46  model.add(Dense(classes, activation='softmax'))
47 
48  return model
49 
def my_model(input_shape=[500, classes=3)
Definition: my_model.py:6