From 11aca4c6af1f84f5d761c23ea0c2f9781ed19149 Mon Sep 17 00:00:00 2001 From: Donato Azevedo Date: Wed, 1 Feb 2023 16:29:21 -0300 Subject: [PATCH] Conditionally set he image data format to channels_last On my configuration with versions: ``` TF version: 2.10.0 Keras version: 2.10.0 ``` I had to make this simple change in order to have this notebook work. Otherwise, creating the VGG19 model would fail indicating that the channel was incorrectly positioned. I would even argue that perhaps this configuration should not be commented, but I'll leave it to you to decide. Let me know if I should change. --- 255_256_SRGAN/SRGAN_train.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/255_256_SRGAN/SRGAN_train.py b/255_256_SRGAN/SRGAN_train.py index ee89f66e..833382f6 100644 --- a/255_256_SRGAN/SRGAN_train.py +++ b/255_256_SRGAN/SRGAN_train.py @@ -27,6 +27,9 @@ from keras.layers import UpSampling2D, LeakyReLU, Dense, Input, add from tqdm import tqdm +# some versions of Tf.keras will need you to configure channels last to make this notebook work +# keras.backend.set_image_data_format('channels_last') + ######################################################################### #Define blocks to build the generator @@ -345,4 +348,4 @@ def create_comb(gen_model, disc_model, vgg, lr_ip, hr_ip): plt.title('Orig. HR image') plt.imshow(sreeni_hr[0,:,:,:]) -plt.show() \ No newline at end of file +plt.show()