replace onnxmltools by keras-onnx in one example (#1151)

This commit is contained in:
Xavier Dupré 2019-06-07 12:03:46 +02:00 committed by GitHub
parent d8ac0d64d0
commit d33dbb23b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ of a pretrained deep learning model obtained from
with *onnxruntime*. The conversion requires
`keras <https://keras.io/>`_,
`tensorflow <https://www.tensorflow.org/>`_,
`sklearn-onnx <https://github.com/onnx/sklearn-onnx/>`_,
`keras-onnx <https://github.com/onnx/keras-onnx/>`_,
`onnxmltools <https://pypi.org/project/onnxmltools/>`_
but then only *onnxruntime* is required
to compute the predictions.
@ -24,7 +24,7 @@ if not os.path.exists('dense121.onnx'):
from keras.applications.densenet import DenseNet121
model = DenseNet121(include_top=True, weights='imagenet')
from onnxmltools import convert_keras
from keras2onnx import convert_keras
onx = convert_keras(model, 'dense121.onnx')
with open("dense121.onnx", "wb") as f:
f.write(onx.SerializeToString())