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.

Imagefile: Image01.png
Classification: Cat

What it looks like in CSV file:

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?


1 Answer 1


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



  • Image01


  • Image03


  • Image02

Your Answer

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

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