albarji / neural-style-docker

A dockerized version of neural style transfer algorithms
MIT License
112 stars 34 forks source link

Output file size #5

Closed daviscodesbugs closed 6 years ago

daviscodesbugs commented 7 years ago

Couldn't seem to find parameters for output file size. Is it a limitation of the algorithm itself? I would think that it could at least match the size of the input images.

albarji commented 7 years ago

Output file size is set to the default of neural-style, which is 500 pixels in the longest dimension (either rows or columns). It is possible to produce larger images by invoking the neural-style main directly, check:

nvidia-docker run --rm albarji/neural-style -h

And you will see there is a parameter just for that. This parameter, however, is not ported to the variants.sh fake-it.sh scripts.

Be advised though that large output images mean more GPU memory consumption. You might need a high-end GPU to produce images in the order of 1000x1000 px.

wboykinm commented 7 years ago

I'm late to the party to mention this, but after extensive testing last fall I found that the maximum output size I could get without a crash was 1280x1280 even using a p2.8xlarge instance.

The quest for high-resolution continues 😁

albarji commented 7 years ago

That's a quite good resolution! My current preferred method is to generate a 500x500 image and then run Waifu2x (https://github.com/nagadomi/waifu2x) twice to perform super-resolution up to 2000x2000. It's far from perfect but for some styles works nicely.

I have also tried tiling the image into 3x3 or 5x5 pieces and running the method on each tile. This produces bad results (as expected) as when joining all tiles they don't really fit neatly and the borders between tiles stand out too much. I tried some ideas to smooth out this effect, but no luck so far.

wboykinm commented 7 years ago

@albarji I've actually had really good results tiling with this imagemagick-based strategy from @ProGamerGov. I keep meaning to try the Waifu2x method but I suspect upscaling wouldn't fly with satellite imagery

albarji commented 7 years ago

@wboykinm I've been away from this project for some time, but finally had the chance to try the tiling strategy you suggested, and it indeed works pretty well!

I'm now working in dockerizing an alternative, faster method for style transfer (https://github.com/rtqichen/style-swap). I might include this tiling method to produce larger images as well.

And by the way, very cool satellite images you are creating there :)

wboykinm commented 7 years ago

@albarji That's great news! Thanks for looking!

albarji commented 6 years ago

I just released a new 2.1 version which implements the tiling strategy, generalized to work at any target resolution. It also includes the style-swap algorithm I was dockerizing in the other repository linked above. So now you can generate high-res images fast!

wboykinm commented 6 years ago

@albarji

thanks