Export FoodVisionMini to CoreML model used in a iOS App ? #256
Replies: 2 comments
-
|
Hi there @marcoseraphin, Glad to hear you're trying to export your models for use on iOS devices! But this question is beyond the scope of the course, I'd try looking for help on the Core ML tools page: https://github.com/apple/coremltools |
Beta Was this translation helpful? Give feedback.
-
|
Hi @mrdbourke, thanx for your reply. I read all the documentation for the coremltools, but I could figure out the correct output parameter. Please find attached a working model (AIHandModel) with the correct output and the model with coremltools with the WRONG output. Thanx Marco |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
as showed in the course I created the FoodVisionMini sample and want to export / convert this model o a CoreML iOS Model using the coremltools.
I am using coremltools for this with this code:
I have a working iOS App code which performs with another model which was created using Microsoft Azure Vision.
The PyTorch exported model is loaded and a prediction is performed, but I am getting this error:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[VNCoreMLFeatureValueObservation identifier]: unrecognized selector sent to instance 0x2805dd3b0
When I check the exported model with Xcode and compare it with another model which is working with the sample iOS App code (created and exported from Microsoft Azure) I can see that the input (for image classification using the device camera) seems ok and is equal, but the output is totally different. (see screenshots)
The working model has two outputs:
My exported model using coremltools just has one export:
MultiArray(Float32) (name var_1620, I think this is the last feature layer output of the EfficentNetB2)
How do I change my model or my coremltools export to get the correct output for the prediction ?
I read the coreml documentation (https://coremltools.readme.io/docs/pytorch-conversion) and tried some GitHub samples.
But I never get the correct output.
How so I export the PyTorch model so that the output is correct and the prediction will work ?
Best
Marco
Beta Was this translation helpful? Give feedback.
All reactions