mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
Update fraction
arg to employ a random selection (#8234)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
7451ca1f54
commit
5893d4483e
@ -120,7 +120,9 @@ class BaseDataset(Dataset):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise FileNotFoundError(f"{self.prefix}Error loading data from {img_path}\n{HELP_URL}") from e
|
raise FileNotFoundError(f"{self.prefix}Error loading data from {img_path}\n{HELP_URL}") from e
|
||||||
if self.fraction < 1:
|
if self.fraction < 1:
|
||||||
im_files = im_files[: round(len(im_files) * self.fraction)]
|
# 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)
|
||||||
return im_files
|
return im_files
|
||||||
|
|
||||||
def update_labels(self, include_class: Optional[list]):
|
def update_labels(self, include_class: Optional[list]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user