我正在尝试将 Fashion_mnist 用于 GAN,当我加载数据时,我得到以下信息:
TypeError Traceback (most recent call last)
Cell In[6], line 2
1 builder = tfds.builder('fashion_mnist', data_dir=folder_path)
----> 2 builder.download_and_prepare()
3 ds = builder.as_dataset(split=tfds.Split.TRAIN)
File e:\Info\Anaconda\envs\ia\lib\site-packages\tensorflow_datasets\core\logging\__init__.py:169, in _FunctionDecorator.__call__(self, function, instance, args, kwargs)
167 metadata = self._start_call()
168 try:
--> 169 return function(*args, **kwargs)
170 except Exception:
171 metadata.mark_error()
File e:\Info\Anaconda\envs\ia\lib\site-packages\tensorflow_datasets\core\dataset_builder.py:646, in DatasetBuilder.download_and_prepare(self, download_dir, download_config, file_format)
644 self.info.read_from_directory(self._data_dir)
645 else:
--> 646 self._download_and_prepare(
647 dl_manager=dl_manager,
648 download_config=download_config,
649 )
651 # NOTE: If modifying the lines below to put additional information in
652 # DatasetInfo, you'll likely also want to update
653 # DatasetInfo.read_from_directory to possibly restore these attributes
654 # when reading from package data.
...
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. tensorflow.python._pywrap_file_io.BufferedInputStream(arg0: str, arg1: int)
我尝试像这样加载数据:
builder = tfds.builder('fashion_mnist', data_dir=folder_path)
builder.download_and_prepare()
ds = builder.as_dataset(split=tfds.Split.TRAIN)
也喜欢这个仓库FashionGan
但是我遇到了同样的错误。我有tensorFlow版本:2.3.0和tensorFlowDataset版本:4.9.2。
你可以用这个
# Load the Fashion MNIST dataset
fmnist = tf.keras.datasets.fashion_mnist
# Load the training and test split of the Fashion MNIST dataset
(training_images, training_labels), (test_images, test_labels) = fmnist.load_data()