Repository navigation
Conversation
Section crops showed thin lines ending in small blobs, and narrow bridges to neighbouring fragments. Cause: Results.masks.xy builds polygons with ops.masks2segments(), whose default strategy 'all' joins every disjoint contour mask into one polygon using thin connecting line.
hannalee2
marked this pull request as draft
October 21, 2026 16:35
This branch was successfully 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.
Problem
Cropped section images showed thin one-pixel lines ending in small blobs, and narrow bridges to neighbouring fragments. They showed up in the segmented output.
Cause
Results.masks.xybuilds its polygons withops.masks2segments(), and its default strategy is"all". When a mask has several disconnected pieces (the section plus a debris fragment or a neighbouring section),"all"joins every contour into one polygon with thin connecting lines (merge_multi_segment).fillPolyinpost_processing.pythen kept the connectors and stray pieces in the crop.Checked against Ultralytics 8.4.54:
masks2segments(masks, strategy="all")is the default: linkmerge_multi_segmentjoins contours "with a thin line": ultralytics/data/converter.pyChanges
_largest_polygon), keeping only the largest contour by area, so connectors and stray pieces are dropped.yolo.mask_open_kernelsetting (default3,0disables), added to the YAML, the QC schema and the web schema.Example)
(Before)