Skip to content

Instantly share code, notes, and snippets.

@backnotprop
Created January 13, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backnotprop/75a703bb20176cc2ad2b6acd68ab5ccf to your computer and use it in GitHub Desktop.
Save backnotprop/75a703bb20176cc2ad2b6acd68ab5ccf to your computer and use it in GitHub Desktop.
private func stylizeImage(cgImage: CGImage, model: MLModel) -> CGImage {
// size can change here if you want, remember to run right sizes in the fst evaluating script
let input = StyleTransferInput(input: pixelBuffer(cgImage: cgImage, width: 883, height: 720))
// model.prediction will run the style model on input image
let outFeatures = try! model.prediction(from: input)
// we get the image buffer after
let output = outFeatures.featureValue(for: "add_37__0")!.imageBufferValue!
// remaining code to convert image buffer here .....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment