Implementation of A Neural Algorithm of Artistic Style by Leon A. Gatys, Alexander S. Ecker, Matthias Bethge . This rendition has been done using a VGG-16 neural network. Keras and Tensorflow has been used along with Scipy Fmin_l_bfgs_b optimizer.
Instead of using a random noise initializer for the input image, the existing content image's values are copied to the input image. Styling weights are customizable depending upon the user specifications.
keras==2.3.1
tensorflow==1.15.3
scipy==1.4.1
The styling, content and the output tensors are stacked up as the input image. This tensor passes into the VGG-16 and the output is also a 3xheightxwidthx3 tensor. The third tensor in the output layer (Generated Image) accounts for the smoothness. The activations in the 5th Convolutional block's conv_2 is used to calculate content cost and various other convolutional layers belonging to each block is used to calculate style cost. Here , the regularization factor used for styling is primarily higher than the others. Image has been saved after deprocessing and reverting the effects brought by the VGG-16 passage.
To execute and run these files, download and open them in your Jupyter lab/ Jupyter notebook
If you do not have jupyter notebook/lab, download them using the following code :
pip install jupyterlab
pip install notebook
After installing , you may open your notebooks using the following command:
jupyter lab
jupyter notebook
Please note that since my system couldn't handle any image size greater thatn 400x400x3 to pass into VGG, I have implemented this only for 128x196x3. If required, please set the image size to appropriate dimensions and train the network.