90fe705e8f
- 核心变更: - app/services/layout_detector.py: 重写布局检测器,从 PicoDet-S_layout_3cls 迁移到 DocLayout-YOLO (DocStructBench, imgsz=1024) - 支持多设备推理 (CPU/CUDA/DirectML/OpenVINO 等),自动探测最优设备 - 预处理改为 letterbox (保比例缩放+灰边 padding),坐标还原使用 (model_coord - padding) / ratio 公式 - 后处理解析 YOLOv10 end-to-end 输出 [N,6]=[x1,y1,x2,y2,conf,cls] - 类别映射改为按 class name 动态匹配 (figure/figure_group→picture, table/table_group→table) - 新增文件: - scripts/export_doclayout_yolo_onnx.py: DocLayout-YOLO ONNX 导出脚本 (独立 venv 运行) - tests/test_layout_detector.py: 布局检测器完整测试 (35 个用例) - 配置更新: - .env.example: 更新布局检测配置 (新增 LAYOUT_IMGSZ, LAYOUT_DEVICE, LAYOUT_DEVICE_ID) - app/config.py: Settings 类对应字段 - pyproject.toml: 新增 export 依赖组 (torch, doclayout-yolo, onnx 等) - 删除旧文件: - scripts/export_picodet_onnx.py: 旧 PicoDet 导出脚本 - 文档更新: - README.md: 更新环境变量说明 - 相关服务注释更新 (pdf_image_extractor.py, summary_persister.py, reextract_images.py) 此重构遵循项目初期开发阶段规范,大胆调整数据模型,无需向后兼容。
55 lines
1.3 KiB
TOML
55 lines
1.3 KiB
TOML
[project]
|
|
name = "hf-daily-papers"
|
|
version = "0.1.0"
|
|
description = "HuggingFace Daily Papers — 中文论文导览站"
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"fastapi>=0.115",
|
|
"uvicorn[standard]>=0.34",
|
|
"sqlalchemy>=2.0",
|
|
"httpx[http2]>=0.28",
|
|
"jinja2>=3.1",
|
|
"python-multipart>=0.0.18",
|
|
"pydantic>=2.0",
|
|
"pydantic-settings>=2.0",
|
|
"typer>=0.15",
|
|
"python-dotenv>=1.0",
|
|
"apscheduler>=3.10",
|
|
"chromadb>=1.0",
|
|
"pymupdf>=1.25",
|
|
"itsdangerous>=2.2.0",
|
|
"bleach>=6.4.0",
|
|
"onnxruntime>=1.17",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.0",
|
|
"pytest-asyncio>=0.24",
|
|
]
|
|
# 导出 DocLayout-YOLO ONNX 用(一次性脚本 scripts/export_doclayout_yolo_onnx.py,独立 venv 运行)
|
|
# GPU 推理:onnxruntime 与 onnxruntime-gpu/-directml 同环境冲突,不在此声明,
|
|
# 需手动二选一(见 .env.example 布局检测段说明)
|
|
export = [
|
|
"torch>=2.0",
|
|
"torchvision>=0.15",
|
|
"doclayout-yolo",
|
|
"onnx>=1.14",
|
|
"onnxscript", # torch 2.12+ 的 onnx exporter 需要
|
|
"onnxsim",
|
|
"huggingface-hub>=0.20",
|
|
]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["app"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=9.0.3",
|
|
"pytest-asyncio>=1.4.0",
|
|
]
|