neuro-lab6/train2.py

26 lines
632 B
Python
Raw Normal View History

2025-11-29 13:57:50 +02:00
from test2 import *
import tensorflow as tf
td, vd = tf.keras.utils.image_dataset_from_directory(
"../dataset-ultimate-2",
shuffle = True,
seed = 12345,
subset = "both",
validation_split = 0.1,
image_size = (300, 300),
labels = "inferred",
label_mode = "binary",
batch_size = 96)
ckpt = kc.ModelCheckpoint("model4.keras",
save_best_only = True,
monitor = "val_accuracy")
m.load_weights("model3.keras")
m.fit(td,
epochs = 30,
verbose = 1,
validation_data = vd,
callbacks = [ckpt])