[AI] Clean up AI object mask post-processing#20954
Merged
TurboGit merged 2 commits intodarktable-org:masterfrom May 8, 2026
Merged
[AI] Clean up AI object mask post-processing#20954TurboGit merged 2 commits intodarktable-org:masterfrom
TurboGit merged 2 commits intodarktable-org:masterfrom
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.
Two post-processing steps were originally added to improve the AI mask quality. After testing and user feedback, both turned out to make things worse – removing them.
_morph_open_closeclipped real fine details (hair tips, fingers) and filled real concavities (gaps the model correctly identified). Stamped pixels back to hard 0/1, destroying soft alpha._guided_filter_refinesmoothed an already near-binary mask. Confirmed via live tuning: every non-zero radius softened the boundary without improving alignment.The roles they played are already covered without side effects:
_keep_seed_componenthandles disconnected blobs, potrace'sturdsizehandles tiny specks.Result
Post-processing is now: decoder →
_keep_seed_component→ potrace → feather. Model output reaches the path without displacement or smoothing.