Reputation: 5
I made a folder in colab called "pics" like so which contains png images and I want to make a test/train split. I thought loading them like this
data = pathlib.Path('/content/pics')
and then using image_dataset_from_directory like this
train_ds = tf.keras.utils.image_dataset_from_directory(
data,
validation_split=0.3,
subset="training",
seed=123,
image_size=(165, 1310),
batch_size=30)
would work, but I get the error 'No images found in directory /content/pics.'
Upvotes: 0
Views: 745
Reputation:
Your image folder path is not accessible by Google Colab. Try mounting your google drive in colab using:
from google.colab import drive
drive.mount('/content/GoogleDrive/')
Keep your images folder inside this googleDrive in any folder and give this path in colab to access these images as below:
data = '/content/GoogleDrive/My Drive/dataset/'
Note : (Make sure you give path till one directory above to the exact images folder)
For instance, suppose you have images inside this pics
folder '/content/GoogleDrive/My Drive/dataset/pics/'
then give path till dataset
folder, like this :'/content/GoogleDrive/My Drive/dataset'
Upvotes: 1