Search code examples
tensorflowkerascoremlcoremltools

How to convert keras model to corml format using coremltools


I want to convert my keras model to coreml using coremltools. When I try to do this, it gives me an error

ImportError: cannot import name 'relu6'

My tensorflow version is 1.5.1 My keras version is 2.1.6

The complete colab file is here:

https://colab.research.google.com/drive/1kSeErLsp_xaU37haUrwBO5jiNlV2RCll

I have already tried different versions of the modules but I am ready to try a new version I haven't tried


Solution

  • It looks like your installation still tries to use Keras 2.2.0, since the error in coremltools happens after it checks that the Keras version >= 2.2.0.

    Write keras.__version__ to see what version of Keras your notebook is really using.

    Try installing an older version of keras_applications, one that still has the relu6 function. It was recently changed. The problem with Keras is that stuff often moves around between minor versions.