6781c00d5b75b127d6de618eac15497d42523494
Resolve the Firm C/D "two-snapshot" inconsistency from the co-author rev9.1 review. Root cause was NOT stale data but two live firm-assignment keys (assigned_accountant-> registry firm vs the excel_firm column) used inconsistently across tables; standardize on the registry key, which the headline Table IV/II-b already use. Sole difference = 379 signatures with excel_firm=C but registry firm=D; A and B identical under both keys. Numbers (all DB-verified, registry key, n=150,442): - Table II-c Firm C/D recomputed (was mixing keys within firm C across periods, which manufactured the spurious "third value" 38,934); now C 22,449+16,164=38,613, D 9,945+7,188=17,133, all four firms reconcile. - Table VI C/D counts + S III-B prose + Fig 3/6 captions -> 150,442. - S V-B HC-rate text -> Firm C 21.6->26.7%, Firm D 22.0->28.0%. Note on R4: the reviewer (PDF-only) asked to change S IV-C to 26.5/28.5 to match Table II-c; DB verification showed the reverse - S IV-C's 26.7/28.0 are correct and Table II-c was the stale outlier, so II-c was aligned to S IV-C (data-correct, opposite to the literal instruction). Accountant counts (R2 reviewer "179>171 impossible" = false positive; three distinct, all-reproducible universes): Table I + S III-B -> 457 (>=2 sig, owns the 150,442 signatures); Table III documented as the 437 with >=10 signatures (K=3 GMM subset, reproduces A=82.5/B=0.0/C=1.0/D=1.9% exactly); bootstrap 179/280 unchanged (accountant_id key, correct and invariant to the A-vs-BCD contrast). R3 (corpus scope): S III-B reworded - corpus = all retrievable reports, Big-4 as the primary analysis sample (removes the "corpus = four firms" vs "non-Big-4 in robustness" contradiction); per-firm counts now explicitly labelled A/B/C/D. R5 (spelling): unify to American (artefact->artifact x11, centred->centered, behaviour->behavior, analyse(d)->analyze(d), favours->favors). R6: delete non-standard "(+)" marker in S IV-C. Figures regenerated under the registry key: make_fig3_density.py and make_fig6_sensitivity.py switched to the assigned_accountant join (fig3/fig6 n=150,442); fig4/fig5 refreshed. FE/LOYO/bootstrap re-validated exactly (ORs 0.116/0.061/0.070, LOYO 53.1-54.9pp, full 53.7pp). Add CANONICAL_NUMBERS_rev9.1.md with full provenance, the analyzable/GMM definitions, and the firm-key root cause. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K35dXhb9XEM1mnYz6SSHpU
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.
16 MiB
Languages
Python
100%