-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lrcn model to onnx error #145
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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: