diff options
author | HombreLaser <sebastian-440@live.com> | 2023-09-11 17:55:46 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-09-11 17:55:46 -0600 |
commit | 41cf8074bd145fdd8f066b7db52c92dec6cb4fa2 (patch) | |
tree | dddba8f5d84c0159613ed90cceb46932b9d46f04 | |
parent | 1786898ade958f443d453890b82444efbdbf1c29 (diff) |
Fix the dataset utils class
-rw-r--r-- | dataset_utils.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/dataset_utils.py b/dataset_utils.py index 865d5be..fda75d2 100644 --- a/dataset_utils.py +++ b/dataset_utils.py @@ -6,23 +6,21 @@ from pathlib import Path class DatasetUtils: def __init__(self) -> None: self.data_path = Path('./data') - # self.current_directory = 'I' """Convert the dataset to a 2 dimension array.""" def data_to_arrays(self): for dir in self.data_path.iterdir(): if not dir.is_dir(): continue - for file in dir.glob('/*.png'): + for file in dir.glob('*.png'): image = Image.open(str(file)).convert(mode='L') # Return the image's pixel values as an array alongside # the character that it represents. - yield (dir.name, numpy.asarray(image)) + yield (dir.name, numpy.asarray(image).ravel()) """Search for a file in the dataset.""" def search(self, filename: str): - dataset = [image for image in self.data_path.rglob('*.png')] - + pass def get_random_sample(self): pass |