Serban Coroiu
Serban Coroiu

Reputation: 41

CoreML model converted from TensorFlow unable to use inside Xcode

I've trained a model using Tensorflow GPU and Mobilenet v2 as pre-trained model and after that i tried to convert it to CoreML, as .mlmodel. I read that you need to add some pre/post preprocessing and to do that you can create a pipeline and use that pipeline inside Xcode. I've tried using their example that could be found here:

https://github.com/hollance/coreml-survival-guide/blob/master/MobileNetV2%2BSSDLite/ssdlite.py

The conversion was successfully but I can not use it in Xcode, I am getting this error and i have no idea how to solve it because this process is not fully documented. The error:

Error Domain=com.apple.vis Code=3 "The VNCoreMLTransform request failed" UserInfo={NSLocalizedDescription=The VNCoreMLTransform request failed, NSUnderlyingError=0x2828e8b40 {Error Domain=com.apple.CoreML Code=0 "Failed to evaluate model 1 in pipeline" UserInfo={NSLocalizedDescription=Failed to evaluate model 1 in pipeline, NSUnderlyingError=0x2828e9560 {Error Domain=com.apple.CoreML Code=0 "Shape (2 x 1 x 1917) was not in enumerated set of allowed shapes" UserInfo={NSLocalizedDescription=Shape (2 x 1 x 1917) was not in enumerated set of allowed shapes}}}}}

Also this is how model looks:

enter image description here enter image description here enter image description here

Upvotes: 0

Views: 613

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7892

One of your models produces data in the shape (2 x 1 x 1917) but the next model in the pipeline does not allow inputs of this shape.

You need to make the input/output shapes match between the different models in the pipeline. (And make sure the model actually produces data in those shapes; just because the mlmodel says the shape is something doesn't mean that is actually correct.)

Upvotes: 1

Related Questions