Hello everybody,
I used Google Cloud Platform to create a Machine learning model to perform computer vision. I downloaded the CoreML model from the cloud platform website and followed the instructions in the Google Tutorial for iOS model deployment.
This is my code currently.
My code executes and I receive this:
<VNClassificationObservation: 0x600002091d40> A7DBD70C-541C-4112-84A4-C6B4ED2EB7E2 requestRevision=1 confidence=0.332127 "CICAgICAwPmveRIJQWdsYWlzX2lv"
I receive a confidence value but I don't receive a label string.
Is there any step I am not taking?
With the model there is also a dict.txt file. Is there anything I have to do with that and that I am not doing?
Thank you!
I used Google Cloud Platform to create a Machine learning model to perform computer vision. I downloaded the CoreML model from the cloud platform website and followed the instructions in the Google Tutorial for iOS model deployment.
This is my code currently.
Code Block class Classification { private lazy var classificationRequest: VNCoreMLRequest = { do { let model = try VNCoreMLModel(for: AutoML().model) let request = VNCoreMLRequest(model: model, completionHandler: { [weak self] request, error in if let classifications = request.results as? [VNClassificationObservation] { print(classifications.first ?? "No classification!") } }) request.imageCropAndScaleOption = .scaleFit return request } catch { fatalError("Error! Can't use Model.") } }() func classifyImage(receivedImage: UIImage) { let orientation = CGImagePropertyOrientation(rawValue: UInt32(receivedImage.imageOrientation.rawValue)) if let image = CIImage(image: receivedImage) { DispatchQueue.global(qos: .userInitiated).async { let handler = VNImageRequestHandler(ciImage: image, orientation: orientation!) do { try handler.perform([self.classificationRequest]) } catch { fatalError("Error classifying image!") } } } }
My code executes and I receive this:
<VNClassificationObservation: 0x600002091d40> A7DBD70C-541C-4112-84A4-C6B4ED2EB7E2 requestRevision=1 confidence=0.332127 "CICAgICAwPmveRIJQWdsYWlzX2lv"
I receive a confidence value but I don't receive a label string.
Is there any step I am not taking?
With the model there is also a dict.txt file. Is there anything I have to do with that and that I am not doing?
Thank you!