You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to convert a Keras model to IR. I am getting an Unknown layer error. The layer is a custom layer implemented in Keras. My question - Can MMdnn handle custom Keras layers for conversion?
Detailed error info:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/keras/keras2_parser.py", line 69, in _load_model
from keras.applications.mobilenet import relu6
ImportError: cannot import name 'relu6'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/mmtoir", line 11, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 192, in _main
ret = _convert(args)
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 46, in _convert
parser = Keras2Parser(model)
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/keras/keras2_parser.py", line 126, in __init__
model = self._load_model(model[0], model[1])
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/keras/keras2_parser.py", line 78, in _load_model
'DepthwiseConv2D': layers.DepthwiseConv2D})
File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 492, in model_from_json
return deserialize(config, custom_objects=custom_objects)
File "/usr/local/lib/python3.5/dist-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python3.5/dist-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python3.5/dist-packages/keras/engine/network.py", line 1022, in from_config
process_layer(layer_data)
File "/usr/local/lib/python3.5/dist-packages/keras/engine/network.py", line 1008, in process_layer
custom_objects=custom_objects)
File "/usr/local/lib/python3.5/dist-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python3.5/dist-packages/keras/utils/generic_utils.py", line 138, in deserialize_keras_object
': ' + class_name)
ValueError: Unknown layer: BilinearUpSampling2D
Thanks in advance!
The text was updated successfully, but these errors were encountered:
I converted the custom layer to an inbuilt Keras layer and converted the model successfully to pytorch. I did not have to resort to modifying the Keras parser after all.
Platform (like ubuntu 16.04/win10): Ubuntu 16.04
Python version: Python3.5
Source framework with version (like Tensorflow 1.4.1 with GPU): Keras 2.2.4
Destination framework with version (like CNTK 2.3 with GPU): IR (eventually Pytorch 1.2.0)
Pre-trained model path (webpath or webdisk path):
Running scripts: mmtoir -f keras -d ir_best_model -n best_model.json -w best_model_weights.h5
Hi,
I am trying to convert a Keras model to IR. I am getting an Unknown layer error. The layer is a custom layer implemented in Keras. My question - Can MMdnn handle custom Keras layers for conversion?
Detailed error info:
Thanks in advance!
The text was updated successfully, but these errors were encountered: