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
@harvitronix hello Harvey, thanks to your really good tutorial for video classification.
I followed your instruction to train my own lrcn video classification model and it works well under tensorflow&keras. But when I tried to convert this .hdf5 model to .onnx, I met this error below:
Traceback (most recent call last):
File "/workspace/h52onnx.py", line 15, in
onnx_model = keras2onnx.convert_keras(model, model.name)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/main.py", line 95, in convert_keras
return convert_topology(topology, name, doc_string, target_opset, channel_first_inputs)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/topology.py", line 243, in convert_topology
get_converter(operator.type)(scope, operator, container)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/ke2onnx/main.py", line 94, in convert_keras_flatten
shape_len = len(iop.input_shape)
File "/opt/conda/lib/python3.6/site-packages/keras/engine/base_layer.py", line 918, in input_shape
raise AttributeError('The layer has never been called ' AttributeError: The layer has never been called and thus has no defined input shape.
For your information, I only changed input size from self.input_shape = (seq_length, 80, 80, 3) to self.input_shape = (seq_length, 320, 320, 3).
Convert code listed below:
import keras
import keras2onnx
import onnx
from keras.models import load_model
@harvitronix hello Harvey, thanks to your really good tutorial for video classification.
I followed your instruction to train my own lrcn video classification model and it works well under tensorflow&keras. But when I tried to convert this .hdf5 model to .onnx, I met this error below:
env info:
tf-gpu 1.14
tb-nightly
cuda10.1
onnx 1.7.0
keras2onnx 1.6.1
python3.6
Traceback (most recent call last):
File "/workspace/h52onnx.py", line 15, in
onnx_model = keras2onnx.convert_keras(model, model.name)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/main.py", line 95, in convert_keras
return convert_topology(topology, name, doc_string, target_opset, channel_first_inputs)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/topology.py", line 243, in convert_topology
get_converter(operator.type)(scope, operator, container)
File "/opt/conda/lib/python3.6/site-packages/keras2onnx/ke2onnx/main.py", line 94, in convert_keras_flatten
shape_len = len(iop.input_shape)
File "/opt/conda/lib/python3.6/site-packages/keras/engine/base_layer.py", line 918, in input_shape
raise AttributeError('The layer has never been called '
AttributeError: The layer has never been called and thus has no defined input shape.
For your information, I only changed input size from self.input_shape = (seq_length, 80, 80, 3) to self.input_shape = (seq_length, 320, 320, 3).
Convert code listed below:
import keras
import keras2onnx
import onnx
from keras.models import load_model
model = load_model('/workspace/lrcn-images.050-1.443.hdf5')
onnx_model = keras2onnx.convert_keras(model, model.name)
temp_model_file = '/workspace/model.onnx'
onnx.save_model(onnx_model, temp_model_file)
Kindly help. Thanks again.
The text was updated successfully, but these errors were encountered: