This may come as a bit of an anticlimax for someone expecting some hardcore coding, but its simplicity definitely pays tribute to the effort of Apple's engineers in making this framework one of the most accessible ways to work with a ML model. Without further ado, let's put the final pieces together; we start by instantiating an instance of our model we had imported in the previous section.
Near the top, but within the body of the ViewController class, add the following line:
let model = Inceptionv3()
Our model is now ready; we return to the onFrameCaptured method, starting from where we previously left off, and add the following code snippet:
let prediction = try? self.model.prediction(image:scaledPixelBuffer)
// Update label
DispatchQueue.main.sync {
classifiedLabel.text = prediction?.classLabel ?? "Unknown"
}
In case you...