0
$\begingroup$

I'm currently working on assembling a CNN for image classification with tensorflow.keras. I have all my images in a file which I already uploaded to my program. Also I have CSV-Files for training and testing which includes the Name of the imagefile and the classification (8 classes possible) split by a semicolon.
Example:

Imagefile: Image01.png
Classification: Cat

What it looks like in CSV file:
Image01;Cat
Image02;Bird
Image03;Dog
...

I have no clue how to deal with this input data. What I wann do is, that I wanna have the images somehow as x_train/x_test and the classifications as y_train/y_test so I can use that in my CNN. The CNN is built like the simple example on the Tensorflow website (https://www.tensorflow.org/tutorials/images/cnn)

Can anybody help?

$\endgroup$

1 Answer 1

0
$\begingroup$

You should restructure your Imagefile folder based on your CSV file. You can write some code to create subfolder based on your CSV file, and move your images to relevant subfolder. os.makedirs() then shutil.move()

Imagefile

--Cat

  • Image01

--Dog

  • Image03

--Bird

  • Image02
$\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.