Skip to content

Instantly share code, notes, and snippets.

@AmrutaKoshe
Last active July 4, 2021 10:26
Show Gist options
  • Save AmrutaKoshe/9ec0bd27d733a671117f34c84f3a2279 to your computer and use it in GitHub Desktop.
Save AmrutaKoshe/9ec0bd27d733a671117f34c84f3a2279 to your computer and use it in GitHub Desktop.
dataset=[]
testset=[]
count=0
for file in os.listdir(directory):
path=os.path.join(directory,file)
t=0
for im in os.listdir(path):
image=load_img(os.path.join(path,im), grayscale=False, color_mode='rgb', target_size=(180,180))
image=img_to_array(image)
image=image/255.0
if t<=20:
dataset+=[[image,count]]
else:
testset+=[[image,count]]
t+=1
count=count+1
data,labels0=zip(*dataset)
test,testlabels0=zip(*testset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment