defget_images(directory):
Images =[]
Labels =[]
label =0for labels in os.listdir(directory):# you should give the dir of the train dataif labels =='':# you can change the name of labels and the number of labels
label =2elif labels =='':
label =4elif labels =='':
label =0elif labels =='':
label =1elif labels =='':
label =5elif labels =='':
label =3for image_file in os.listdir(directory+r'/'+labels):
image = cv2.imread(directory+r'/'+labels+r'/'+image_file)# read your image and change the size of your image
image = cv2.resize(image,(150,150))
Images.append(image)
Labels.append(label)return shuffle(Images,Labels,random_state=817328462)