Skip to content

Using Turi Create to apply machine learning based image filters via CoreML!

License

Notifications You must be signed in to change notification settings

LunarFlash/StyleTransferMachineLearning

Repository files navigation

Style Transfer Machine Learning Fun

This project uses Turi Create to produce a convolutional neural network in order to apply style transfer on images. Style transfer is a technique to transfer artistic style from one image to another. 😎

You can read about the white paper on style transfer machine learning here.

How to train your own model

  • Put 1 or more images in ./trainingdata/style (A style image is an image where you want to apply it's artistic style on other images, for best result you can use the image of a painting such as Van Gohn's Starry Night) starry

The result when applied against an image of Yosemite would look something like this: Yosemite

  • Install Anaconda's python 2.7 distribution here

  • Install Jupyter and Turi Create

pip install turicreate==5.0b2
python -m pip install --upgrade pip
python -m pip install jupyter
  • In a new Jupyter Notebook from this project's root folder run:
import turicreate as tc
style = tc.load_images('./trainingdata/style')
content = tc.load_images('./trainingdata/content')
model = tc.style_transfer.create(style, content)
model.export_coreml("Style.mlmodel")

jupyter

Then drag the model into the project, and integrate in ViewController.swift

Releases

No releases published

Packages

No packages published