Last active
August 26, 2018 18:12
-
-
Save Ksen17/1d483b04e5d7f1f63bc52666eff9c308 to your computer and use it in GitHub Desktop.
Code for training style transfer model and converting it to Core ML format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turicreate as tc | |
#Here you should put path to images which already contains styles | |
style = tc.load_images('style/') | |
#Here you should put path to images which is used for train | |
content = tc.load_images('content/') | |
#Main function which train model| max_itearation should be find experimentaly | |
model = tc.style_transfer.create(style, content, max_iterations=50) | |
#Here you should put path to images which is used for test | |
test_images = tc.load_images('test/') | |
#Testing | |
stylized_images = model.stylize(test_images) | |
#Open explorer to see if everything works correctly | |
stylized_images.explore() | |
#export Core Ml model | |
model.export_coreml("styles.mlmodel") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment