gmalivenko / onnx2keras

Convert ONNX model graph to Keras model format.
MIT License
195 stars 116 forks source link

Error when converting pretrained model: (raise ValueError("'%s' is not a valid scope name" % name) and 'functional_9/conv1/conv/Conv2D__6:0' is not a valid scope name #134

Open Lad4life opened 2 years ago

Lad4life commented 2 years ago

I tried to use the following code to change my onnx model to a keras model. I am using tensorflow version 2.1.0. My model is a densenet model that has been retrained for a new dataset. Let me know if additional information would be helpful. Thank you for your help!

#%% Load packages
import tensorflow as tf
import tf2onnx 
import onnx
#%%
from onnx2keras import onnx_to_keras

#%% Load onnx model
onnx_model=onnx.load("Test_10_DC_R_Image.onnx")

#%% Convert to keras model
k_model = onnx_to_keras(onnx_model, input_names=['input'])

This is the error I recieved:

raise ValueError("'%s' is not a valid scope name" % name)

ValueError: 'functional_9/conv1/conv/Conv2D__6:0' is not a valid scope name
deekshith1352 commented 2 years ago

Did you solve this error