pfnet / PaintsChainer

line drawing colorization using chainer
https://paintschainer.preferred.tech/
MIT License
3.77k stars 557 forks source link

Any way to get full resolution? #92

Closed ulilpieceofs closed 7 years ago

ulilpieceofs commented 7 years ago

When I upload an image to be colored, the colored image is always 912 x 512. Is there anyway to get the colored image in the original resolution?

SiggEye commented 7 years ago

To do that, you would need to download the program and run it locally. Setting it up take a fair share of time, and you need an NVIDIA graphics card that supports CUDA

ulilpieceofs commented 7 years ago

I did just that. I think I did set it up right. How do I save the large version of processed images if I run the local server?

SiggEye commented 7 years ago

I haven't figured a way to make it the original size, but I've come very close. What I did was to:

  1. change the s_size param under "def colorize(self, id_str, step='C', blur=0, s_size=128,colorize_format="jpg"):" at cgi_exe.py to 256
  2. change the s_size param under "def get_example(self, i, minimize=False, blur=0, s_size=128):" at img2imgDataset.py to 256 Not sure if step 1 is necessary, and if my suggestion doesn't work, try undoing step 1 and see what happens when you've only done step 2. After this, you can just import your picture like normal, right-click the coloured outcome and save it anywhere. The resolution should be higher now. If you want higher res. you can change the s_size param to 512, but I think that'll make it too big as well as funky-looking.
ulilpieceofs commented 7 years ago

I made the changes to the files and now the processed images are up scaled instead of down scaled. I suppose that is an improvement. Thanks.

taizan commented 7 years ago

Smaller side of the output is 4times of size_s val. size_s should be multiple of 16

6DammK9 commented 7 years ago

Is it related to #77 ?

ulilpieceofs commented 7 years ago

Yes.

abbychau commented 7 years ago

to enlarge the file, simply input _ssize(multiples of 16) in the colorize function and it will propagate to get_example.

"full resolution" is not preferred at this moment because the resolution is bounded by chainer.functions.Convolution2D which forward the array to CUDA cores through chainer

you may not even want to try to turn off gpu mode and passing convolutions to cpu in order to break through the memory boundary, because it can only be on one thread and runs literally some days to finish for a bit larger s_size.

256 is the max s_size you can have in most cases.

ulilpieceofs commented 7 years ago

So it's not possible, got it.

abbychau commented 7 years ago

we still have waifu2x anywayz ... wwww

JamScoBal commented 7 years ago

I have this installed locally on docker toolbox and kitematic. Is there a way to change the image size on that?

abbychau commented 7 years ago

@JamScoBal change s_size from 128 to 256 and you can get a 4x resolution output.

JamScoBal commented 7 years ago

@abbychau By that do you mean going to the settings in Kitematic and adding the "s_size" under the Generals tab and putting in the value of 256?

JamScoBal commented 7 years ago

@abbychau I did that and nothing seems to be changing.

abbychau commented 7 years ago

change painter.colorize(id_str, form["step"][0].decode() if "step" in form else "C", blur=blur) in server.py to painter.colorize(id_str, form["step"][0].decode() if "step" in form else "C", blur=blur, s_size=256)

JamScoBal commented 7 years ago

How do I get to server.py in docker and/or kitematic? I am on Windows in case you were wondering.

abbychau commented 7 years ago

edit it manually after deployment

JamScoBal commented 7 years ago

Sorry, but I don't understand what you mean. I am a total noob when it comes to this stuff. You will have to put it in layman's terms for me. If you can do step by step instructions that would be great.

abbychau commented 7 years ago

Actually we are not supporting the docker version, if you meet further issues by using it, I don't think the issues will be accepted here. although in this case you just want to edit files in a docker container, it can be basic but tedious to tell these linux(or ssh, in another way to access the files) commands and operations.

Please try to follow: start the docker image

in another bash: image

run

apt-get update
apt-get install vim

image

run vim server.py

go to this line image

press d d , the line will disappear press i copy painter.colorize(id_str, form["step"][0].decode() if "step" in form else "C", blur=blur, s_size=256) right click in the shell, and make sure that there are two tabs in front of the line press esc press :wq press enter

go back to the first bash shell and restart the server

(glance https://www.tutorialspoint.com/unix/unix-vi-editor.htm for some basic operations of vi, which is a shell based text editor)

liamjones commented 7 years ago

@JamScoBal I maintain the Docker version, I'll see about adding a configuration property for this so you don't have to edit the file inside the container directly. I've logged a ticket for it here: https://github.com/liamjones/PaintsChainer-Docker/issues/3

liamjones commented 7 years ago

@JamScoBal I've updated the docker image to allow you to change s_size easily. If you re-pull the 'latest' tag (or pull 'release-1.0.7' specifically) you'll find a new environment variable called PAINTSCHAINER_S_SIZE. Remember it needs to be set to a multiple of 16 to work (128 is the default).

JamScoBal commented 7 years ago

@liamjones Thanks so much!!!!