vietanhdev / anylabeling

Effortless AI-assisted data labeling with AI support from YOLO, Segment Anything (SAM+SAM2), MobileSAM!!
https://anylabeling.nrl.ai
GNU General Public License v3.0
2.2k stars 236 forks source link

✨ feat: split shape into two parts. #55

Closed liaozihang closed 1 year ago

liaozihang commented 1 year ago

Application scenario

In the process of using one's own model for segmentation, boundaries may sometimes be connected together and need to be cut off. However, the results may not be ideal when adjusted through negative points.

Example

Case

For example, the following image is marked: example In this case, manually segmenting the previous results can quickly achieve satisfactory results

Split Result

Result

Usage

In edit mode, hold down Alt and click LeftButton on the two points you want to split in sequence.

Format & check

format

There are many branches here, perhaps we can consider refactoring them. function-mousePressEvent@2x

vietanhdev commented 1 year ago

image

The split result may contain unwanted spaces between 2 parts. Therefore, I think this method is not good. Maybe a polyline for splitting will be better?

image

Like this one, but in polyline form.

I suggest the following action flow:

liaozihang commented 1 year ago

In fact, in my application scenario, the main focus is on the ground. The chair legs marked in orange in the image should not be included in the segmentation results. remove

So this temporary solution is proposed, which is to first divide it into two parts and then manually move the boundary. As shown in the following figure, four points were moved near markers 1 and 2, and five points were deleted as a result result

I agree with your suggestion. Adding an action would be more standardized. Using only one polyline for segmentation may not be very good, as the boundaries of the two parts after segmentation are still adjacent. Splitting with a closed polyline like the one below, removing the middle part of the polyline, seems to result in better results,but I haven't figured out how to implement it. CleanShot_2023-04-25_at_10 03 45