Skip to content

Commit

Permalink
j30
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcardoso committed Aug 23, 2023
1 parent 48b834a commit 0137656
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mergernet/estimators/parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def build(self, freeze_conv: bool = False) -> tf.keras.Model:
x = conv_block(x)

# Representation layer
representation_mode = self.hp.get('features_reduction', default='flatten')
representation_mode = self.hp.get('features_reduction', default='avg_pooling')
if representation_mode == 'flatten':
x = tf.keras.layers.Flatten()(x)
elif representation_mode == 'avg_pooling':
Expand All @@ -73,14 +73,14 @@ def build(self, freeze_conv: bool = False) -> tf.keras.Model:
units = self.hp.get(f'dense_{i}_units')
bn = self.hp.get(f'batch_norm_{i}')
activation = self.hp.get(f'activation_{i}', default='relu')
dropout_rate = self.hp.get(f'dropout_{i}_rate')
dropout_rate = self.hp.get(f'dropout_{i}_rate', default=0.0)
if units:
x = tf.keras.layers.Dense(units, use_bias=not bn)(x)
if bn:
x = tf.keras.layers.BatchNormalization()(x)
if activation == 'relu':
x = tf.keras.layers.Activation('relu')(x)
if dropout_rate:
if dropout_rate > 1e-7:
x = tf.keras.layers.Dropout(dropout_rate)(x)

# Classifications
Expand Down
6 changes: 3 additions & 3 deletions mergernet/jobs/j030.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def call(self):
HP.num('batch_size', low=64, high=256, step=64, dtype=int),
HP.const('features_reduction', 'avg_pooling'),
HP.num('dense_1_units', low=32, high=1024, step=1, dtype=int),
HP.cat('dropout_1_rate', [None, 0.1, 0.2, 0.3, 0.4]),
HP.num('dropout_1_rate', low=0.0, high=0.4, step=0.1, dtype=float),
HP.cat('batch_norm_1', [True, False]),
HP.num('dense_2_units', low=32, high=1024, step=1, dtype=int),
HP.cat('dropout_2_rate', [None, 0.1, 0.2, 0.3, 0.4]),
HP.num('dropout_2_rate', low=0.0, high=0.4, step=0.1, dtype=float),
HP.cat('batch_norm_2', [True, False]),
HP.num('dense_3_units', low=32, high=1024, step=1, dtype=int),
HP.cat('dropout_3_rate', [None, 0.1, 0.2, 0.3, 0.4]),
HP.num('dropout_3_rate', low=0.0, high=0.4, step=0.1, dtype=float),
HP.cat('batch_norm_3', [True, False]),
)
ds = Dataset(config=Dataset.registry.LS10_TRAIN_224_PNG)
Expand Down

0 comments on commit 0137656

Please sign in to comment.