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

COCO format Instance Segmentation labels conversion to YOLOv5 format #10954

Closed
2 tasks done
m-ali-awan opened this issue Feb 11, 2023 · 5 comments
Closed
2 tasks done
Labels
enhancement New feature or request Stale Stale and schedule for closing soon

Comments

@m-ali-awan
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar feature requests.

Description

Hi all,
Last week, I was struggling to convert instance segmentation labels to YOLOv5 format, to train the YOLOv5-seg models. To my knowledge, only Roboflow provides the functionality, and even for that, we have to upload our data, and if we can't pay to Upgrade, we have to make it public.
So, I have tried to write this functionality here:
https://github.com/m-ali-awan/yolov5-seg-labels-conversion.git
Using this, we can convert instance segmentation labels in COCO 1.0 format to Yolov5 format. If it can be of use to someone, that would be amazing.
Also, do let me know, in case of any mistake, as I am not that much expert 🙂
thanks

Use case

Right now popular labeling tools like CVAT, are not having Instance Segmentation labels export option in YOLOv5. We can do so, only using Roboflow, and for that, we have to make our dataset public. Using this, we can handle this conversion on our own.

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@m-ali-awan m-ali-awan added the enhancement New feature or request label Feb 11, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2023

👋 Hello @m-ali-awan, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

YOLOv8

Ultralytics YOLOv8 🚀 is our new cutting-edge, state-of-the-art (SOTA) model released at https://github.com/ultralytics/ultralytics. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection, image segmentation and image classification tasks. See the [YOLOv8 Docs] for details and get started with:

pip install ultralytics

@ryouchinsa
Copy link

Using this script, you can convert the COCO segmentation format to the YOLO segmentation format.
https://github.com/ultralytics/JSON2YOLO

Read this related issue.
#10621

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2023

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Apr 1, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2023
@almazgimaev
Copy link

Hi, @m-ali-awan,
You can do it in just a couple of clicks using apps from Supervisely ecosystem:

  1. Firstly, you need to upload your COCO format data to the Supervisely using Import COCO app.
    You can also upload data in another format one of the import applications

  2. Next, you can export the data from Supervisely in the YOLO v5/v8 format:

    • For polygons and masks (without internal cutouts), use the "Export to YOLOv8" app;
    class x1 y1 x2 y2 x3 y3 ...
    0 0.100417 0.654604 0.089646 0.662646 0.087561 0.666667 ...
    
    class x_center y_center width height
    0 0.16713 0.787696 0.207783 0.287495
    

I'm sure there are many apps in the Supervisely ecosystem that can help solve your tasks.

@glenn-jocher
Copy link
Member

Hi @almazgimaev-awan,

Thanks for letting us know your struggle in converting the instance segmentation labels to YOLOv5 format. Alessio is right; with Supervisely, you can easily convert your COCO format data to the YOLOv5 format using one of the plug-and-play solutions from their ecosystem.

If you have any questions or run into any issues, please feel free to ask for further support from our team or Supervisely's customer support team.

Best,
Glenn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale Stale and schedule for closing soon
Projects
None yet
Development

No branches or pull requests

4 participants