# Convert to CoreML but predict wrong

**URL:** <https://discuss.pytorch.org/t/convert-to-coreml-but-predict-wrong/66355>\
**Category:** Uncategorized\
**Created:** [January 11, 2020, 5:00am UTC](https://discuss.pytorch.org/t/convert-to-coreml-but-predict-wrong/66355 "2020-01-11T05:00:40Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [January 11, 2020, 5:43am UTC](https://discuss.pytorch.org/t/convert-to-coreml-but-predict-wrong/66355/5 "2020-01-11T05:43:37Z")

</div>

1. I don’t know, what `multiArray` is and I assume it’s part of the CoreML model? If so, I would recommend to ask in their board or github.

2. Yes, as answered [here](https://discuss.pytorch.org/t/how-to-add-preprocess-into-the-model/66154/4) with an example.

3. If neither you nor the engineer who was working on the model knows, which preprocessing was done, unfortunately we cannot help. My best shot is still to retrain the model with a _known_ preprocessing pipeline.  
Depending what preprocessing steps were done, ONNX might support them. E.g. normalization is a simple subtraction and division, which is supported by ONNX. More complicated image transformation might not be supported and you should implement them in CoreML or any other library supported by your deployment platform. Since we do not know which preprocessing was done, it won’t really help discussing, which methods are implemented in ONNX etc.

`MultiArray` doesn’t seem to be a PyTorch class and it seem your question was already answered in the [onnx-coreml github](https://github.com/onnx/onnx-coreml/issues/515).

> [@MarcSteven](#):
>
> Actually in Python training code, it should have preprocess\_input or normalize function, but if the training model doesn’t have the step, does it influence the result?

Normalization usually speeds up the training or makes it possible in the first place.

If normalization or any other preprocessing technique _was already_ used to train your model, you _have to_ add these steps to your deployment pipeline. Otherwise your model will just output random values and will most likely yield a bad accuracy.

---

_[View the full topic](https://discuss.pytorch.org/t/convert-to-coreml-but-predict-wrong/66355)._
