Giter Site home page Giter Site logo

Comments (22)

Krischan74 avatar Krischan74 commented on June 14, 2024 6

I have successfully converted all my RTCW/ET textures with ESRGAN and my own automated RTCWHQ method, see https://github.com/Krischan74/RTCWHQ

from esrgan.

Fraggoso avatar Fraggoso commented on June 14, 2024 3

I've found a new code that preserves alpha channel.
Credit goes to RWTema: https://pastebin.com/sb5PCKxT

I did a few testing and it works BUT it takes very long to process even on my GTX1080.
Normally a picture from 320x240 takes one second. With that new code it takes more than one Minute on the same picture.

from esrgan.

xinntao avatar xinntao commented on June 14, 2024 2

I think it is possible. After reading images, only process the color channels with the ESRGAN model and directly copy (or maybe bicubic upsampling) the original alpha channel. After that, concatenate the color channels with the alpha channels, obtaining the final result.

from esrgan.

xinntao avatar xinntao commented on June 14, 2024 2

I am not familiar with images with alpha channels. I do not know whether I understand correctly.

  1. The simplest way may be to use the current model for RGB images and directly upsample the alpha channel. And finally combine RGB channels and Alpha Channels together.
    However, there are some problems when the edges of the alpha channel mismatch the RGB channels, I found an example for game images here .
  2. So another improved method is to also upsample the alpha channel, treating it as a gray image using the current model. I am not sure what the final effects looks like, may have a try.
  3. If having lots of training data with alpha channel images, we can fine-tune the current model with RGBA channels. (May also get the training pairs from other HD games, which will decrease the domain gap.)

If possible, could you @shogun1337 @Dilapidated provide some example images with RGBA channels? I may have a try with current models ;-)

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

OpenCV seems to have support for reading an alpha channel, theres a cv2.IMREAD_COLOR flag that i've changed to cv2.IMREAD_UNCHANGED but sadly seems it nothing changed

from esrgan.

Dilapidated avatar Dilapidated commented on June 14, 2024

Having this supporting alpha channel on output would be awesome. Probably more of a BasicSR question but I was curious if using images with alpha channels would cause issues currently with training as well?

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

@xinntao Sure, there are some texture samples with transparency from the "Return To Castle Wolfenstein" game
https://www.mediafire.com/file/8nu5gyy1asvq0mf/samples.rar/file

from esrgan.

Dilapidated avatar Dilapidated commented on June 14, 2024

@xinntao Thank you for looking into this deeper. I have included examples from two different games for variety/style purposes. Resident Evil 2 and New Super Mario Bros.
https://www.mediafire.com/file/f6twysc62h6kfpg/ALPHA_EXAMPLES.zip/file

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

4215
The results are also pixelated, maybe did he used the nearest neighbour interpolation?

from esrgan.

Dilapidated avatar Dilapidated commented on June 14, 2024

@Fraggoso Thank you for sharing this. It's good to see progress being made on retaining the alpha. Sadly I get the same pixelated artifacts as Shogun1337 and it does seem to take quite a bit longer. Hopefully @xinntao can further refine the code to fix these issues.

from esrgan.

Fraggoso avatar Fraggoso commented on June 14, 2024

@shogun1337 Can you post your image source so I can try it as well?
Like I said, it worked on my end.

from esrgan.

xinntao avatar xinntao commented on June 14, 2024

I have tried it with this script https://pastebin.com/xUdTHff9
It seems that the results are also not satisfying.
The results can be downloaded from here.

To control the noise and details, I also use the interpolation between RRDB_ESRGAN_x4.pth and RRDB_PSNR_x4.pth.

from esrgan.

Fraggoso avatar Fraggoso commented on June 14, 2024

@xinntao The results, at least for me, were expected to look like they do.
Your script isn't working on my end though. Did you change anything? I receive an error on line 35 img.shape

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

@Fraggoso You can find this image in the pack i've posted ealier
(https://www.mediafire.com/file/8nu5gyy1asvq0mf/samples.rar/file)
@xinntao I think the results won't be better, even with extracting alpha channel from the original picture, bicubic upsizing in photoshop i'm getting very similar result:
(open this image on white background to see bicubic pixel artifacts with photoshop)

comparision

from esrgan.

Fraggoso avatar Fraggoso commented on June 14, 2024

@xinntao I receive an error if I run the script:
Traceback (most recent call last): File "test.py", line 35, in <module> H, W, C = img.shape
What am I missing?

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

@Fraggoso
Hmm it works good with python 3.5 x64 (for windows), opencv 3.4.1, numpy 1.14.5+mkl, torch 0.4.1
Have you tried updating dependencies?

from esrgan.

Moukrea avatar Moukrea commented on June 14, 2024

Isn't it a way to simply ignore alpha channel and save the upscaled image without any alpha? That'd be good!

from esrgan.

Malkierian avatar Malkierian commented on June 14, 2024

Has there been any progress with this? Upscaling a game like Metroid Prime Trilogy will take forever without alpha channel handling. I can't even figure out how to programmatically sort the PNGs that are dumped by which ones have alpha and which ones don't, so I can process the ones with transparency with waifu2x-caffe, so I'd have to go through 10k+ images one by one and manually sort them.

from esrgan.

shogun1337 avatar shogun1337 commented on June 14, 2024

@Krischan74 incredible work, thank you very much, this can be used for every other games aswell

from esrgan.

Krischan74 avatar Krischan74 commented on June 14, 2024

Thanks. I've created this for my "Enemy Territory Special Edition" (ETSE) which is still under construction / testing. It won't appear on Github but perhaps on moddb as it is LARGE (10GB!). At least the cool map launcher ETlaunch will be in my repository soon.

Oh and many thanks to the guys from ESRGAN without ETSE wouldn't be possible. Before I found your cool project I upscaled thousands of textures MANUALLY in Photoshop with a special template I created. That looked already great but the ESRGAN results are even more stunning :-)

from esrgan.

Fraggoso avatar Fraggoso commented on June 14, 2024

Is it possible to edit the code so that you don't have to check if an image has alpha in them or not?
I'm not a coder, sadly or I could try to do it myself but I really think it should be an easy fix to tell in test.py IF the image has alpha than proceed with X if not than proceed with Z?

from esrgan.

Robolightning avatar Robolightning commented on June 14, 2024

If anyone else is interested in working with the alpha channel, you can look at my new repository, where I am creating a fork of the Real-ESRGAN with multi-channel support (essentially training with any number of channels, in particular 4-channel, with alpha channel support)
https://github.com/Robolightning/Multichannel-Real-ESRGAN

from esrgan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.