0
$\begingroup$

I'm trying to run an image classification CNN on my own set of labeled images. Currently, I have the images of each label stored in folders, named by the labels. I can also store the images as numpy arrays of pixels. How should I be storing the labeled images so that I can feed them to a CNN?

All the examples I can find online for CNN image classification are using a preloaded dataset from Keras, such as MNIST. I'd like to use my own labeled images, but I can't find any resources on how to do that. Any help would be greatly appreciated!

$\endgroup$

1 Answer 1

2
$\begingroup$

That largely depends on the framework you're using. For Torch, there's torchvision.datasets.ImageFolder with ToTensor() transformation, for TensorFlow, you'll probably use tf.keras.preprocessing.image.ImageDataGenerator.flow_from_directory(). Both would create a dataset with labels based on subdirectory names, the images may be provided in any common format.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.