Skip to content

Instantly share code, notes, and snippets.

@codePrincess
Last active May 23, 2018 09:46
Show Gist options
  • Save codePrincess/382ef086a5fba5bfc99088332a2de6f7 to your computer and use it in GitHub Desktop.
Save codePrincess/382ef086a5fba5bfc99088332a2de6f7 to your computer and use it in GitHub Desktop.
Do a prediction with CoreML
let image = UIImage(named:"catinmood")
do {
let pixelBuffer = image.pixelBuffer(width: 227, height:227)
let classifierRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer!, options: [:])
try classifierRequestHandler.perform(classificationRequest!)
} catch {
print("something went terribly wrong during classification")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment