Veritas-AI / preprocess.py
Aditya-Jadhav150
Initial commit: Veritas-AI Production Build
239017e
raw
history blame contribute delete
816 Bytes
import tensorflow as tf
IMG_SIZE = (224, 224)
BATCH_SIZE = 16
TRAIN_DIR = "dataset/train"
VAL_DIR = "dataset/validation"
TEST_DIR = "dataset/test"
def load_datasets():
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
TRAIN_DIR,
image_size=IMG_SIZE,
batch_size=BATCH_SIZE,
label_mode="binary",
shuffle=True
)
val_ds = tf.keras.preprocessing.image_dataset_from_directory(
VAL_DIR,
image_size=IMG_SIZE,
batch_size=BATCH_SIZE,
label_mode="binary",
shuffle=False
)
test_ds = tf.keras.preprocessing.image_dataset_from_directory(
TEST_DIR,
image_size=IMG_SIZE,
batch_size=BATCH_SIZE,
label_mode="binary",
shuffle=False
)
return train_ds, val_ds, test_ds