Skip to content

Instantly share code, notes, and snippets.

@boaerosuke
Created August 16, 2017 16:27
Show Gist options
  • Save boaerosuke/f58352ec342d376df06c91971527bd2f to your computer and use it in GitHub Desktop.
Save boaerosuke/f58352ec342d376df06c91971527bd2f to your computer and use it in GitHub Desktop.
Perform a VNCoreMLRequest with VNImageRequestHandler
NSDictionary *options_dict = [[NSDictionary alloc] init];
NSArray *request_array = @[request];
VNImageRequestHandler *handler = [[VNImageRequestHandler alloc] initWithCIImage:self.imageToDetect options:options_dict];
dispatch_queue_t myCustomQueue;
myCustomQueue = dispatch_queue_create("com.aname.VNImageRequestHandlerQueue", NULL);
self.resultLabel.text = @"Predicting...";
dispatch_sync(myCustomQueue, ^{
[handler performRequests:request_array error:nil];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment