Repository navigation
perf(ocr): convert PIL crops with numpy.asarray - #4920
Conversation
Signed-off-by: quangdungluong <luongquangdung00@gmail.com>
|
✅ DCO Check Passed Thanks @quangdungluong, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR replaces Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 1 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 7f9c724489. It read the code and did not run it.
The change swaps numpy.array for numpy.asarray in three OCR models. A PIL image exports its pixels as bytes, so the new array may be read-only. The three OCR libraries may write to the array or hand it to torch.from_numpy. I could not read their source here to check.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Use
numpy.asarrayto convert rendered PIL crops in RapidOCR, EasyOCR, and Nemotron OCR. This avoids the explicit owning-array copy made bynumpy.arrayat the crop boundary.Validation