[英]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.