Tensorflow Keras flow_来自_目录,未读取所有类中的所有图像
我在Google Colab中使用Keras ImageDataGenerator。 我有3类网球图像,如下所示:Tensorflow Keras flow_来自_目录,未读取所有类中的所有图像,tensorflow,keras,directory,computer-vision,google-colaboratory,Tensorflow,Keras,Directory,Computer Vision,Google Colaboratory,我在Google Colab中使用Keras ImageDataGenerator。 我有3类网球图像,如下所示: FRAMES_RGB |- bhnd --> contains about 34000 image files |- forehand --> contains about 34000 image files |- idle --> contains about 9082 image files FRAMES_RGB_VALIDATION |- b
FRAMES_RGB
|- bhnd --> contains about 34000 image files
|- forehand --> contains about 34000 image files
|- idle --> contains about 9082 image files
FRAMES_RGB_VALIDATION
|- bhnd --> contains about 3500 image files
|- forehand --> contains about 3500 image files
|- idle --> contains about 1000 image files
但是,当我运行代码时,会收到以下消息:
Reading training and validation data...
Found 9082 images belonging to 3 classes.
Found 8324 images belonging to 3 classes.
因此,我知道它只从训练集中的空闲类中获取图像(在验证集中一切正常),但它仍然知道有3个类
这些是我的发电机:
training_datagen = tf.keras.preprocessing.image.ImageDataGenerator(
preprocessing_function=self._preprocessing_function,
rotation_range=30,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True, # Randomly flip half of the images horizontally
fill_mode='nearest' # Strategy used for filling in new pixels that appear after transforming images
)
validation_datagen = tf.keras.preprocessing.image.ImageDataGenerator(preprocessing_function=self._preprocessing_function)
training_generator = training_datagen.flow_from_directory(
training_dir,
target_size=self._target_size,
batch_size=training_batch_size,
class_mode='categorical'
)
validation_generator = validation_datagen.flow_from_directory(
validation_dir,
target_size=self._target_size,
batch_size=validation_batch_size,
class_mode='categorical',
shuffle=False
)
为什么它只读取我训练集中的空闲类?似乎连验证数据都是错误的。您能否共享完整的代码来复制您的问题?因此我们可以尝试帮助您。@t这是指向我正在执行所有操作的文件夹的链接,笔记本是“Copia de training_thetis_non seq”。