From ef562590d1105a87653480efc1c5b831e8f14387 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 20 Oct 2023 15:17:53 -0600 Subject: Fix neural network --- dataset_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'dataset_utils.py') diff --git a/dataset_utils.py b/dataset_utils.py index fda75d2..927a78a 100644 --- a/dataset_utils.py +++ b/dataset_utils.py @@ -1,4 +1,4 @@ -import numpy +import numpy as np from PIL import Image from pathlib import Path @@ -16,8 +16,14 @@ class DatasetUtils: 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).ravel()) + yield (dir.name, np.asarray(image)) + """ + Get an image from the dataset. + """ + def get_image(self, path: str): + return np.asarray(Image.open(f"{self.data_path}/{path}").convert('1')) + """Search for a file in the dataset.""" def search(self, filename: str): pass -- cgit v1.2.3