Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
First snippet of CoreML within ARBroadcaster
let mlModel: MLModel = Hotdog().model
var visionRequests = [VNRequest]()
let dispatchQueueML = DispatchQueue(label: "") // A Serial Queue
override func viewDidLoad() {
// Set up Vision Model
guard let hotDogModel = try? VNCoreMLModel(for: mlModel) else {
fatalError("Could not load model. Ensure Coreml model is in your XCode Project and part of a target (see: ")
// Set up Vision-CoreML Request
let classificationRequest = VNCoreMLRequest(model: hotDogModel, completionHandler: classificationCompleteHandler)
classificationRequest.imageCropAndScaleOption = VNImageCropAndScaleOption.centerCrop // Crop from centre of images and scale to appropriate size.
visionRequests = [classificationRequest]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment