Complete iOS 12 Development Guide by Craig Clayton

Complete iOS 12 Development Guide by Craig Clayton

Author:Craig Clayton [Donny Wals]
Language: eng
Format: epub
Tags: COM051460 - COMPUTERS / Programming / Mobile Devices, COM046020 - COMPUTERS / Operating Systems / Macintosh, COM004000 - COMPUTERS / Intelligence (AI), Semantics
Publisher: Packt Publishing
Published: 2019-03-20T08:15:58+00:00


Implementing an image classifier

The code bundle for this chapter contains an app called ImageAnalyzer. This app uses an image picker to allow a user to select an image from their photo library to use it as an input for the image classifier you will implement. Open the project and explore it for a little bit to see what it does and how it works. Use the starter project if you want to follow along with the rest of this section.

To add an image classifier, you need to have a CoreML model that can classify images. On Apple's machine learning website (https://developer.apple.com/machine-learning/build-run-models/) there are several models available that can do image classification. An excellent lightweight model you can use is the MobileNet model; go ahead and download it from the machine learning page. Once you have downloaded the model, drag the model into Xcode to add it to the ImageAnalyzer project. Make sure to add it to your app target so that Xcode can generate the class interface for the model.

After adding the model to Xcode, you can open it to examine the Model Evaluation Parameters. The parameters tell you the different types of inputs and outputs the model will expect and provide. In the case of MobileNet, the input should be an image that is 224 points wide and 224 points high, as shown in the following screenshot:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.