|
|
@@ -111,3 +111,62 @@ paddlex --pipeline table_recognition_v2 --use_doc_orientation_classify=True --us
|
|
|
# 使用 system_profiler 命令查看 GPU 信息
|
|
|
system_profiler SPDisplaysDataType
|
|
|
```
|
|
|
+
|
|
|
+# 调试pipeline
|
|
|
+
|
|
|
+## 问题分析
|
|
|
+
|
|
|
+1. **配置文件中印章识别是关闭的**:
|
|
|
+ - 在 `PP-StructureV3.yaml` 中,`use_seal_recognition: False`
|
|
|
+ - 这意味着初始化时没有加载印章识别相关的模型
|
|
|
+
|
|
|
+2. **命令行参数冲突**:
|
|
|
+ - 您使用了 `--use_seal_recognition True` 参数试图启用印章识别
|
|
|
+ - 但由于初始化时没有加载相关模型,导致运行时检查失败
|
|
|
+
|
|
|
+3. **模型检查失败**:
|
|
|
+ - 在 `_LayoutParsingPipelineV2.check_model_settings_valid` 方法中检测到模型未初始化
|
|
|
+ - 错误消息:"Set use_seal_recognition, but the models for seal recognition are not initialized."
|
|
|
+
|
|
|
+## 解决方案
|
|
|
+
|
|
|
+### 方案3:使用专门的印章识别管道
|
|
|
+
|
|
|
+如果您主要需要印章识别功能,可以使用专门的印章识别管道:
|
|
|
+
|
|
|
+````bash
|
|
|
+paddlex --pipeline seal_recognition \
|
|
|
+ --input sample_data/300674-母公司现金流量表-扫描.png \
|
|
|
+ --device gpu:0 \
|
|
|
+ --use_doc_orientation_classify False \
|
|
|
+ --use_doc_unwarping False
|
|
|
+````
|
|
|
+
|
|
|
+## 完整的解决步骤
|
|
|
+
|
|
|
+1. **获取 PP-StructureV3 配置文件**:
|
|
|
+ ````bash
|
|
|
+ paddlex --get_pipeline_config PP-StructureV3 --save_path ./my_config
|
|
|
+ ````
|
|
|
+
|
|
|
+2. **修改配置文件**:
|
|
|
+ ````yaml
|
|
|
+ # 在 my_config/PP-StructureV3.yaml 中修改:
|
|
|
+ use_seal_recognition: True # 改为 True
|
|
|
+ ````
|
|
|
+
|
|
|
+3. **使用修改后的配置文件**:
|
|
|
+ ````bash
|
|
|
+ paddlex --pipeline ./my_config/PP-StructureV3.yaml \
|
|
|
+ --input sample_data/300674-母公司现金流量表-扫描.png \
|
|
|
+ --device gpu:0
|
|
|
+ ````
|
|
|
+
|
|
|
+## 为什么模型目录存在但无法加载
|
|
|
+
|
|
|
+虽然您在目录中看到了 `PP-OCRv4_server_seal_det` 模型文件,但问题不在于模型文件是否存在,而在于:
|
|
|
+
|
|
|
+1. **管道初始化阶段**:根据配置文件中的 `use_seal_recognition: False`,管道没有初始化印章识别相关的子管道
|
|
|
+2. **运行时检查**:当您通过参数设置 `use_seal_recognition=True` 时,系统检查发现相关模型未初始化,因此报错
|
|
|
+
|
|
|
+这是 PaddleX 的设计机制,确保只有在配置文件中明确启用的功能才会被初始化和使用。
|