Open monteksingh opened 4 years ago
The example for efficientNet conversion can be found in our nightly build here. It needs tensorflow >= 2.1.0
and set keras.backend.set_learning_phase(0)
.
I tried to convert the Model using the following dependencies
tensorflow_gpu = 2.3.0 keras=2.4.3 efficientnet= 0.0.4
Code
import keras2onnx
from keras.models import Model, load_model
import efficientnet
model = load_model(model_path, compile=False)
# converting to ONNX
onnx_model = keras2onnx.convert_keras(model, name=model.name)
keras2onnx.save_model(onnx_model, onnx_model_path)
After doing so I get
WARN: No corresponding ONNX op matches the tf.op node model_2/swish_69/IdentityN of type IdentityN The generated ONNX model needs run with the custom op supports. The ONNX operator number change on the optimization: 982 -> 601
Pls help me understand how can I resolve this issue.
tensorflow 2.3.0 support is ongoing, please use tf 2.2 at this moment.
This IdentityN
is recently supported, so please pull keras2onnx from master source code rather than pypi.
See my previous answer, you need pull keras2onnx from master source code:
pip install -U git+https://github.com/onnx/keras-onnx
Thanks for your help.
I followed all the steps and the conversion was successful.
But the issue now is, I wanted to import this model to Snap Lens Studio. But when I import the ONNX model, I get this error
'Transpose' layer type is not supported
I know this issue is not related to this repo.
But if anyone is facing the same issue, as I am. Pls help....
Should we still use TF 2.2 for this?
Also here: https://github.com/onnx/keras-onnx/blob/master/applications/nightly_build/test_efn.py#L27
is this the standard efficientnet from tf.keras?
my error is the following: AssertionError: functional_3/efficientnetb6/block7c_se_reduce/BiasAdd:0 is disconnected, check the parsing log for more details.
I'm using concat of BERT model & ENet.
I trained an Efficientnet B2 model using [https://pypi.org/project/efficientnet/]
I am using tensorflow==1.14.0 numpy==1.17.0 onnx==1.7.0 Keras==2.2.4 efficientnet==0.0.4
During the conversion, I get multiple warnings
And the conversion fails with the following error.
AssertionError: batch_normalization_1/keras_learning_phase:0 is disconnected, check the parsing log for more details.