refactor: 抽象解耦推理引擎并重构为多Crate工作空间架构

- 移除 核心层与 tract/Tensor 的强耦合,前/后处理全线转用标准 ndarray
- 针对 OCR 与目标检测(Det)分别设计独立的强类型输出小枚举(OcrOutput/DetOutput)
- 利用 Trait 关联类型(Associated Type)InferenceEngine,OcrEngine,DetEngine 统一接口,实现多后端解耦
- 引入 thiserror 库,建立完备的强类型错误处理机制(DdddError/Result)
- 完成项目结构初拆,剥离为 ddddocr-core 和 ddddocr-tract
This commit is contained in:
2026-07-10 20:23:49 +08:00
parent 2d9cb35590
commit ea7fb43a14
34 changed files with 624 additions and 289 deletions

17
ddddocr-core/Cargo.toml Normal file
View File

@@ -0,0 +1,17 @@
[package]
name = "ddddocr-core"
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
[dependencies]
anyhow = "1.0.102"
image = "0.25.10"
base64 = "0.22.1"
imageproc = { version = "0.26.2", default-features = true }
serde = { workspace = true }
serde_json = "1.0.150"
ndarray = { workspace = true } # 继承自工作空间
thiserror = { workspace = true } # 刚好可以开始接入你需要的标准库错误处理
#serde = { workspace = true, features = ["derive"] }