image_output_11.png text_plain_output_5.png text_plain_output_15.png text_plain_output_9.png image_output_14.png text_plain_output_4.png text_plain_output_13.png image_output_13.png image_output_5.png text_plain_output_14.png text_plain_output_10.png text_plain_output_6.png image_output_7.png text_plain_output_3.png image_output_4.png text_plain_output_7.png image_output_8.png text_plain_output_16.png text_plain_output_8.png image_output_6.png image_output_12.png text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png image_output_3.png image_output_2.png image_output_1.png image_output_10.png text_plain_output_11.png text_plain_output_12.png image_output_15.png image_output_9.png
from glob import glob

import tensorflow as tf

IMAGE_SIZE = 256
BATCH_SIZE = 16
MAX_TRAIN_IMAGES = 400

train_low_light_images = sorted(glob('/kaggle/input/lol-dataset/lol_dataset/our485/low/*'))[:MAX_TRAIN_IMAGES]
val_low_light_images = sorted(glob('/kaggle/input/lol-dataset/lol_dataset/our485/low/*'))[MAX_TRAIN_IMAGES:]
test_low_light_images = sorted(glob('/kaggle/input/lol-dataset/lol_dataset/eval15/low/*'))

def load_data(image_path):
    image = tf.io.read_file(image_path)
    image = tf.image.decode_png(image, channels=3)
    image = tf.image.resize(images=image, size=[IMAGE_SIZE, IMAGE_SIZE])
    image = image / 255.0
    return image
def data_generator(low_light_images):
    dataset = tf.data.Dataset.from_tensor_slices(low_light_images)
    dataset = dataset.map(load_data, num_parallel_calls=tf.data.AUTOTUNE)
    dataset = dataset.batch(BATCH_SIZE, drop_remainder=True)
    return dataset

train_dataset = data_generator(train_low_light_images)
val_dataset = data_generator(val_low_light_images)
print('Train Dataset:', train_dataset)
print('Validation Dataset:', val_dataset)