Samples of ONNX export

How do I create ONNX files?

Below, several ways of exporting certain models as ONNX from different frameworks are shown using examples. The samples do not claim to be complete and only serve to provide a primary overview. For more detailed documentation, refer to the documentation for the respective framework.

The listed examples are limited to the creation of an ONNX file. Examples for conversion to make the file available in TwinCAT can be found here: Converting ONNX to XML and BML as well as in the ZIP archive for the linked samples (see below) in the PythonAPI_mllib folder.

Overview of available samples

Python package

Model type

Option

Comment

Sample link

PyTorch

MLP Regressor

 

 

GoToPage

Keras

MLP Regressor

 

 

GoToPage

Scikit-learn

MLP Regressor

 

 

GoToPage

Scikit-learn

MLP Classifier

 

ONNX graph must be adapted

GoToPage

Scikit-learn

SVR

 

 

GoToPage

Scikit-learn

SVC

decision_function_shape='ovo'

 

GoToPage

Scikit-learn

k-means

 

Meta Key must be entered in ONNX.

GoToPage

Scikit-learn

PCA

 

 

GoToPage

Scikit-learn

Decision Tree Classifier

 

 

GoToPage

Scikit-learn

Decision Tree Regressor

 

 

GoToPage

Scikit-learn

Extra Tree Classifier

 

 

GoToPage

Scikit-learn

Extra Tree Regressor

 

 

GoToPage

Scikit-learn

Extra Trees Classifier

 

 

GoToPage

Scikit-learn

Extra Trees Regressor

 

 

GoToPage

Scikit-learn

Random Forest Classifier

 

 

GoToPage

Scikit-learn

Random Forest Regressor

 

 

GoToPage

LightGBM

Random Forest Regressor

 

ONNX graph must be adapted

GoToPage

Scikit-learn

Gradient Boosting Classifier

 

 

GoToPage

Scikit-learn

Gradient Boosting Regressor

 

 

GoToPage

Scikit-learn

Hist Gradient Boosting Classifier

 

 

GoToPage

Scikit-learn

Hist Gradient Boosting Regressor

 

 

GoToPage

XGBoost

XGBClassifier

Not all configurations allow an ONNX export

Package version <= 1.5.2 or >= 1.7.4 required

GoToPage

XGBoost

XCBRegressor

Not all configurations allow an ONNX export

Package version <= 1.5.2 or >= 1.7.4 required

GoToPage

LightGBM

LGBMRegressor

Not all configurations allow an ONNX export

 

GoToPage

LightGBM

LGBMClassifier

 

ONNX graph must be adapted

GoToPage

All samples can be downloaded here as a ZIP archive: Beckhoff_ONNX_Samples.zip