diff --git a/deploy/openvino/python/convertor.py b/deploy/openvino/python/converter.py similarity index 100% rename from deploy/openvino/python/convertor.py rename to deploy/openvino/python/converter.py diff --git a/docs/deploy/openvino/export_openvino_model.md b/docs/deploy/openvino/export_openvino_model.md index 4e1ee3082a573ef68d5a981b29ba0b0edf20035e..825fe5e1b22df279db54524c1be8e7995f9a7432 100644 --- a/docs/deploy/openvino/export_openvino_model.md +++ b/docs/deploy/openvino/export_openvino_model.md @@ -22,7 +22,7 @@ paddlex --export_inference --model_dir=/path/to/paddle_model --save_dir=./infere ``` cd /root/projects/python -python convertor.py --model_dir /path/to/inference_model --save_dir /path/to/openvino_model --fixed_input_shape [w,h] +python converter.py --model_dir /path/to/inference_model --save_dir /path/to/openvino_model --fixed_input_shape [w,h] ``` **转换成功后会在save_dir下出现后缀名为.xml、.bin、.mapping三个文件** 转换参数说明如下: diff --git a/paddlex/__init__.py b/paddlex/__init__.py index 6ea50e055c702540976d4a1f9a104ccabdd0b4d1..f3500efa1c27b69d6a8bfcc3d5c76a928a77e4ef 100644 --- a/paddlex/__init__.py +++ b/paddlex/__init__.py @@ -29,7 +29,7 @@ from . import det from . import seg from . import cls from . import slim -from . import convertor +from . import converter from . import tools from . import deploy diff --git a/paddlex/command.py b/paddlex/command.py index a433cbcfb8f308470e27b0bc31d4d55ef7a3c29c..7da76f2d03d8bd1530620218bcbcf6a70e18f600 100644 --- a/paddlex/command.py +++ b/paddlex/command.py @@ -168,7 +168,7 @@ def main(): logging.error( "paddlex --export_inference --model_dir model_path --save_dir infer_model" ) - pdx.convertor.export_onnx_model(model, args.save_dir, args.onnx_opset) + pdx.converter.export_onnx_model(model, args.save_dir, args.onnx_opset) if args.data_conversion: assert args.source is not None, "--source should be defined while converting dataset" diff --git a/paddlex/convertor.py b/paddlex/converter.py similarity index 96% rename from paddlex/convertor.py rename to paddlex/converter.py index 9aafa8d2d1d6e7e4ca4d434f6799876bdd8ae873..d6bc9153bb8c640297d53034a69c9205435b073d 100644 --- a/paddlex/convertor.py +++ b/paddlex/converter.py @@ -37,19 +37,17 @@ def export_onnx_model(model, save_dir, opset_version=10): "Only image classifier models, detection models(YOLOv3) and semantic segmentation models(except FastSCNN) are supported to export to ONNX" ) try: - import x2paddle - if x2paddle.__version__ < '0.7.4': - logging.error("You need to upgrade x2paddle >= 0.7.4") + import paddle2onnx except: logging.error( - "You need to install x2paddle first, pip install x2paddle>=0.7.4") + "You need to install paddle2onnx first, pip install paddle2onnx") + import paddle2onnx as p2o if opset_version == 10 and model.__class__.__name__ == "YOLOv3": logging.warning( - "Export for openVINO by default, the output of multiclass_nms exported to onnx will contains background. If you need onnx completely consistent with paddle, please use X2Paddle to export" + "Export for openVINO by default, the output of multiclass_nms exported to onnx will contains background. If you need onnx completely consistent with paddle, please use paddle2onnx to export" ) - x2paddle.op_mapper.paddle2onnx.opset10.paddle_custom_layer.multiclass_nms.multiclass_nms = multiclass_nms_for_openvino - from x2paddle.op_mapper.paddle2onnx.paddle_op_mapper import PaddleOpMapper - mapper = PaddleOpMapper() + p2o.op_mapper.opset9.paddle_custom_layer.multiclass_nms.multiclass_nms = multiclass_nms_for_openvino + mapper = p2o.PaddleOpMapper() mapper.convert( model.test_prog, save_dir,