0
train_generator=datagen.flow_from_dataframe(dataframe=train_df, #directory=data_path, 
                                            x_col="Path", y_col="feature_string", seed = 42, classes = chexpert_targets,
                                            class_mode="categorical", target_size=(image_size,image_size), batch_size=32, subset = "training")

validation_generator = datagen.flow_from_dataframe(dataframe=train_df, #directory=data_path, 
                                                   x_col="Path", y_col="feature_string", seed = 42, classes = chexpert_targets,
                                                      class_mode="categorical", target_size=(image_size,image_size), batch_size=16, subset = "validation")
    
test_generator = test_datagen.flow_from_dataframe(dataframe=valid_only_df, #directory=data_path, 
                                                  target_size=(image_size,image_size),class_mode='categorical',
                                                  batch_size=1, shuffle=False, classes = chexpert_targets,
                                                  x_col="Path", y_col="feature_string")
    
x_col, y_col = next(train_generator)
ds = tf.data.Dataset.from_generator(
    lambda: train_generator, 
    output_types=(tf.float32, tf.float32), 
    output_shapes=([32,320,320,3], [32,14])
)

我正在尝试包装image_data_generator.flow_from_dataframe使用tf.data,但我发现困难,我真的很感激一些帮助吗?

4

0 回答 0