I am creating a multitask CNN model and I have two different classification properties (one with 10 classes, 2nd with 5 classes) and my directory structure looks like this:
-Train - image1.jpg ... - imageN.jpg -Test - image1.jpg ... - imageN.jpg -Vald - image1.jpg ... - imageN.jpg
And labels are in a csv file as propA, propB. So, a single image will have two classes, one from property A and one from property B.
The model uses VGG16 :
baseModel = VGG16(weights="imagenet", include_top=False,input_tensor=Input(shape=(img_size, img_size, 3))) flatLayer = baseModel.output sharedLayer = Flatten(name="flatten")(flatLayer) sharedLayer = Dense(1024,name="Shared")(sharedLayer) sharedLayer = Dropout(0.5)(sharedLayer) task1 = Dense(512, activation="relu")(sharedLayer) task1 = Dense(10, activation="softmax",name='PFR')(task1) task2 = Dense(512, activation="relu")(sharedLayer) task2 = Dense(5, activation="softmax",name='FT')(task2) model3 = Model(inputs=baseModel.input, outputs=[task1,task2])
The number of images is large, therefore I cannot load them in memory and need to use flow_from_directory like functionality. But, in my train directory, there are no class sub directories because it is not possible to generate class directories as there are total 15 classes and I am not sure on which property to generate class subdirs for. (and flow_from_directory doesnt work if there are no class subdirs)
The labels are available in array, propALab and propBLab.
So far, I havenot found anything helpful, can someone help?