def save_images(img_dir, dest_file):
img_list = os.listdir(img_dir)
img_combo = []
print('starting to save ' + str(len(img_list)) + ' images')
count = 0
for img_name in img_list:
# can change this line to img_name.startswith('center') for center imgs
if not img_name.startswith('.'):
if count % 500 == 0:
print('count is', count)
img = misc.imread(img_dir + '/' + img_name)
img_combo.append(img)
count += 1
#cast to numpy array and save to file
all_images = np.array(img_combo)
print('images shape', all_images.shape)
np.save(dest_file, all_images)
评论列表
文章目录