|
|
@@ -56,17 +56,28 @@ class ConfigManager:
|
|
|
)
|
|
|
|
|
|
# 设置版式检测默认配置
|
|
|
- layout_defaults = {
|
|
|
- 'module': 'mineru',
|
|
|
- 'model_name': 'layout',
|
|
|
- 'device': 'cpu',
|
|
|
- 'batch_size': 1,
|
|
|
- 'conf': 0.25,
|
|
|
- 'iou': 0.45
|
|
|
- }
|
|
|
- config['layout_detection'] = cls._merge_defaults(
|
|
|
- config.get('layout_detection', {}), layout_defaults
|
|
|
- )
|
|
|
+ layout_config = config.get('layout_detection', {})
|
|
|
+ # 如果是智能路由器,不需要设置默认值
|
|
|
+ if layout_config.get('module') != 'smart_router':
|
|
|
+ layout_defaults = {
|
|
|
+ 'module': 'mineru',
|
|
|
+ 'model_name': 'layout',
|
|
|
+ 'device': 'cpu',
|
|
|
+ 'batch_size': 1,
|
|
|
+ 'conf': 0.25,
|
|
|
+ 'iou': 0.45
|
|
|
+ }
|
|
|
+ config['layout_detection'] = cls._merge_defaults(
|
|
|
+ layout_config, layout_defaults
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ # 智能路由器配置验证
|
|
|
+ if 'models' not in layout_config or not layout_config['models']:
|
|
|
+ raise ValueError("smart_router requires 'models' configuration with at least one model")
|
|
|
+ # 设置默认策略
|
|
|
+ if 'strategy' not in layout_config:
|
|
|
+ layout_config['strategy'] = 'ocr_eval'
|
|
|
+ config['layout_detection'] = layout_config
|
|
|
|
|
|
# 设置VL识别默认配置
|
|
|
# vl_defaults = {
|