Skip to content

Instantly share code, notes, and snippets.

@0xjorgev
Created August 27, 2018 19:33
Show Gist options
  • Save 0xjorgev/e541bbf3c24668863c3e1926d9ba3170 to your computer and use it in GitHub Desktop.
Save 0xjorgev/e541bbf3c24668863c3e1926d9ba3170 to your computer and use it in GitHub Desktop.
import turicreate as tc
# Load the style and content images
styles = tc.load_images('style/')
content = tc.load_images('content/')
# Create a StyleTransfer model
model = tc.style_transfer.create(styles, content)
# Load some test images
test_images = tc.load_images('test/')
# Stylize the test images
stylized_images = model.stylize(test_images)
# Save the model for later use in Turi Create
model.save('mymodel.model')
# Export for use in Core ML
model.export_coreml('MyStyleTransfer.mlmodel')
#Show the results
stylized_images = model.stylize(test_images)
stylized_images.explore()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment