Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



34 Commits

Repository files navigation

Convolutional neural networks for artistic style transfer

This repository contains (TensorFlow and Keras) code that goes along with a related blog post and talk (PDF). Together, they act as a systematic look at convolutional neural networks from theory to practice, using artistic style transfer as a motivating example. The blog post provides context and covers the underlying theory, while working through the Jupyter notebooks in this repository offers a more hands-on learning experience.

If you have any questions about any of this stuff, feel free to open an issue or tweet at me: @copingbear.


  1. Install Python (2.7), pip and virtualenv on your machine. The instructions to do this depend on your operating system (Linux, macOS, Windows), but there are many tutorials on the internet that should help you get started.

  2. Once you have the above setup, it is quite easy to setup the requirements for the notebooks in this repository. First you clone a copy of this repository:

    git clone
  3. Then you navigate to this folder in your shell and then install the requirements needed for the Jupyter notebooks.

    cd artistic-style-transfer
    virtualenv venv
    source venv/bin/activate
    pip install -r requirements.txt
  4. If it doesn't exist, create a file called ~/.keras/keras.json and make sure it looks like the following:

        "image_dim_ordering": "tf",
        "epsilon": 1e-07,
        "floatx": "float32",
        "backend": "tensorflow"
  5. That's it! You can now start Jupyter and browse, open, run and modify the notebooks.

    jupyter notebook


iPython Notebooks

  1. A linear classifier for MNIST data
  2. A neural network-based classifier for MNIST data (Attempt 1)
  3. A neural network-based classifier for MNIST data (Attempt 2)
  4. A convolutional neural network-based classifier for MNIST data
  5. VGG Net (16) on ImageNet, the easy way
  6. Artistic style transfer with a repurposed VGG Net (16)

External Resources

  1. Related blog post
  2. Related talk slides