OCR-to-RAG pipeline for life science screenshots

PaddleOCR with preprocessing, scispaCy NER, figure/table detection,
citation extraction, and chunked Markdown output with frontmatter.
Includes watch mode and notebook reprocessing.
This commit is contained in:
2026-07-18 19:34:22 +00:00
parent 012549b4bc
commit a32b7508c7
68 changed files with 8708 additions and 0 deletions

105
config.yaml Normal file
View File

@@ -0,0 +1,105 @@
input:
paths:
- "~/Pictures"
- "/mnt/storage3/aman/screenshots"
patterns:
- "SCR-*.png"
- "*.jpg"
- "*.jpeg"
- "*.tiff"
- "*.bmp"
recursive: true
ocr:
engine: "paddleocr" # "paddleocr" | "tesseract" | "auto"
languages: ["en"] # For tesseract: eng, lat, deu, fra, spa, ita, por, chi_sim, jpn, kor
use_gpu: false
use_angle_cls: true
det_db_thresh: 0.3
det_db_box_thresh: 0.6
det_db_unclip_ratio: 1.5
rec_batch_num: 6
cpu_threads: 4
preprocess:
deskew: true
denoise: true
clahe: true
adaptive_threshold: true
remove_lines: true
max_dimension: 4096
processing:
workers: 4
batch_size: 10
retry_attempts: 2
timeout_per_image: 120
skip_existing: true
detectors:
figures:
enabled: true
model: "lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config"
confidence_threshold: 0.7
tables:
enabled: true
model: "microsoft/table-transformer-detection"
confidence_threshold: 0.7
captions:
enabled: true
model: "lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config"
confidence_threshold: 0.5
entities:
enabled: true
model: "en_core_sci_lg"
types:
- "GENE"
- "PROTEIN"
- "CHEMICAL"
- "SPECIES"
- "DISEASE"
- "CELL_LINE"
- "ORGANISM"
- "CELL_TYPE"
merge_entities: true
citations:
regex_enabled: true
grobid_enabled: false
grobid_url: "http://localhost:8070"
grobid_timeout: 30
chunking:
chunk_size: 1000
chunk_overlap: 200
separators: ["\n\n", "\n", ". ", " ", ""]
keep_separator: true
output:
base_directory: "./data/ocr_output"
format: "markdown"
organize_by: "date_run" # "date_run" | "source_dir" | "flat"
frontmatter:
- "source_path"
- "source_hash"
- "timestamp"
- "ocr_engine"
- "ocr_confidence_mean"
- "language"
- "detected_entities"
- "has_figures"
- "has_tables"
- "citations_found"
- "chunk_index"
- "total_chunks"
watch:
enabled: true
debounce_seconds: 5
ignore_patterns:
- ".DS_Store"
- "*.tmp"
- "*.partial"
- "*.crdownload"
db_path: "./data/processed_files.db"
poll_interval: 1.0