Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge_multi_segment #52

Open
sarasilva-digitalsense opened this issue Jun 27, 2023 · 2 comments
Open

merge_multi_segment #52

sarasilva-digitalsense opened this issue Jun 27, 2023 · 2 comments

Comments

@sarasilva-digitalsense
Copy link

Hello! I'm trying to change the general_json2yolo script for my case-use and I've run into a problem I haven't been able to solve so far. Basically, I don't really understand what the function merge_multi_segment does, or how the segment information should come for it to work. This is how the function is called:

s = merge_multi_segment(ann['segmentation'])

and ann['segmentation'] for me is a list such as:

['199',
'127',
'198',
'128',
'196',
'128',
'195',
'129',
'191',
'129',
'190',
'130',
'185',
'130',
'184',
'131',
'177',
'131',
'175',
'133',
'169',
'133',
'166',
'136',
'165',
'136',
'162',
'139',
'162',
'141',
'163',
'142',
'180',
'142',
'181',
'141',
'196',
'141',
'197',
'142',
'197',
'144',
'196',
'145',
'196',
'147',
'195',
'148',
'195',
'149',
'194',
'150',
'194',
'151',
'193',
'152',
'193',
'153',
'204',
'153',
'205',
'152',
'206',
'152',
'208',
'150',
'209',
'150',
'212',
'147',
'212',
'142',
'211',
'141',
'211',
'139',
'208',
'136',
'208',
'135',
'207',
'134',
'208',
'133',
'217',
'133',
'218',
'134',
'219',
'134',
'220',
'133',
'220',
'132',
'221',
'131',
'221',
'130',
'220',
'129',
'220',
'128',
'219',
'127']

Besides from changing that into integers, what should i take into account, and what are the segments that the merge_multi_segment refers to

@ryouchinsa
Copy link

Related issue.
ultralytics/yolov5#11476 (comment)

Using the JSON2YOLO script, you can merge multiple polygons in the COCO format into a polygon in the YOLOv5/v8 format.

@glenn-jocher
Copy link
Member

The merge_multi_segment function in the JSON2YOLO script is designed to merge multiple polygons in the COCO format into a single polygon in the YOLOv5/v8 format. When calling the function, ensure that the input segmentation data is in the appropriate format, typically as a list of coordinates. Additionally, the function expects the input segments to form a continuous sequence representing the polygon vertices. Be sure to convert the input data into integer format as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants