Parellization ok!

This commit is contained in:
2026-05-21 17:45:28 +02:00
parent 2174ab1fb0
commit 4b56e164a1

View File

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