Building the iOS application

We will create a new iOS application and import the ML model into it:

Once you select the .mlmodel file you will see the details about it and the important ones are ML model Type, Inputs, and Outputs. The Inputs type should be image because our input is going to be images of food item.

Once we have imported the model, we have to load the model into memory:

 do { /* Use the Swift class `MobileNet` Core ML generates from the model. To use a different Core ML classifier model, add it to the project and replace `MobileNet` with that model's generated Swift class. */ let model = try VNCoreMLModel(for: food_graph().model) ...

Get Machine Learning Projects for Mobile Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.