Repository navigation
ocr(paddleocr-vl-1.8): stage chunk temp images as threaded lossless BMP - #224
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Speeds up per-chunk image staging in
ocr/paddleocr-vl-1.8.pyby replacing sequentialPNG(compress_level=1)writes with parallel uncompressed 24-bit RGB.bmpwrites sized fromCPU_CORES(capped at 8).datasets/Arrow access); PIL decode, EXIF/mode normalization, and BMP writes run in aThreadPoolExecutor(_stage_chunk_images) while preserving exact row ordering and per-row error isolation._image_workers()sizes threads fromCPU_CORES(the HF Jobs quota, capped at 8) rather than hostos.cpu_count().strict=Truetozip(valid_indices, results, strict=True)and documents the ablation inocr/CLAUDE.md./tmp(~18 MB/page for 6 MP book scans → ~1.15 GB per 64-page chunk, cleaned up immediately at the end of each chunk'sTemporaryDirectory).Prior ablation evidence
Measured in a controlled 64-page ablation on
a10g-small(Job6b118264):PNG(compress_level=1):21.84 sencode,41.86 spredict()(1.53 pg/s).BMP:2.41 sencode (9.1×faster),33.11 spredict()(1.93 pg/s,+26%), with64/64exact text match vs PNG.use_queues=Trueandvl_rec_max_concurrency=64gave no meaningful gain in the same ablation and are intentionally left out.Verification
python3 -m py_compile ocr/paddleocr-vl-1.8.py_image_workers(CPU_CORESparsing/caps) and_stage_chunk_images(ordering, corrupt-row isolation, empty slice, single-worker path, pixel-for-pixel equality vs PNG across RGB/RGBA inputs).