Skip to content
Advertisement

How do I read two folders in a directory and combine them under one label using flow_from_directory?

Tensorflow/Keras

I want to classify images into either “Circle”, “Square” or “Triangle”. I have a directory containing 6 folders with each shape having a separate “shaded” or “unshaded” folder. How can I combine them into one category? For example: shaded and unshaded circles will be given a label “0” using flow_from_directory. I will then feed this into my CNN model and let it run.

Thanks for the help!

Advertisement

Answer

classes in flow_from_directory needs to match the subdirectory names.

Example:

JavaScript
JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement