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

Not working on PNGs #50

Open melwazir opened 4 years ago

melwazir commented 4 years ago

I get this message:

InvalidArgumentError: Incompatible shapes: [1,363,258,4] vs. [3] [Op:Sub]

When I removed the alpha channel:

InvalidArgumentError: Incompatible shapes: [1,365,260] vs. [3] [Op:Sub]

Zhejing-Chin commented 3 years ago

Need to remove the alpha channel by converting RGBA to RGB

add the following code to resolve_and_plot():

if len(lr.shape) > 2 and lr.shape[2] == 4:
      #convert the image from RGBA2RGB
      lr = cv2.cvtColor(lr, cv2.COLOR_BGRA2BGR)

works fine for me now