I am going to train a network to label a given image whether it belongs to category A or category B (a binary classifier). I use flow_from_directory to generate train, validation and test data. I keep all the images belong to category A in one folder. However, category B has sub folders. Lets say we have a folder which contains ship images (category A) and another folder which contains all the other images (cats, dogs, buildings, etc.) which are non ships (category B). In my application I keep all the non-ship images in different folders, according to their content, under non_ship folder. At the end I want a binary result (ship or non-ship). In this case I am actually not sure about how keras handles this. Does not it consider all the sub folders and just consider all the non-ship images are in one folder or consider that they belong to different subclasses?

  • $\begingroup$ Can you imagine a way to test it? $\endgroup$ Oct 6 '18 at 8:34
  • $\begingroup$ I prepared everything to test. I tried to run it but my computer is old and the gpu is not supported. I am going to run the main code on a server. Hence, I do not want to pay to understand how keras commands work. $\endgroup$ Oct 6 '18 at 14:55

The answer is it does not consider the sub folders. It assumes all the images available in the sub folders are belong to the same category. In this case all the non ship images are assumed they belong to category B.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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