简体   繁体   English

如何查看keras的image_dataset_from_directory function生成的数据集?

[英]How to view the dataset generated by the image_dataset_from_directory function of keras?

import numpy as np
import os
import random
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
%matplotlib inline

CATEGORIES = ['cat', 'dog']

data = keras.preprocessing.image_dataset_from_directory(
    'train',
    labels = "inferred",
    label_mode = "int",
    class_names = ['cat', 'dog'],
    color_mode = "rgb",
    batch_size = 32,
    image_size = (256, 256),
    shuffle = True,
    seed = 42,
    validation_split = None,
    subset = None,
    interpolation = "bilinear",
    follow_links = False,
)

I used the above function for loading the dataset and preprocessing it.我使用上面的 function 来加载数据集并对其进行预处理。 How can I view the data returned by the function?如何查看function返回的数据? print(data) is returning the address of the created object, even transforming it to a numpy array is not working. print(data)正在返回创建的 object 的地址,即使将其转换为 numpy 数组也不起作用。

Try:尝试:

image_batch, label_batch = next(iter(data))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 keras image_dataset_from_directory 与自定义结构一起使用? - How to use keras image_dataset_from_directory with custom structures? 从 image_dataset_from_directory function 生成的数据集不包括 batch size - Dataset generated from image_dataset_from_directory function does not include batch size Keras:`image_dataset_from_directory` 中标签的一次性使用 - Keras: one-hot for labels in `image_dataset_from_directory` 如何从 Keras 中的 image_dataset_from_directory() 从 MapDataset 附加或获取文件名? - How to attach or get filenames from MapDataset from image_dataset_from_directory() in Keras? 如何在专辑 label 中调整数据集 label 的大小以使用 tensorflow image_dataset_from_directory ZC1C425268E687A945D - How resize dataset label in albumentations label to work with tensorflow image_dataset_from_directory function? Keras 方法 image_dataset_from_directory() 如何区分 X 和 Y 数据? - How does the Keras method image_dataset_from_directory() distinguish X and Y data? Keras:如何使用`image_dataset_from_directory`加载测试集? - Keras: How to use `image_dataset_from_directory` to load test set? 丢失 function 与 image_dataset_from_directory 一起使用 - Loss function to use with image_dataset_from_directory Tensorflow image_dataset_from_directory 用于输入数据集和 output 数据集 - Tensorflow image_dataset_from_directory for input dataset and output dataset Tensorflow image_dataset_from_directory function label 形状 - Tensorflow image_dataset_from_directory function label shape
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM