Created
March 4, 2019 14:38
-
-
Save giln/5721b8cf73272ec66f8384f29153572c to your computer and use it in GitHub Desktop.
predictionRequest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lazy var predictionRequest: VNCoreMLRequest = { | |
// Load the ML model through its generated class and create a Vision request for it. | |
do { | |
let model = try VNCoreMLModel(for: HandModel().model) | |
let request = VNCoreMLRequest(model: model) | |
// This setting determines if images are scaled or cropped to fit our 224x224 input size. Here we try scaleFill so we don't cut part of the image. | |
request.imageCropAndScaleOption = VNImageCropAndScaleOption.scaleFill | |
return request | |
} catch { | |
fatalError("can't load Vision ML model: \(error)") | |
} | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment