From 5e3da9bbf95fedcc1cbdc868cfccbcdf5bd04af7 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 7 Apr 2024 21:37:28 +0200 Subject: [PATCH] PEP660 support for `pip install -e .` (#9851) Signed-off-by: Glenn Jocher --- pyproject.toml | 2 +- ultralytics/data/base.py | 4 +--- ultralytics/data/dataset.py | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 535baf6bbd..fa723d9b74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ # For comprehensive documentation and usage instructions, visit: https://docs.ultralytics.com [build-system] -requires = ["setuptools>=43.0.0", "wheel"] +requires = ["setuptools>=57.0.0", "wheel"] build-backend = "setuptools.build_meta" # Project settings ----------------------------------------------------------------------------------------------------- diff --git a/ultralytics/data/base.py b/ultralytics/data/base.py index b379eefae1..946cb1f11b 100644 --- a/ultralytics/data/base.py +++ b/ultralytics/data/base.py @@ -122,9 +122,7 @@ class BaseDataset(Dataset): except Exception as e: raise FileNotFoundError(f"{self.prefix}Error loading data from {img_path}\n{HELP_URL}") from e if self.fraction < 1: - # im_files = im_files[: round(len(im_files) * self.fraction)] - num_elements_to_select = round(len(im_files) * self.fraction) - im_files = random.sample(im_files, num_elements_to_select) + im_files = im_files[: round(len(im_files) * self.fraction)] # retain a fraction of the dataset return im_files def update_labels(self, include_class: Optional[list]): diff --git a/ultralytics/data/dataset.py b/ultralytics/data/dataset.py index 3f8c85a7db..fed360ce91 100644 --- a/ultralytics/data/dataset.py +++ b/ultralytics/data/dataset.py @@ -1,4 +1,5 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license + import contextlib import json from collections import defaultdict