Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 2 KB

README.md

File metadata and controls

52 lines (33 loc) · 2 KB

NeuralPainter - npainter

BS-Painted

Simple neural network written in tensorflow for painting images. It works by using [x,y] coordinates of each pixel from the input image as inputs and tries to predict their respective [r,g,b] values. The generated pictures have a look of a hand-painted picture.

Notes

It took me around 18 hours on quadcore i5-4690 to paint 500 frames (20sec) of 720p video with 50 iterations and 13 layers with 24 neurons/layer, running 4 isolated scripts. It can be seen on this painted video & original video.

Dependencies

  • tensorflow Tensorflow library.
  • python 3.5
  • matplotlib
  • numpy

Usage

Usage is configured with config.json file that has to be in the same directory as the npaint.py script. Script will take all .jpg images from the input folder and run for num_iterations on each one before outputing the result. It can be used on videos as well, since you can extract all frames from video with ffmpeg

Config options:

  • input_folder path to folder where input images are located
  • output_folder folder where to write the output images to
  • n_neurons number of neurons per layer
  • activation_fn activation function after each hidden layer, "relu" or "tanh" are valid options
  • final_activation_fn activation function of the last layer
  • n_layers number of layers
  • batch_size
  • num_iterations
  • learning_rate

Running the script

   python3 npaint.py 

Credits

Released under the MIT License.
Authored and maintained by Dušan Josipović.

Blog dulex123.github.io  ·  GitHub @dulex123  ·  Twitter @josipovicd