def read_img(path):
imgs = []
labels = []
# classs = []
classs = os.listdir(path)
for idx, folder in enumerate(classs):
cate = os.path.join(path, folder)
for im in os.listdir(cate):
print(im)
img_path =os.path.join(cate, im)
print('reading the images:%s' % (img_path))
img = io.imread(img_path)
img = transform.resize(img, (w, h))
# with open('tests.txt', 'a') as f:
# f.write(img_path+'_'+str(idx)+'\n')
imgs.append(img)
labels.append(idx)
return np.asarray(imgs, np.float32), np.asarray(labels, np.int32)