Keras 图片预处理
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Keras 图片预处理相关的知识,希望对你有一定的参考价值。
from keras.preprocessing import image
in_path = ‘./dataset‘
out_path = ‘output‘
datagen = image.ImageDataGenerator()
#指定target_size后所有图像都变为相同大小
gen_data = datagen.flow_from_directory(in_path, batch_size=1, shuffle=False,
save_to_dir=out_path+‘resize‘,
save_prefix=‘gen‘, target_size=(224, 224))
for i in range(20):
gen_data.next()
以上是关于Keras 图片预处理的主要内容,如果未能解决你的问题,请参考以下文章