Open juliusakula opened 2 years ago
cd ../..
cd Users/justin/git/neural-style-docker
docker run --rm -v /mnt/c/Users/justi/git/neural-style-docker/tests/contents:/images --gpus all albarji/neural-style --content target_photo.jpg --style starry_night.jpg
Allow the program to run as long as necessary. Make note of when you start the program. When you have your output, check the time it was created. That's how you'll know it took X amount of time to create that image at that resolution, and can make a decision about trying a larger or smaller resolution the next time you run this code.
The 30,000 x 23,000 version of the Van Gogh Starry Night painting, available on wikipedia, is incredible. Zoom in and zoom in further, see the thick gobs of paint in places.
!1 - The moon on Van gogh's Starry night [zoomed in]
See the bare canvas between the paint.
!2 - Bare canvas texture zoomed in
And imagine that a neural network can be trained on such details, and that training be used to stylize a photo. The end result of a style transfer using a "gigapixel" version of a style image retains amazing detail:
!3 gigapixel starry night stylized photo
Even with the most powerful graphics processors available in the world today, it takes those machines several hours to train the neural network (step 1) - and more time still to apply the knowledge of the neural network to your photograph, in order to stylize it (step 2).
!4 Zoomed in generation via gigapixel
Even though I'm generating these with artificial intelligence, a substantial amount of work is involved:
What follows is an in-depth explanation of how to do this yourself - knowledge of command line utilities would help, you will need to install many different components in order to execute this code. In the end you will have a powerful tool at your disposal.
I'm going to outline the basic process to stylize your own photo at up to 4K resolution, on your own computer (if you have a good enough computer (RTX 2060 or above))
Setp 1. Take a photo.
!5 - Starting photo
Your output by default in this program is the same size as your input. If you want this to take under 30 minutes (Your computer will likely freeze up the entire time the neural network trains (when the program runs)) -- Resize your input image to something small like 384 x 216 to make a thumbnail sized output. For a large print, you do need as high resolution as possible and may not be possible on your computer's hardware.
2 Download a version of Starry Night from wikimedia commons
3 Download all required drivers, libraries and other dependencies in order to run the docker-neural-styles open source software