kerasdatasettensorflow-datasetsmnist

keras dataset import issue


I am trying to use the keras fashion_mnist dataset but for some reason I cannot seem to load it. I am using an anaconda environment. I have tried creating new environments, redownloading tensorflow, deleting the datasets folder, but nothing seems to work.

I get this error whenever I try to run this code: enter image description here


Solution

  • Replace your code with

    import tensorflow as tf
    import matplotlib.pyplot as plt
    import numpy as np
    import tensorflow_datasets as tfds
    
    (train_images, train_labels), (test_images, test_labels) = tfds.load(
        "fashion_mnist", split=["train", "test"], as_supervised=True, with_info=False
    )