Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public func handleClassification(request: VNRequest, error: Error?) {
- guard let observations = request.results as? [VNClassificationObservation]
- else { fatalError("unexpected result type from VNCoreMLRequest") }
- guard let best = observations.first else {
- fatalError("classification didn't return any results")
- }
- DispatchQueue.main.async {
- if best.identifier.starts(with: "Unknown") || best.confidence < 0.50 {
- print("Mhm, no cat or absolutely not sure about it's mood")
- } else {
- print("This cat seem to be in a \(best.identifier) mood (\(best.confidence) sure"
- }
- }
- }
Add Comment
Please, Sign In to add comment