Python Forum
Kera how to load a dataset of images stored to my computer, not the Cifar-10? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Kera how to load a dataset of images stored to my computer, not the Cifar-10? (/thread-27599.html)



Kera how to load a dataset of images stored to my computer, not the Cifar-10? - hobbyist - Jun-12-2020

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()


RE: trainX, trainY, testX, testY - Yoriz - Jun-12-2020

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


RE: trainX, trainY, testX, testY - hobbyist - Jun-12-2020

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


RE: trainX, trainY, testX, testY - Yoriz - Jun-12-2020

Sorry, but from that one line and your description I don't understand Think , maybe someone else will


RE: trainX, trainY, testX, testY - hobbyist - Jun-12-2020

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?)


RE: trainX, trainY, testX, testY - Yoriz - Jun-12-2020

Kera > Code examples / Computer Vision / Image classification from scratch


This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.