In machine learning, if you need to use
.mlmodelto process your images, you will inevitably encounter a very important problem.
First things first, all the
.mlmodels have the
Model Evaluation Parameters, for this one,it asks for the current type of the image (Color 299 x 299).
We can code this first to use the function.
And brianadvent created q simple function to convert an UIImage to CVPixelBuffer for the use with Core ML. Click to Dowload
But it’s different from our needs, so let’s do some changes.
brianadvent used the
CroeVideo, and defined a stucture named
we only need to make few changes:
The rest of codes do not require any changes.And you can use this file to convert your image correctly.