Skip to content

Extract figure and table captions with a clean final image layout - #10

Merged
pierre-achkar merged 1 commit into
mainfrom
pilot/figure-table-captions
Nov 26, 2026
Merged

pierre-achkar merged 1 commit into
mainfrom
pilot/figure-table-captions

Conversation

@pierre-achkar

Copy link
Copy Markdown
Contributor

Summary

Figure/table crops omitted their captions and discarded caption/page metadata. Add a capped pilot and a full-corpus extraction command that retain metadata and render the original caption pixels into each image.

final/<task>/<overview-or-paper>/
  figures/*.png                 complete caption-inclusive images
  tables/*.png                  combined image for multi-page tables
intermediate/figures-tables/<task>/<overview-or-paper>/
  figures_tables_assets.jsonl    captions, pages, boxes and image paths
  figures_tables_extraction.json
  figures_tables_unmatched_captions.jsonl
  previous/                     preserved old assets and metadata

Publication validates source checksums and images, archives old assets, and updates index paths/counts and Markdown image links. Migration journals support retries; index promotion rolls back on failure. Text refreshes and the existing asset stage preserve the new layout. Continuation recovery uses conservative matching of adjacent ruled tables and retains review flags; rotated single-page crops and small source-caption clipping are covered.

Generated corpus files remain ignored and are not included in this PR. The README documents local execution without Docker.

Evidence

  • Before: caption metadata was discarded; images excluded captions. Original/fragment images and extraction records were mixed into final paper folders.
    After: final figures/tables folders contain flat PNGs; metadata and preserved originals live in intermediate.
  • cd inlg27/agent-in-the-loop/corpus-creation && PYENV_VERSION=uniagent pyenv exec python -m pytest -q: 270 passed, with five existing PyMuPDF/SWIG deprecation warnings.
  • Local full-corpus execution: 7,201 PDFs across 598 tasks, producing 41,680 images (13,894 figures; 27,786 tables).
  • Independent local verification: all final PNGs match their source outputs; 153,883 archived files and 66,035 original non-index files preserved. Task/index metadata agrees; CSV indexes are byte-identical. Repaired 6,849 Markdown image links.
  • Regression coverage includes rotated pages, continuation matching, interrupted copies/promotions, rollback, retry, and preservation of later OCR corrections during link repair. git diff --check passes.

Merge Danger

Door: two-way

Extraction and layout migration are explicit commands; merging does not run them. Original assets, metadata and changed Markdown are backed up in intermediate. Consumers must resolve current asset-metadata paths relative to the corpus-builder root.

Blast Radius: corpus

Image counts and metadata locations change when publication/migration runs. Automated extraction still requires review: 48 caption strings are unavailable, 1,839 captions lack extracted regions, and one source caption is clipped at the PDF boundary. Another 164 Markdown image links were already broken before this migration and remain unresolved.

Retain caption/page metadata and render caption-inclusive PDF crops.
Stage extraction artifacts in intermediate storage and publish flat PNGs.
Preserve old assets and repair metadata and Markdown links during migration.
@pierre-achkar
pierre-achkar merged commit 93cf5b2 into main Nov 26, 2026
12 of 22 checks passed
@pierre-achkar
pierre-achkar deleted the pilot/figure-table-captions branch November 26, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant