krasserm / super-resolution

Tensorflow 2.x based implementation of EDSR, WDSR and SRGAN for single image super-resolution
Apache License 2.0
1.5k stars 352 forks source link

PSNR doesn't change on custom dataset #106

Closed Gooda97 closed 1 year ago

Gooda97 commented 1 year ago

Hi @krasserm

First of all, thank you for this wonderful repo.

I've used these lines of code to work on my dataset:

lr_images_path = r'C:\Users\dell\Downloads\super_resolution\input'
hr_images_path = r'C:\Users\dell\Downloads\super_resolution\output'

file_paths_1 = sorted(sorted(glob.glob(os.path.join(lr_images_path, ".png"))))
file_paths_2 = sorted(sorted(glob.glob(os.path.join(hr_images_path, ".png"))))

lr_dataset = tf.data.Dataset.from_tensor_slices(file_paths_1)
hr_dataset = tf.data.Dataset.from_tensor_slices(file_paths_2)

def load_and_preprocess_image(file_path):
image = tf.io.read_file(file_path)

image = tf.image.decode_png(image, channels=3)

image = tf.image.convert_image_dtype(image, tf.float32)

return image
lr_dataset = lr_dataset.map(load_and_preprocess_image)
hr_dataset = hr_dataset.map(load_and_preprocess_image)

combined_dataset = tf.data.Dataset.zip((lr_dataset, hr_dataset))

batched_dataset = combined_dataset.batch(1)

prefetched_dataset = batched_dataset.prefetch(tf.data.experimental.AUTOTUNE)

DATASET_SIZE= len(prefetched_dataset)

train_size = int(0.97 * DATASET_SIZE)
test_size = DATASET_SIZE - train_size

train_dataset = prefetched_dataset.take(train_size)
test_dataset = prefetched_dataset.skip(train_size)

and the training ran successfully but the PSNR had only slight changes and the output was so noisy. image image

could you help me with this.

Thanks in advance.