I already have a network which can do the binary classification. Now I want to extend it to a multi-label classification network. I have already modified the model (use 'sigmoid' as the output layer activation function and use 'binary_crossentropy' loss). However, I want to know how to modify the DataGenerator function to make it can deliver multi-label outputs?
For example, the original DataGenerator function is:
def __data_generation(self, list_IDs_temp):
'Generates data containing batch_size samples'
# Initialization
X = np.empty((self.batch_size, *self.dim, self.n_channels))
y = np.empty((self.batch_size), dtype=int)
# Generate data
for i, ID in enumerate(list_IDs_temp):
# Store sample
X[i, ] = np.load(train_dir + ID)
# Store class
y[i] = self.labels[ID]
return X, to_categorical(y, num_classes=self.n_classes)
For the binary classification, the labels[ID] is an integer. Now if I want to do the multi-label classification, the labels[ID] is a sequence like [0 1 0 0 1 0] (suppose I have 6 labels). I want to know how can I pass this sequence via DataGnerator() function?
Thanks a lot!