Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug using preserve color option #70

Open
borderlineinteractive opened this issue Aug 29, 2020 · 3 comments
Open

Bug using preserve color option #70

borderlineinteractive opened this issue Aug 29, 2020 · 3 comments

Comments

@borderlineinteractive
Copy link

Hi,

Thank you very much for this nice implementation.

I am using your code successfully on Windows 10 on an iMac and AMD GPU via Plaidml. However, using the preserve color option I get a noise-like Image output with a diagonal stripe pattern. This also happens with the example images that you provide and show on your GitHub page (the Buddhist temple with water lillies style. Without the preserve color option everything works fine.

Any suggestion what might be going wrong?

Many thanks in advance!

@titu1994
Copy link
Owner

There's been some issue to get color preservation working once scipy stopped supporting imread and imsave. I'd suggest going down to a version which uses older scipy and perform colorization post training

@sipie800
Copy link

sipie800 commented Jan 8, 2021

I encounter this too.Win10 tensorflow 2.3 and Keras 2.4.3 and all latest version required libraries.
Finally figured out that this is due to some glitch on conversion between rgb and ycbcr and also between uint8 and float64,
and al the same for working around among PIL,skimage,imageio.
It's not a wise choose to fix all the glitches one by one because those libraries are not designed to work together in a decent way.
Get it solved by removing all implementation using PIL,imageio and skimage.All of these will be done by cv2 only.
And also conversion between RGB and BGR is done by cv2 rather than x=x[:,:,::-1], which just in some case, can cause unexpected result where you never imagine to be.

@HitLuca
Copy link

HitLuca commented Feb 28, 2022

I know I'm late to the party, but to fix it you can update the fromimage function in utils.py from

def fromimage(img, mode="RGB"):
    if mode == "RGB":
        img = color.lab2rgb(img)
    else:
        img = color.rgb2lab(img)
    return img

to

def fromimage(img, mode="RGB"):
    return np.array(img.convert(mode))

as a bonus you don't need the scikit-image library anymore since it's used only for that from what I could see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants