Fix/inpaint halo - #156
Open
qgeissmann wants to merge 3 commits into
Open
Fix/inpaint halo#156qgeissmann wants to merge 3 commits into
qgeissmann wants to merge 3 commits into
Conversation
…D val telea_inpaint_polys dilated the union of the polygons to inpaint and the polygons to exclude, then subtracted only the undilated exclusions. The dilation ring around each EXCLUDED polygon therefore stayed in the mask and was overwritten with inpainted content, painting a band roughly `downscale_factor` px wide that traces the outline of every instance that survived the crop. FixInstances calls this from the VALIDATION pipeline as well as the training one, so the band sat on both sides of the train/val split. A ring hugging every labelled instance is a cue a model can learn in place of the animal and then be rewarded for at validation time, so metrics computed before this fix were measured against crops carrying an outline of their own ground truth. Measured on real crops: 0.2-1.1% of each crop altered, concentrated entirely on instance boundaries. Nothing on disk was affected - the function mutates the in-memory crop, so the prepared dataset is unchanged and only the consumed crops carried it. Fix: subtract a dilated exclude mask, using the same kernel and iterations that created the ring. Regression check goes from 43.9% to 0.0% of pixels altered in a 25px band outside kept instances, while the instances being removed are still fully inpainted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyKzVebNKNYj82VZWTZU6Y
One config, two source trees: ARM=before runs develop with the halo present, ARM=after runs the patched tree. Everything else is held fixed, including the pyramid bug, so the pair attributes any difference to the halo alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyKzVebNKNYj82VZWTZU6Y
The controlled 50-epoch pair (1724716/1724717, one file different) settles what the cropped benchmark could not: the fix looks like an 8-point mAP regression on validation crops and is a decisive improvement in real inference - end-to-end F1 0.849 -> 0.878, recall 0.850 -> 0.895, touching-instance recall 0.749 -> 0.819, 1,244 more ground-truth instances matched. The cropped benchmark carried an outline of its own ground truth, so it was measuring the artefact. Also documents the pyramid native-scale bug, which is deliberately NOT fixed on this branch so the halo change stays attributable on its own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyKzVebNKNYj82VZWTZU6Y
asgersvenning
force-pushed
the
fix/inpaint-halo
branch
from
September 4, 2026 08:49
03e1bd9 to
d41b184
Compare
This branch has not been deployed
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.
Fixes #155