Use Core ML Library in swift 3 (for iOS 11)

Updated 4 July 2023

Save

Core ML

Core ML provide the Various facility which is based on Machine learning , Here We are implementing related to Image , with the help of this we can search the image name or can get the name  of product.

Here is Link:

https://developer.apple.com/machine-learning/

For configuring in App , here we are taking the example of camera and after taking the image CoreML will provide the prediction name of image.

1: Take the permission in info.plist

To access your camera and photo library, there is still one last thing you must do. Go to your Info.plist and two entries: Privacy – Camera Usage Description and Privacy – Photo Library Usage Description. Starting from iOS 10, you will need to specify the reason why your app needs to access the camera and photo library.

2: Now go to this Sites:

https://developer.apple.com/machine-learning/

and Download  “Inception v3”  Model

3: Now drag and copy to target folder.

4: let’s add the model in our code. Go back to ViewController.swift. First, import the CoreML framework at the very beginning:

5: Now create outlet of Image View and label where we show the messages:

6:  Now on click the button:

7: On Select Image there delegate method will call:

 

8: Here “prediction.classLabel” this will return the prediction name of image.

 

 

 

 

 

 

 

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home