Skip to content

Instantly share code, notes, and snippets.

@VedPDubey
Last active July 23, 2021 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VedPDubey/b3f2f956beb0e22a40a4693e1057b5a7 to your computer and use it in GitHub Desktop.
Save VedPDubey/b3f2f956beb0e22a40a4693e1057b5a7 to your computer and use it in GitHub Desktop.
def load_data():
images, labels = [], []
for dataset in datasets:
for folder in os.listdir(dataset):
label = class_name_labels[folder]
for file in tqdm(os.listdir(os.path.join(dataset,folder))):
img_path = os.path.join(dataset,folder,file)
img = cv2.imread(img_path)
img = cv2.resize(img, (96,96))
images.append(img)
labels.append(label)
pass
pass
images = np.array(images,dtype=np.float32)/255.0
labels = np.array(labels,dtype=np.float32)
pass
return (images, labels)
pass
(images, labels) = load_data()
images.shape, labels.shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment