Test
This commit is contained in:
@@ -271,9 +271,9 @@ 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(): # Use all gpus
|
||||
model = Model(inputs=base_model.input, outputs=predictions)
|
||||
model.compile(optimizer=Adam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
|
||||
# with strategy.scope(): # Use all gpus
|
||||
model = Model(inputs=base_model.input, outputs=predictions)
|
||||
model.compile(optimizer=Adam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
|
||||
|
||||
"""## 4. Data Generators
|
||||
|
||||
@@ -340,9 +340,10 @@ model_checkpoint = ModelCheckpoint(
|
||||
)
|
||||
|
||||
# Train the model
|
||||
print("Training model...")
|
||||
history = model.fit(
|
||||
train_generator,
|
||||
epochs=3, # You can adjust the number of epochs
|
||||
epochs=50, # You can adjust the number of epochs
|
||||
validation_data=val_generator,
|
||||
callbacks=[early_stopping, model_checkpoint],
|
||||
class_weight=class_weights # Use class weights to handle imbalance
|
||||
|
||||
Reference in New Issue
Block a user