小编Kin*_*ing的帖子

BatchDataSet:获取img数组和标签

这是我之前创建的用于适应模型的批量数据集:

train_ds = tf.keras.preprocessing.image_dataset_from_directory(
    train_path,
    label_mode = 'categorical', #it is used for multiclass classification. It is one hot encoded labels for each class
    validation_split = 0.2,     #percentage of dataset to be considered for validation
    subset = "training",        #this subset is used for training
    seed = 1337,                # seed is set so that same results are reproduced
    image_size = img_size,      # shape of input images
    batch_size = batch_size,    # This should match with model batch size
)




valid_ds = tf.keras.preprocessing.image_dataset_from_directory(
    train_path, …
Run Code Online (Sandbox Code Playgroud)

python deep-learning keras tensorflow tensorflow-datasets

6
推荐指数
1
解决办法
8801
查看次数