pytorch-image-models icon indicating copy to clipboard operation
pytorch-image-models copied to clipboard

[FEATURE] Multi-Label Classification

Open liangshi036 opened this issue 3 years ago • 8 comments

How do I apply this nice repo to Multi-Label Classification task ? That is , a image has multi labels,I'd like to get the each label's confidence.

sound like add some features in dataset.py? or more than this file?

Thanks.

liangshi036 avatar Feb 24 '21 10:02 liangshi036

@liangshi036 I do have an (eventual) plan to add support for BCE and/or MultiLabelSoft margin losses for use in multi-label tasks and include support for a suitable dataset. Have a number of other significant refactorings of the train code to support TPU ahead of that in the queue though....

rwightman avatar Feb 25 '21 19:02 rwightman

That's Awesome. Looking Forward to your update!

thanks for this great job which keep us in touch with SOTA things.

liangshi036 avatar Feb 26 '21 03:02 liangshi036

looking forward to this.

Thank you.

ravich3373 avatar Feb 26 '21 10:02 ravich3373

@rwightman Thank Ross for his great work. I've implemented multi-label classification based on his code. Here is the link: https://github.com/yang-ruixin/PyTorch-Image-Models-Multi-Label-Classification

Cheers, Ruixin

yang-ruixin avatar Mar 19 '21 17:03 yang-ruixin

@yang-ruixin , seems you're not using BCE losses. have you test your code with multi-label classification task ?

liangshi036 avatar Mar 23 '21 07:03 liangshi036

@yang-ruixin , seems you're not using BCE losses. have you test your code with multi-label classification task ?

Hi there,

Sure I've tested my code, with fashion-product-images dataset and another private dataset. BCE loss, B stands for binary, but in our case, each label has more than two classes, hence you cannot use BCE loss. The loss I used is the same as Ross' loss. In MultiLabelModel class, get_loss method, the input argument loss_fn is defined in lines 567~578 in ./train.py.

Ruixin

yang-ruixin avatar Mar 23 '21 08:03 yang-ruixin

BCE (nn.BCEWithLogitsLoss) is a elegant way to treats output independently (as logit loss) in multi-label classification task . maybe the same as you do in your repo.

you can post your test result by the way.

liangshi036 avatar Mar 29 '21 03:03 liangshi036

@yang-ruixin @liangshi036 @rwightman thanks for sharing your source code, i am trying to do attribute recognition for the person using transformers which is a multilabel classification problem statement, can you please share your thought on the following points

  1. I am using coat,pit architectures can remove the classifier head and add my classifier? can you share some references on how to do it
  2. is bce loss better than MultiLabelSoft loss?
  3. can we apply Spatial transformers insider transformers for localization of attributes detected

Thanks in advance

abhigoku10 avatar Oct 05 '21 10:10 abhigoku10