Cnn for multiple face attribute classification (binary)

I am doing a tutorial on classifying the multiple face attributes . My idea is to crate objects of model multiple times to train each attribute . Can we do one model to train all attributes at a time ? because as what I can imagine ,the cnn model will output binary classes -1 or 1 for one attributes . Are there any ways to output 10 attributes with (-1 or 1) instead of assigning a model to one attribute

If you would like to use a multi-label classification (multiple outputs can have an active or inactive class), then you could use nn.BCEWithLogitsLoss as the criterion and make sure your model outputs have the shape [batch_size, nb_classes].

I’m not sure if -1 and 1 would correspond to a positive and negative case, but the target for nn.BCEWithLogitsLoss should contain values in [0, 1].

Hi thank you for your answers , I am building a resNet 50 ,which output 2 feature at then end , but i need to produce 40 face attributes for classification, in class (0 and 1) , i can do for one attribute,which is very standard , I have actually come cross an question you have answered in this forum which create multiple fc layer and return multiple output at then end ,so i use module list to create 40 model output where each one has class probability for 1 and 0 . it seems work , but my training is ridiculously long(probability 10 hours for just one epoch) ,(dateset is celebrity dateset, around 170000 training image,7k each in size) . I still trying to perfect the code . Is my approach correct? appreciate your reply thx

As previously said, if these face attributes can be independently active (1) or inactive (0), then you are dealing with a multi-label approach and could use a single output layer with out_features=40 and nn.BCEWithLogitsLoss as the loss function.