I am trying to create a handwritten digit recogniser that uses a core ml model. I am taking the code from another similar project: https://github.com/r4ghu/iOS-CoreML-MNIST
But i need to incorporate my ml model into this project. This is my model:(Input image is 299x299) https://github.com/LOLIPOP-INTELLIGENCE/createml_handwritten
My question is what changes are to be made in the similar project so that it incorporates my coreml model
I tried changing the shapes to 299x299 but that gives me an error
In viewDidLoad
, you should change the number 28 to 299 in the call to CVPixelBufferCreate()
. In the original app, the mlmodel expects a 28x28 image but your model uses 299x299 images.
However, there is something else you need to change as well: replace kCVPixelFormatType_OneComponent8
with kCVPixelFormatType_32BGRA
or kCVPixelFormatType_32RGBA
. The original model uses grayscale images but yours expects color images.
P.S. Next time include the actual error message in your question. That's an important piece of information for people who are trying to answer. :-)