Spaces:
Sleeping
Sleeping
okeowo1014
commited on
Commit
•
f5189ce
1
Parent(s):
9ef4521
Update train.py
Browse files
train.py
CHANGED
@@ -34,14 +34,14 @@ validation_datagen = ImageDataGenerator(rescale=1./255) # Only rescale for vali
|
|
34 |
train_generator = train_datagen.flow_from_directory(
|
35 |
train_data_dir,
|
36 |
target_size=(img_width, img_height),
|
37 |
-
batch_size=
|
38 |
class_mode='binary' # Two classes: cat or dog
|
39 |
)
|
40 |
|
41 |
validation_generator = validation_datagen.flow_from_directory(
|
42 |
validation_data_dir,
|
43 |
target_size=(img_width, img_height),
|
44 |
-
batch_size=
|
45 |
class_mode='binary'
|
46 |
)
|
47 |
|
@@ -67,7 +67,7 @@ model.compile(loss='binary_crossentropy',
|
|
67 |
# Train the model
|
68 |
history = model.fit(
|
69 |
train_generator,
|
70 |
-
epochs=
|
71 |
validation_data=validation_generator
|
72 |
)
|
73 |
|
|
|
34 |
train_generator = train_datagen.flow_from_directory(
|
35 |
train_data_dir,
|
36 |
target_size=(img_width, img_height),
|
37 |
+
batch_size=8, # Adjust batch size based on GPU memory
|
38 |
class_mode='binary' # Two classes: cat or dog
|
39 |
)
|
40 |
|
41 |
validation_generator = validation_datagen.flow_from_directory(
|
42 |
validation_data_dir,
|
43 |
target_size=(img_width, img_height),
|
44 |
+
batch_size=8,
|
45 |
class_mode='binary'
|
46 |
)
|
47 |
|
|
|
67 |
# Train the model
|
68 |
history = model.fit(
|
69 |
train_generator,
|
70 |
+
epochs=10, # Adjust number of epochs based on dataset size and validation performance
|
71 |
validation_data=validation_generator
|
72 |
)
|
73 |
|