Installation and Usage of the Paddle2ONNX Plugin¶
The Paddle2ONNX plugin for PaddleX provides the ability to convert PaddlePaddle static models to ONNX format models, leveraging the underlying Paddle2ONNX.
1. Installation¶
2. Usage¶
2.1 Parameter Introduction¶
Parameter | Type | Description |
---|---|---|
paddle_model_dir | str | Directory containing the Paddle model. |
onnx_model_dir | str | Output directory for the ONNX model, which can be the same as the Paddle model directory. Defaults to onnx . |
opset_version | int | The ONNX opset version to use. Defaults to 7 . |
2.2 Usage Method¶
Usage:
paddlex \
--paddle2onnx \ # Use the paddle2onnx function
--paddle_model_dir /your/paddle_model/dir \ # Specify the directory where the Paddle model is located
--onnx_model_dir /your/onnx_model/output/dir \ # Specify the output directory for the converted ONNX model
--opset_version 7 # Specify the ONNX opset version to use
Taking the ResNet18 model from the image_classification module as an example: