Skip to content

Commit ce58dc2

Browse files
Fully commit
1 parent e91624f commit ce58dc2

3 files changed

+20
-5
lines changed

model.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,32 @@ def FCN_model(len_classes=5, dropout_rate=0.2):
3737
x = tf.keras.layers.BatchNormalization()(x)
3838
x = tf.keras.layers.Activation('relu')(x)
3939

40-
# x = tf.keras.layers.Flatten()(x)
41-
x = tf.keras.layers.GlobalMaxPooling2D()(x)
40+
# Uncomment the below line if you're using dense layers
41+
# x = tf.keras.layers.GlobalMaxPooling2D()(x)
42+
43+
# Fully connected layer 1
44+
# x = tf.keras.layers.Dropout(dropout_rate)(x)
45+
# x = tf.keras.layers.BatchNormalization()(x)
46+
# x = tf.keras.layers.Dense(units=64)(x)
47+
# x = tf.keras.layers.Activation('relu')(x)
4248

49+
# Fully connected layer 1
50+
x = tf.keras.layers.Conv2D(filters=64, kernel_size=1, strides=1)(x)
4351
x = tf.keras.layers.Dropout(dropout_rate)(x)
4452
x = tf.keras.layers.BatchNormalization()(x)
45-
x = tf.keras.layers.Dense(units=64)(x)
4653
x = tf.keras.layers.Activation('relu')(x)
4754

55+
# Fully connected layer 2
56+
# x = tf.keras.layers.Dropout(dropout_rate)(x)
57+
# x = tf.keras.layers.BatchNormalization()(x)
58+
# x = tf.keras.layers.Dense(units=len_classes)(x)
59+
# predictions = tf.keras.layers.Activation('softmax')(x)
60+
61+
# Fully connected layer 2
62+
x = tf.keras.layers.Conv2D(filters=len_classes, kernel_size=1, strides=1)(x)
4863
x = tf.keras.layers.Dropout(dropout_rate)(x)
4964
x = tf.keras.layers.BatchNormalization()(x)
50-
x = tf.keras.layers.Dense(units=len_classes)(x)
65+
x = tf.keras.layers.GlobalMaxPooling2D()(x)
5166
predictions = tf.keras.layers.Activation('softmax')(x)
5267

5368
model = tf.keras.Model(inputs=input, outputs=predictions)
@@ -58,5 +73,5 @@ def FCN_model(len_classes=5, dropout_rate=0.2):
5873
return model
5974

6075
if __name__ == "__main__":
61-
FCN_model()
76+
FCN_model(len_classes=5, dropout_rate=0.2)
6277

Binary file not shown.

0 commit comments

Comments
 (0)