You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm getting this error when I try to predict after training:
ValueError: Input 0 of layer "generator" is incompatible with the layer: expected shape=(None, 40, 40, 3), found shape=(None, 64, 64, 3)
I trained on a set of 64x64 images, with 512x512 upscaled versions. I split the original full set of 64x64 images into a training set and a validation set, and tried to predict with the validation set. That's when I got this error. I'm not sure why the generator is expecting a 40x40 image as input, given that these weights were trained on 64x64 images.
I have a sane problem, now fixed with this: if lr_img.shape[2] == 4:
# If it has four channels, remove the alpha channel (assumed to be the fourth channel)
lr_img = lr_img[:, :, :3]
full code:
import numpy as np
from PIL import Image
from ISR.models import RRDN, rdn
# Load the image
img = Image.open('dd.png')
# Resize the image to match the expected input shape (e.g., 3 color channels)
# Convert the image to a NumPy array
lr_img = np.array(img)
if lr_img.shape[2] == 4:
# If it has four channels, remove the alpha channel (assumed to be the fourth channel)
lr_img = lr_img[:, :, :3]
# Load the pre-trained RDN model
# rdn = RDN(weights='noise-cancel')
rrdn = RRDN(weights='gans')
sr_img = rrdn.predict(lr_img)
# Convert the NumPy array back to an Image object
sr_img = Image.fromarray(sr_img)
# Save the super-resolved image
sr_img.save('output.png')
Hi, I'm getting this error when I try to predict after training:
I trained on a set of 64x64 images, with 512x512 upscaled versions. I split the original full set of 64x64 images into a training set and a validation set, and tried to predict with the validation set. That's when I got this error. I'm not sure why the generator is expecting a 40x40 image as input, given that these weights were trained on 64x64 images.
Here is the full code for training / running:
The text was updated successfully, but these errors were encountered: