Sara-Adjo commited on
Commit
03f90fb
·
verified ·
1 Parent(s): 58c5375

Update model_tensorflow.py

Browse files
Files changed (1) hide show
  1. model_tensorflow.py +5 -8
model_tensorflow.py CHANGED
@@ -1,9 +1,7 @@
1
  import tensorflow as tf
2
  from tensorflow.keras import layers, Model
3
 
4
- # ==============================
5
- # Separable Convolution Block
6
- # ==============================
7
  def separable_block(x, filters, dropout_rate=0.25):
8
  x = layers.SeparableConv2D(filters, 3, padding="same", use_bias=False)(x)
9
  x = layers.BatchNormalization()(x)
@@ -19,24 +17,23 @@ def separable_block(x, filters, dropout_rate=0.25):
19
  return x
20
 
21
 
22
- # ==============================
23
  # Model Definition
24
- # ==============================
25
  def build_sara_tf_model(input_shape=(150, 150, 3), num_classes=6):
26
 
27
  inputs = tf.keras.Input(shape=input_shape)
28
 
29
- # Stem
30
  x = layers.Conv2D(32, 3, padding="same", use_bias=False)(inputs)
31
  x = layers.BatchNormalization()(x)
32
  x = layers.Activation("relu")(x)
33
 
34
- # Feature extractor
35
  x = separable_block(x, 64, 0.25)
36
  x = separable_block(x, 128, 0.25)
37
  x = separable_block(x, 256, 0.30)
38
 
39
- # Head
40
  x = layers.GlobalAveragePooling2D()(x)
41
 
42
  x = layers.Dense(128, use_bias=False)(x)
 
1
  import tensorflow as tf
2
  from tensorflow.keras import layers, Model
3
 
4
+
 
 
5
  def separable_block(x, filters, dropout_rate=0.25):
6
  x = layers.SeparableConv2D(filters, 3, padding="same", use_bias=False)(x)
7
  x = layers.BatchNormalization()(x)
 
17
  return x
18
 
19
 
20
+
21
  # Model Definition
 
22
  def build_sara_tf_model(input_shape=(150, 150, 3), num_classes=6):
23
 
24
  inputs = tf.keras.Input(shape=input_shape)
25
 
26
+
27
  x = layers.Conv2D(32, 3, padding="same", use_bias=False)(inputs)
28
  x = layers.BatchNormalization()(x)
29
  x = layers.Activation("relu")(x)
30
 
31
+
32
  x = separable_block(x, 64, 0.25)
33
  x = separable_block(x, 128, 0.25)
34
  x = separable_block(x, 256, 0.30)
35
 
36
+
37
  x = layers.GlobalAveragePooling2D()(x)
38
 
39
  x = layers.Dense(128, use_bias=False)(x)