Using my own dataset with TensorFlow trouble

Hi guys, I am a beginner in python and I am having trouble loading my own dataset from my local c drive using TFDS. I have tried the tutorials and am unable to follow. My data is located in C:\Users\shujun.wong\Desktop\dataset\train\dog and C:\Users\shujun.wong\Desktop\dataset\train\cat.

Would really appreciate the help

@Wong_Shu_Jun,

Welcome to the Tensorflow Forum!

Tensorflow Datasets(TFDS) is a collection of datasets ready to use with TensorFlow, JAX and other Machine Learning frameworks. All datasets are exposed as tf.data.Datasets enabling easy-to-use and high-performance input pipelines. To get started see the guide and our list of datasets.

If you are working on image classification usecase, then you can load cats_vs_dogs dataset from tfds as shown below

import tensorflow as tf
import tensorflow_datasets as tfds

# Construct a tf.data.Dataset
ds = tfds.load('cats_vs_dogs', split='train', shuffle_files=True)

If you want to load images from your local drive use tf.keras.utils.image_dataset_from_directory API

 tf.keras.utils.image_dataset_from_directory( data_dir,  
                                validation_split=0.2,  
                                subset="training", 
                                seed=123, 
                                image_size=(img_height, img_width), 
                                batch_size=batch_size)

For more details please refer to the Image classification tutorial.

Thank you!

It can be due to a number of reasons. Can you be a bit more elaborate about the parameters you are passing and the actual error you are getting. This can help a great deal in debugging the issue.

I am trying to implement few-shot learning with the Reptile algorithm. (Few-Shot learning with Reptile) In this example, they imported a dataset from tfds. Is there a way I can upload my own dataset from my local c drive and how do I write the code such that it will be compatible. Thank you so much for your time!