2

If I have a directory structure like this:

|-data
   |-train
      |-Bellis perennis
      |   |-lawn_daisy
      |   |     |-image1.jpg
      |   |-english_daisy
      |         |-image1.jpg
      |-Tulipa dasystemon
      |   |-some tulip name
      |         |-image.jpg
      |-etc

and I use Keras flow_from_directory, it will only grab the first tree which is Bellis perennis and Tuplia and use those as labels. Is there a way to use the main directory (Bellis) as one label and its sub_directory(lawn daisy, english_daisy) as a second label and use those labels with the Keras functional API?

Another option is to just change the way the folders are setup, but if there is a way to work with this folder structure I'd like to learn about it.

Edit - After further reading, it seems that you can specify the classes explicitly under train_datagen.flow_from_directory. But can you specify 2 different classes?

ans
  • 378
  • 1
  • 5
  • 18

0 Answers0