ok no
This commit is contained in:
@@ -282,26 +282,22 @@ data_augmentation = tf.keras.Sequential([
|
|||||||
tf.keras.layers.RandomContrast(0.1),
|
tf.keras.layers.RandomContrast(0.1),
|
||||||
])
|
])
|
||||||
|
|
||||||
with strategy.scope():
|
|
||||||
base_model = DenseNet121(
|
base_model = DenseNet121(
|
||||||
weights='imagenet',
|
weights='imagenet',
|
||||||
include_top=False,
|
include_top=False,
|
||||||
input_shape=(224, 224, 3)
|
input_shape=(224, 224, 3)
|
||||||
)
|
)
|
||||||
|
|
||||||
with strategy.scope():
|
|
||||||
inputs = tf.keras.Input(shape=(224,224,3))
|
inputs = tf.keras.Input(shape=(224,224,3))
|
||||||
|
|
||||||
x = data_augmentation(inputs)
|
x = data_augmentation(inputs)
|
||||||
|
|
||||||
with strategy.scope():
|
|
||||||
x = base_model.output
|
x = base_model.output
|
||||||
x = GlobalAveragePooling2D()(x)
|
x = GlobalAveragePooling2D()(x)
|
||||||
x = Dense(512, activation='relu')(x) # Added another Dense layer
|
x = Dense(512, activation='relu')(x) # Added another Dense layer
|
||||||
x = Dense(256, activation='relu')(x) # Existing Dense layer
|
x = Dense(256, activation='relu')(x) # Existing Dense layer
|
||||||
predictions = Dense(1, activation='sigmoid')(x) # Output layer for binary classification
|
predictions = Dense(1, activation='sigmoid')(x) # Output layer for binary classification
|
||||||
|
|
||||||
with strategy.scope():
|
|
||||||
model = Model(inputs=base_model.input, outputs=predictions)
|
model = Model(inputs=base_model.input, outputs=predictions)
|
||||||
model.compile(optimizer=Adam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
|
model.compile(optimizer=Adam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user