diff --git a/CHANGELOG.md b/CHANGELOG.md index 3de8e4fd..731337b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,12 @@ All notable changes to this project will be documented in this file. YOLOv10. Existing models remain available for inference, and YOLO dataset formats remain supported ([#572](https://github.com/roboflow/roboflow-python/pull/572)). +### Fixed + +- Directory uploads with `upload_dataset` now include `.webp` images and their + labels. They used to be skipped without a message + ([#577](https://github.com/roboflow/roboflow-python/pull/577)). + ## 1.7.3 ### Added diff --git a/roboflow/util/folderparser.py b/roboflow/util/folderparser.py index 047cdaee..7e9981ad 100644 --- a/roboflow/util/folderparser.py +++ b/roboflow/util/folderparser.py @@ -7,7 +7,7 @@ from .image_utils import load_labelmap -IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif", ".avif", ".heic"} +IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif", ".webp", ".avif", ".heic"} ANNOTATION_EXTENSIONS = {".txt", ".json", ".xml", ".csv", ".jsonl"} LABELMAPS_EXTENSIONS = {".labels", ".yaml", ".yml"} diff --git a/tests/util/test_folderparser.py b/tests/util/test_folderparser.py index 4f9ddb5b..61f2b65d 100644 --- a/tests/util/test_folderparser.py +++ b/tests/util/test_folderparser.py @@ -205,6 +205,16 @@ def test_coco_root_annotation_matches_images_in_subdirs(self): self.assertEqual(len(ann_data["annotations"]), 1, "Should have one annotation") self.assertEqual(ann_data["annotations"][0]["bbox"], [10, 20, 100, 200]) + def test_lists_webp_images_with_their_labels(self): + with tempfile.TemporaryDirectory() as tmpdir: + os.makedirs(os.path.join(tmpdir, "train")) + for name in ("a.webp", "a.txt", "b.jpg", "b.txt"): + with open(os.path.join(tmpdir, "train", name), "w") as f: + f.write("0 0.5 0.5 0.5 0.5\n") + parsed = folderparser.parsefolder(tmpdir) + labels = {image["file"]: image["annotationfile"]["file"] for image in parsed["images"]} + self.assertEqual(labels, {"/train/a.webp": "/train/a.txt", "/train/b.jpg": "/train/b.txt"}) + def _assertJsonMatchesFile(actual, filename): with open(filename) as file: