supervision icon indicating copy to clipboard operation
supervision copied to clipboard

Request: as_coco Parameter Adjustment for sv.DetectionDataset in Supervision API

Open YoungjaeDev opened this issue 1 year ago • 7 comments

Search before asking

  • [X] I have searched the Supervision issues and found no similar feature requests.

Description

I am currently utilizing the as_coco function from sv.DetectionDataset within the Supervision API extensively and find it incredibly useful. However, I've encountered an issue when importing these labels into CVAT label tool. It seems that CVAT accepts category_id starting from 1, whereas the as_coco output starts with category_id at 0. This discrepancy leads to import failures.

Would it be possible to add a parameter to the as_coco function to adjust the starting index of category_id? This feature would greatly enhance compatibility with CVAT and streamline the workflow for users facing similar issues.

Thank you for considering this enhancement. I look forward to any updates you might have on this request.

Use case

No response

Additional

No response

Are you willing to submit a PR?

  • [ ] Yes I'd like to help by submitting a PR!

YoungjaeDev avatar May 09 '24 04:05 YoungjaeDev

Hi @YoungjaeDev 👋🏻 does CVAT requires only category_id to start from 1 or is it also image_id?

SkalskiP avatar May 09 '24 11:05 SkalskiP

@SkalskiP Just category_id. Image_id had no problem for importing data

YoungjaeDev avatar May 09 '24 15:05 YoungjaeDev

@SkalskiP

cvat.apps.dataset_manager.bindings.CvatImportError: Image C00_012_0007_000000: can't import annotation #0 (bbox): annotation has no label.

This is error log

YoungjaeDev avatar May 10 '24 05:05 YoungjaeDev

I am very willing to implement any necessary changes to facilitate your use of supervision in combination with CVAT. I just need to know if changing theimage_id numbering to start from 1 is the only requirement you have.

SkalskiP avatar May 13 '24 11:05 SkalskiP

@SkalskiP

No, the image_id starts with 1, which is a CVAT requirement, and Supervision does that. However, CVAT requires the category_id to start with 1, and Supervision starts with 0.

YoungjaeDev avatar May 13 '24 22:05 YoungjaeDev

Okey! 🙏🏻 I just need to consider how this affects the DetectionDataset class overall.

SkalskiP avatar May 14 '24 07:05 SkalskiP

Yes, thank you

YoungjaeDev avatar May 14 '24 11:05 YoungjaeDev