buffer) //ᶃإۣܗऔಘϦΫΤετ let handler = VNImageRequestHandler(ciImage: inputImage) handler.perform([ VNDetectFaceRectanglesRequest(completionHandler: { (req, err) in //ᶄإۣܗͷऔಘ let req = request as! VNDetectFaceRectanglesRequest, let faces = req.results as! [VNFaceObservation], let face = faces.first.boundingBox, let rect = face.boundingBox, //ᶅإ෦ͷΓൈ͖ let faceImage: CIImage = cropImage(from inputImage, rect: rect)
idleClassifier.model) //ᶄVision+CoreMLͰਪΛ࣮ߦ let image: CIImage = ... let handler = VNImageRequestHandler(ciImage: image) try handler.perform([ VNCoreMLRequest(model: model) {(req, err) in //ᶅࣝผ݁Ռͷऔಘ let res = req.results!.first as! VNClassificationObservation let name = res.identifier let probability = Int(res.confidence * 100) print(“ࣝผ݁Ռ \(name):\(probability)%”)