artemnovichkov / iOS-11-by-Examples

👨🏻‍💻 Examples of new iOS 11 APIs
MIT License
3.32k stars 311 forks source link

How CoreML is working in the sample? #5

Closed hemangshah closed 7 years ago

hemangshah commented 7 years ago

I am seeing "Inceptionv3.mlmodel" file inside the "CoreML" group. I am sure that the answers are coming from that 91mb mlmodel file.

Few questions:

  1. Where did you get this file?
  2. Is this the dependency for this task? I mean, if we don't have this file, we couldn't do this?
  3. Why we need CoreML framework to work with this file?

P.S. Here this file means, mlmodel file.

artemnovichkov commented 7 years ago

Step by step:

  1. Apple provides several popular, open source models that are already in .mlmodel format, you can find it here. There is Core ML Tools, a python package, converting models from machine learning toolboxes into the Core ML format (more information here)
  2. Yes, this file contains trained ML model, and you can make no predictions without the model.
  3. You can use Vision framework as well. It works with internal system and custom app models.
hemangshah commented 7 years ago

Thanks! 💯

hemangshah commented 7 years ago

So how CoreML framework would work with this mlmodels?

artemnovichkov commented 7 years ago

Xcode generates special class with input and output format. You can see it if you click on .mlmodel in Xcode: screen shot 2017-06-28 at 16 10 12 All you need to do in the app is initiate model class and call prediction(input:) function.

hemangshah commented 7 years ago

That class has only 70 lines of code and the thing is I am not getting how exactly a CoreML work with that mlmodel to understand an object?

artemnovichkov commented 7 years ago

Do you want to now how trained model predicts any output or how Core ML use .mlmodel file?

hemangshah commented 7 years ago

How CoreML use .mlmodel file? Yes, I can see the generated source code, but what is the internal work of CoreML framework?

artemnovichkov commented 7 years ago

I guess, Core ML in depth WWDC session will help you 🚀