Эх сурвалжийг харах

fix(paddle_to_pytorch_converter): improve error logging and update model list

- Enhanced error handling in the UniversalPaddleToPyTorchConverter by adding detailed logging of command output and errors during the Paddle2ONNX conversion process.
- Updated the model list in batch_convert_all_models to include a new model and comment out outdated entries, streamlining the conversion process.
zhch158_admin 3 өдөр өмнө
parent
commit
7f0ba699fa

+ 1 - 1
ocr_tools/pytorch_models/README.md

@@ -48,7 +48,7 @@ pytorch_models/
 ### 1. 安装依赖
 
 ```bash
-pip install torch torchvision opencv-python onnxruntime numpy pyyaml shapely pyclipper loguru python-dotenv
+pip install torch torchvision opencv-python onnx onnx2pytorch onnxruntime numpy pyyaml shapely pyclipper loguru python-dotenv
 ```
 
 ### 2. 准备模型文件

+ 6 - 2
ocr_tools/pytorch_models/paddle_to_pytorch_universal.py

@@ -93,6 +93,9 @@ class UniversalPaddleToPyTorchConverter:
         result = subprocess.run(cmd, capture_output=True, text=True)
         
         if result.returncode != 0:
+            print(f"命令: {cmd}")
+            print(f"输出stdout: {result.stdout}\n")
+            print(f"输出stderr: {result.stderr}\n")
             raise RuntimeError(f"Paddle2ONNX 转换失败:\n{result.stderr}")
         
         print(f"   ✅ ONNX已保存: {onnx_output_path}")
@@ -163,8 +166,9 @@ def batch_convert_all_models():
     
     MODELS = [
         # ("PicoDet_layout_1x", "Layout"),
-        ("PP-LCNet_x1_0_doc_ori", "Layout"),
-        ("RT-DETR-H_layout_17cls", "Layout"),
+        # ("PP-LCNet_x1_0_doc_ori", "Layout"),
+        # ("RT-DETR-H_layout_17cls", "Layout"),
+        ("PP-DocLayout_plus-L", "Layout"),
     ]
     
     base_dir = Path("~/.paddlex/official_models").expanduser()