Created
May 26, 2021 07:04
-
-
Save iosdevie/9b9c46d8a752bfb6d4f62b4e780bd3ef to your computer and use it in GitHub Desktop.
This file contains 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
private let trainedImageSize = CGSize(width: 28, height: 28) | |
func predictImage(image: UIImage){ | |
if let resizedImage = image.resize(newSize: trainedImageSize), let pixelBuffer = resizedImage.toCVPixelBuffer(){ | |
guard let result = try? MNIST().prediction(image: pixelBuffer) else { | |
return | |
} | |
navigationBar.topItem?.leftBarButtonItem?.title = "Predicted: \(result.classLabel)" | |
print("result is \(result.classLabel)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment