From 7f8d091f50ce215b3f1bf55ef2a9208a2b14cb79 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 14:36:05 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/dataset/core.py | 17 +++++++---------- supervision/dataset/formats/coco.py | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/supervision/dataset/core.py b/supervision/dataset/core.py index 00c590b8..eeff8501 100644 --- a/supervision/dataset/core.py +++ b/supervision/dataset/core.py @@ -182,8 +182,7 @@ class DetectionDataset(BaseDataset): """ if images_directory_path: save_dataset_images( - images_directory_path=images_directory_path, - images=self.images + images_directory_path=images_directory_path, images=self.images ) if annotations_directory_path: Path(annotations_directory_path).mkdir(parents=True, exist_ok=True) @@ -193,7 +192,9 @@ class DetectionDataset(BaseDataset): if annotations_directory_path: annotation_name = Path(image_path).stem - annotations_path = os.path.join(annotations_directory_path, f"{annotation_name}.xml") + annotations_path = os.path.join( + annotations_directory_path, f"{annotation_name}.xml" + ) image_name = Path(image_path).name pascal_voc_xml = detections_to_pascal_voc( detections=detections, @@ -356,8 +357,7 @@ class DetectionDataset(BaseDataset): """ if images_directory_path is not None: save_dataset_images( - images_directory_path=images_directory_path, - images=self.images + images_directory_path=images_directory_path, images=self.images ) if annotations_directory_path is not None: save_yolo_annotations( @@ -454,8 +454,7 @@ class DetectionDataset(BaseDataset): """ if images_directory_path is not None: save_dataset_images( - images_directory_path=images_directory_path, - images=self.images + images_directory_path=images_directory_path, images=self.images ) if annotations_path is not None: save_coco_annotations( @@ -626,9 +625,7 @@ class ClassificationDataset(BaseDataset): else classification.get_top_k(1)[0][0] ) class_name = self.classes[class_id] - image_path = os.path.join( - root_directory_path, class_name, image_name - ) + image_path = os.path.join(root_directory_path, class_name, image_name) cv2.imwrite(image_path, image) @classmethod diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index 66246395..76178c53 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -157,7 +157,7 @@ def load_coco_annotations( coco_image["height"], ) image_annotations = coco_annotations_groups.get(coco_image["id"], []) - image_path = str(os.path.join(images_directory_path, image_name)) + image_path = os.path.join(images_directory_path, image_name) image = cv2.imread(image_path) annotation = coco_annotations_to_detections(