def omniglot_folder_to_NDarray(path_im):
alphbts = os.listdir(path_im)
ALL_IMGS = []
for alphbt in alphbts:
chars = os.listdir(os.path.join(path_im, alphbt))
for char in chars:
img_filenames = os.listdir(os.path.join(path_im, alphbt, char))
char_imgs = []
for img_fn in img_filenames:
fn = os.path.join(path_im, alphbt, char, img_fn)
I = imread(fn)
I = np.invert(I)
char_imgs.append(I)
ALL_IMGS.append(char_imgs)
return np.array(ALL_IMGS)
评论列表
文章目录