[Closed - duplicate] feat: add show_progress to from_yolo()#2352
[Closed - duplicate] feat: add show_progress to from_yolo()#2352yyq1043-cloud wants to merge 1 commit into
Conversation
|
|
@yyq1043-cloud, pls sign ^^ otherwise we cannot move forward... 🦝 |
There was a problem hiding this comment.
Pull request overview
Adds an optional progress indicator to YOLO dataset loading to improve UX on large datasets (per #183), by threading a show_progress flag from DetectionDataset.from_yolo() down into the annotation-loading loop.
Changes:
- Add
show_progress: bool = Falsetoload_yolo_annotations()and optionally wrap iteration with tqdm. - Add
show_progress: bool = FalsetoDetectionDataset.from_yolo()and pass through to the YOLO loader.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/supervision/dataset/formats/yolo.py | Adds optional tqdm wrapping around the image iteration when loading annotations. |
| src/supervision/dataset/core.py | Exposes show_progress on the public DetectionDataset.from_yolo() loader and passes it through. |
| # Lazy import tqdm to avoid hard dependency | ||
| if show_progress: | ||
| from tqdm import tqdm | ||
| iterator = tqdm(image_paths, desc="Loading YOLO annotations") | ||
| else: | ||
| iterator = image_paths | ||
|
|
||
| for image_path in iterator: |
| def from_yolo( | ||
| cls, | ||
| images_directory_path: str, | ||
| annotations_directory_path: str, | ||
| data_yaml_path: str, | ||
| force_masks: bool = False, | ||
| is_obb: bool = False, | ||
| show_progress: bool = False, | ||
| ) -> DetectionDataset: | ||
| """ |
Add optional show_progress parameter to load_yolo_annotations() and DetectionDataset.from_yolo() methods. When enabled, displays a tqdm progress bar during image annotation loading. Closes roboflow#183
Closing as duplicate of #2275 which merged the same feature.