Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Last active May 29, 2021 03:14
Show Gist options
  • Save anupamchugh/3ce30c61fda57463c77704fc6c537038 to your computer and use it in GitHub Desktop.
Save anupamchugh/3ce30c61fda57463c77704fc6c537038 to your computer and use it in GitHub Desktop.
func visionRequestDidComplete(request: VNRequest, error: Error?) {
DispatchQueue.main.async {
if let observations = request.results as? [VNCoreMLFeatureValueObservation],
let segmentationmap = observations.first?.featureValue.multiArrayValue {
let segmentationMask = segmentationmap.image(min: 0, max: 1)
self.outputImage = segmentationMask!.resizedImage(for: self.inputImage.size)!
maskInputImage()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment