39575cef49ca78067ad8717e943b08a2a3cd5eb6
Phase 1.7 follow-up to Script 38's per-CPA convergence. Tests whether the convergence holds at signature granularity, preempting "per-CPA aggregation washes out signal" reviewer attacks. Three signature-level labels per Big-4 signature (n=150,442): L1 PaperA non_hand iff cos > 0.95 AND dh <= 5 L2 K=3 perCPA hard assignment under per-CPA-fit components L3 K=3 perSig hard assignment under fresh signature-level fit Component comparison (per-CPA vs per-signature K=3): Component Per-CPA cos/dh/wt Per-Sig cos/dh/wt C1 hand-leaning 0.9457/9.17/0.143 0.9280/9.75/0.146 C2 mixed 0.9558/6.66/0.536 0.9625/6.04/0.582 C3 replicated 0.9826/2.41/0.321 0.9890/1.27/0.272 Component drift modest: max |dcos| = 0.018, max |ddh| = 1.15. Cohen kappa (binary, 1 = replicated): PaperA vs K=3 perCPA kappa = 0.6616 substantial PaperA vs K=3 perSig kappa = 0.5586 moderate K=3 perCPA vs K=3 perSig kappa = 0.8701 almost perfect Per-firm binary agreement PaperA vs K=3 perCPA: Firm A 86.13%, KPMG 77.46%, PwC 82.64%, EY 85.01%. Verdict: SIG_CONVERGENCE_MODERATE (all kappas >= 0.40; per-CPA aggregation captures most signature-level structure). Implication for v4.0: per-CPA K=3 is robust to aggregation level (kappa = 0.87 vs per-signature fit). The modest disagreement between K=3 and Paper A's box rule (kappa 0.56-0.66) reflects different decision geometries -- K=3 posterior soft boundary vs Paper A rectangle box -- not a fundamental signal disagreement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PDF Signature Extraction System
Automated extraction of handwritten Chinese signatures from PDF documents using hybrid VLM + Computer Vision approach.
Quick Start
Step 1: Extract Pages from CSV
cd /Volumes/NV2/pdf_recognize
source venv/bin/activate
python extract_pages_from_csv.py
Step 2: Extract Signatures
python extract_signatures_hybrid.py
Documentation
- PROJECT_DOCUMENTATION.md - Complete project history, all approaches tested, detailed results
- README_page_extraction.md - Page extraction documentation
- README_hybrid_extraction.md - Hybrid signature extraction documentation
Current Performance
Test Dataset: 5 PDF pages
- Signatures expected: 10
- Signatures found: 7
- Precision: 100% (no false positives)
- Recall: 70%
Key Features
✅ Hybrid Approach: VLM name extraction + CV detection + VLM verification
✅ Name-Based: Signatures saved as signature_周寶蓮.png
✅ No False Positives: Name-specific verification filters out dates, text, stamps
✅ Duplicate Prevention: Only one signature per person
✅ Handles Both: PDFs with/without text layer
File Structure
extract_pages_from_csv.py # Step 1: Extract pages
extract_signatures_hybrid.py # Step 2: Extract signatures (CURRENT)
README.md # This file
PROJECT_DOCUMENTATION.md # Complete documentation
README_page_extraction.md # Page extraction guide
README_hybrid_extraction.md # Signature extraction guide
Requirements
- Python 3.9+
- PyMuPDF, OpenCV, NumPy, Requests
- Ollama with qwen2.5vl:32b model
- Ollama instance: http://192.168.30.36:11434
Data
- Input:
/Volumes/NV2/PDF-Processing/master_signatures.csv(86,073 rows) - PDFs:
/Volumes/NV2/PDF-Processing/total-pdf/batch_*/ - Output:
/Volumes/NV2/PDF-Processing/signature-image-output/
Status
✅ Page extraction: Tested with 100 files, working ✅ Signature extraction: Tested with 5 files, 70% recall, 100% precision ⏳ Large-scale testing: Pending ⏳ Full dataset (86K files): Pending
See PROJECT_DOCUMENTATION.md for complete details.
Description
Automated extraction of handwritten Chinese signatures from PDF documents using hybrid VLM + Computer Vision approach. 70% recall, 100% precision.
Languages
Python
100%