From the course: Machine Learning in Mobile Applications
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Client tie to Visual Recognition: Converting model - Xamarin Tutorial
From the course: Machine Learning in Mobile Applications
Client tie to Visual Recognition: Converting model
- [Instructor] And now we need to fill our Buffer that we're going to send along to our model. So what we're going to do is create a new CIImage, and we'll call it coreImage and that's going to be equal to new CIImage and we'll initialize that with our scaledImage. And then we'll begin an ImageContext. And in the ImageContext we'll specify the size so it will be a new CoreGraphics size and we'll use that 299, 299 again. And then we'll say CIContext, context is equal to CIContext FromContext. And we're going to use UIGraphics, GetCurrentContext, and null. Scroll that up a little bit and then we'll say context Render and we're going to Render our coreImage and put it into the buffer. And then we can end our ImageContext. And now we can get our result. So, var result equals our classifier which is an instance of our model. GetPrediction and we'll pass in our buffer and out is an NSError called error. And finally we'll set a returnValue equal to the result ClassLabel. And that's it. Now…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Core ML overview2m 10s
-
(Locked)
Core ML: Create Natural Language model6m 22s
-
(Locked)
Core ML: Create Visual Recognition model3m 22s
-
(Locked)
Client tie to Natural Language model5m 53s
-
(Locked)
Client tie to Visual Recognition model4m 14s
-
(Locked)
Client tie to Visual Recognition: Converting model2m 14s
-
(Locked)
Run the client app1m 45s
-
(Locked)
-
-