509 ignore blank patches#540
Conversation
|
Hi, I noticed some of our tests weren't running on your PR so I've just updated the triggers for some of our workflows. Could you merge main to pull these updates in and hopefully all tests will run now |
|
Ok I've rebased main into this branch. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more.
|
kallewesterling
left a comment
There was a problem hiding this comment.
This looks simple enough of an edit to me, and seems to contribute great functionality. I'll let @rwood-97 do the formal approve/request changes, but LGTM! Thank you so much for the contribution, @mradamcox!
rwood-97
left a comment
There was a problem hiding this comment.
I made one minor update just where something had been missed from the docs but otherwise looks great
Summary
This PR adds a boolean flag
skip_blank_patchestopatchify_all()(which is passed to_patchify_by_pixel()) that allows users to ignore patches that are entirely blank, i.e. all pixels within the patch have a value of 0.Default value of the flag is
Falseso that existing behavior will stay the same.Fixes #509
Describe your changes
The evaluation on the patch is simple, it just uses pillow's Image.get_bbox() and if None is returned the patch is assumed "empty".
I've added a pair of tests and images to test against, one RGB and one RGB with an alpha channel. The latter may not really be necessary... I realized that even if the map image has a "valid" patch that is all black (for example, a patch that is not around the collar because of a tilted image, but just within a black spot in the middle of the map), then that patch won't be useful for text-spotting anyway and can safely be skipped.
Checklist before assigning a reviewer (update as needed)
I'll set this to draft for now, and can add the docs and changelog once we confirm everything looks good and this is the right approach.
Reviewer checklist
Please add anything you want reviewers to specifically focus/comment on.