About multi-label classification in pytorch


(Li Rong) #1

I am not sure how I represent the training data. For multi labels, should I convert these labels in multi-hot form. That means all images have labels of the same length which corresponds to the class to be classified, Or should I only use the label sequence ? In this way length of labels are various with the different images.
Could anybody give me some suggestion?


#2

For multi-label classification you could use the “multi-hot” form with BCELoss.


(Li Rong) #3

Ok, thank you. I will try.


(Deeply) #4

Or, BCEWithLogitsLoss

which combines a Sigmoid layer and the BCELoss in one single class.


(Li Rong) #5

ok, thank you!!! I will try it.