Skip to content

Commit

Permalink
Update sign_language.py
Browse files Browse the repository at this point in the history
Imports issue fix
  • Loading branch information
tkb1902 authored Aug 7, 2024
1 parent 2b11a84 commit b72b924
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions ASL Recognition with Deep Learning/datasets/sign_language.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random
import numpy as np
from keras.utils import np_utils, to_categorical
from keras.utils import to_categorical
from keras.preprocessing import image
from os import listdir
from os.path import isdir, join
Expand Down Expand Up @@ -31,7 +31,7 @@ def load_data(container_path='datasets', folders=['A', 'B', 'C'],
# Get the images
x = paths_to_tensor(filenames).astype('float32')/255
# Store the one-hot targets
y = np.array(labels)
y = to_categorical(np.array(labels)) # Use to_categorical directly

x_train = np.array(x[:int(len(x) * (1 - test_split))])
y_train = np.array(y[:int(len(x) * (1 - test_split))])
Expand All @@ -52,9 +52,3 @@ def path_to_tensor(img_path, size):
def paths_to_tensor(img_paths, size=50):
list_of_tensors = [path_to_tensor(img_path, size) for img_path in img_paths]
return np.vstack(list_of_tensors)


"""
num_types = len(data['target_names'])
targets = np_utils.to_categorical(np.array(data['target']), num_types)
"""

0 comments on commit b72b924

Please sign in to comment.