Forráskód Böngészése

export onnx change x2paddle to paddle2onnx

Channingss 5 éve
szülő
commit
bec97d23ee

+ 0 - 0
deploy/openvino/python/convertor.py → deploy/openvino/python/converter.py


+ 1 - 1
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
 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三个文件**  
 **转换成功后会在save_dir下出现后缀名为.xml、.bin、.mapping三个文件**  
 转换参数说明如下:
 转换参数说明如下:

+ 1 - 1
paddlex/__init__.py

@@ -29,7 +29,7 @@ from . import det
 from . import seg
 from . import seg
 from . import cls
 from . import cls
 from . import slim
 from . import slim
-from . import convertor
+from . import converter
 from . import tools
 from . import tools
 from . import deploy
 from . import deploy
 
 

+ 1 - 1
paddlex/command.py

@@ -168,7 +168,7 @@ def main():
             logging.error(
             logging.error(
                 "paddlex --export_inference --model_dir model_path --save_dir infer_model"
                 "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:
     if args.data_conversion:
         assert args.source is not None, "--source should be defined while converting dataset"
         assert args.source is not None, "--source should be defined while converting dataset"

+ 6 - 8
paddlex/convertor.py → 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"
             "Only image classifier models, detection models(YOLOv3) and semantic segmentation models(except FastSCNN) are supported to export to ONNX"
         )
         )
     try:
     try:
-        import x2paddle
-        if x2paddle.__version__ < '0.7.4':
-            logging.error("You need to upgrade x2paddle >= 0.7.4")
+        import paddle2onnx 
     except:
     except:
         logging.error(
         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":
     if opset_version == 10 and model.__class__.__name__ == "YOLOv3":
         logging.warning(
         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(
     mapper.convert(
         model.test_prog,
         model.test_prog,
         save_dir,
         save_dir,