Added support for converting dataset to COCO#3
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for converting datasets to COCO format, a widely-used annotation format for computer vision models. The changes introduce new functionality for converting YOLO-format datasets to COCO format with train/validation/test splits.
- Adds COCO format conversion capability through new helper functions
- Implements class remapping functionality for annotation datasets
- Refactors argument parsing with improved formatting and new options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| yaya_tools/yaya_dataset.py | Adds COCO conversion command-line options and integration logic with progress tracking |
| yaya_tools/helpers/coco_format.py | New module providing COCO format conversion, RGBA-to-RGB conversion, and dataset splitting functions |
| yaya_tools/helpers/annotations.py | Adds class remapping functionality and reformats existing code for consistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| """ | ||
| COCO format required by e.g RFDETR | ||
|
|
||
| dataset/ | ||
| ├── train/ | ||
| │ ├── _annotations.coco.json | ||
| │ ├── image1.jpg | ||
| │ ├── image2.jpg | ||
| │ └── ... (other image files) | ||
| ├── valid/ | ||
| │ ├── _annotations.coco.json | ||
| │ ├── image1.jpg | ||
| │ ├── image2.jpg | ||
| │ └── ... (other image files) | ||
| └── test/ | ||
| ├── _annotations.coco.json | ||
| ├── image1.jpg | ||
| ├── image2.jpg | ||
| └── ... (other image files) | ||
| """ |
There was a problem hiding this comment.
Module docstring should use proper docstring format with triple quotes at the module level, not as a multi-line comment within the file.
|
|
||
| Returns: | ||
| tuple[sv.DetectionDataset, sv.DetectionDataset, sv.DetectionDataset]: | ||
| A tuple containing training validation and test datasets |
There was a problem hiding this comment.
Missing comma in docstring return description. Should be 'A tuple containing training, validation and test datasets'.
| A tuple containing training validation and test datasets | |
| A tuple containing training, validation and test datasets |
| import yaml | ||
| import logging |
There was a problem hiding this comment.
Import statements should be grouped and ordered: standard library imports first, then third-party imports. The yaml import should come after the standard library imports (logging, os, pathlib).
No description provided.