Python Forum

Full Version: Kera how to load a dataset of images stored to my computer, not the Cifar-10?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Because I am searching but I cannot figure out how to make it work. Is there any way to load an image dataset stored in my PC ('png') so that it can be read by: trainX, trainY, testX, testY?? Because most of what I found is like this: (x_train, y_train), (x_test, y_test) = mnist.load_data() or (trainX, trainY), (testX, testY) = cifar10.load_data()
Do you mean like this?
def somefunc():
    return ('trainX', 'trainY'), ('testX', 'testY')

train, test = somefunc()
print(train, test)
Output:
('trainX', 'trainY') ('testX', 'testY')

Or maybe
def somefunc():
    return 'trainX', 'trainY', 'testX', 'testY'

trainX, trainY, testX, testY = somefunc()
print(trainX, trainY, testX, testY )
Output:
trainX trainY testX testY

Note it depends how mnist.load_data() returns its data, you could always make a function to return it how you wanted it
see this post for details of sequence unpacking
No, I mean this:

When I run
(x_train, y_train), (x_test, y_test) = mnist.load_data()
it loads mnist dataset. I need instead of the mnist dataset to load the folder with the .png images that I have stored on my PC and contains 2 folders inside, the one folder has the training dataset and the other is the test dataset.

Thank you
Sorry, but from that one line and your description I don't understand Think , maybe someone else will
For example: this tutorial here:

CNN code

uses cifar10 dataset. I want to transform the code to load a dataset of images stored to my computer, not the Cifar-10. How do I achieve this?

(Better now?)