Skip to content

Commit 0019c0e

Browse files
Merge pull request #8 from tkb1902/patch-1
Update sign_language.py
2 parents 2b11a84 + b72b924 commit 0019c0e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

ASL Recognition with Deep Learning/datasets/sign_language.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
22
import numpy as np
3-
from keras.utils import np_utils, to_categorical
3+
from keras.utils import to_categorical
44
from keras.preprocessing import image
55
from os import listdir
66
from os.path import isdir, join
@@ -31,7 +31,7 @@ def load_data(container_path='datasets', folders=['A', 'B', 'C'],
3131
# Get the images
3232
x = paths_to_tensor(filenames).astype('float32')/255
3333
# Store the one-hot targets
34-
y = np.array(labels)
34+
y = to_categorical(np.array(labels)) # Use to_categorical directly
3535

3636
x_train = np.array(x[:int(len(x) * (1 - test_split))])
3737
y_train = np.array(y[:int(len(x) * (1 - test_split))])
@@ -52,9 +52,3 @@ def path_to_tensor(img_path, size):
5252
def paths_to_tensor(img_paths, size=50):
5353
list_of_tensors = [path_to_tensor(img_path, size) for img_path in img_paths]
5454
return np.vstack(list_of_tensors)
55-
56-
57-
"""
58-
num_types = len(data['target_names'])
59-
targets = np_utils.to_categorical(np.array(data['target']), num_types)
60-
"""

0 commit comments

Comments
 (0)