onnx / keras-onnx

Convert tf.keras/Keras models to ONNX
Apache License 2.0
379 stars 109 forks source link

Conversion of TensorFlow Decision Forest (Random Forest) Model #728

Closed JulianHBuecher closed 3 years ago

JulianHBuecher commented 3 years ago

Hey guys, I have a question regarding the ability of keras-onnx to convert the TensorFlow Decision Forest Model. After reading your docs, you mentioned keras2onnx could handle converting subclassed models. In this case the DF-Model is such subclassed model. So it should work?

My Code:

data_path = "../Data"
model_path = "Models"
onnx_path = "ONNX_Models"
model_name = "goldeneye_model"

# Save model in .pb-Files
model.save(os.path.join(data_path,model_path,model_name),overwrite=True)

# Convert to ONNX
onnx_model = k2o.convert_keras(model,df_model_name)
onnx.save_model(onnx_model,os.path.join(data_path,onnx_path,model_name + ".onnx"))

During execution I got the following error: InvalidArgumentError: Cannot convert a Tensor of dtype resource to a NumPy array.

Are additional steps necessary here? Or is the compatibility of TF-DF missing?

Best regards, Julian