问题描述
我使用以下代码为imagewoof数据集创建一个生成器:
import tensorflow as tf
data_path_train = "C:/data/imagewoof2-160/train/"
image_generator = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1.0/255.0)
train_gen = image_generator.flow_from_directory(data_path_train,target_size=(64,64),batch_size=32,shuffle=True,class_mode="input",save_to_dir=None)
print(tf.shape(train_gen.next()))
运行脚本时,我得到以下输出
Found 9025 images belonging to 10 classes.
tf.Tensor([ 2 32 64 64 3],shape=(5,),dtype=int32)
为什么发电机的输出是5维的?我期望输出[batch_size,width,height,channels]
的形状如下。第一维是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)