I'm doing multi-label learning. Specifically, I'm working on creating a model that takes an image of a person's face as input and classifies age, race, and gender as output.

In my current data, age has a null value, so model.fit will work even if the label is null. However, we encountered an issue where loss, age_out_loss, and val_age_out_loss have the value nan, as shown in the figure below.

enter image description here

I would like to implement in code that their label null is represented by [1,0,0] (null : 1, not null : 0), which will prevent the corresponding output nodes from being trained on null data.

I was wondering if this exists in tensorflow and if I can implement it.

from tensorflow.keras.callbacks import EarlyStopping

early_stopping = EarlyStopping(monitor='val_loss', patience=10, restore_best_weights=True)

history = model.fit(X_train, [Y_train_age_na, Y_train_race, Y_train_gender],
                    epochs=epochs,
                    batch_size=256,
                    validation_data=[X_test, [Y_test_age, Y_test_race, Y_test_gender]],
                    callbacks=[early_stopping])
0

There are 0 best solutions below