richard-peng-xia / lmpt Goto Github PK
View Code? Open in Web Editor NEWLMPT: Prompt Tuning with Class-Specific Embedding Loss for Long-tailed Multi-Label Visual Recognition
Home Page: https://arxiv.org/abs/2305.04536
License: Apache License 2.0
LMPT: Prompt Tuning with Class-Specific Embedding Loss for Long-tailed Multi-Label Visual Recognition
Home Page: https://arxiv.org/abs/2305.04536
License: Apache License 2.0
class_weights = sfm(torch.from_numpy(np.asarray(mmcv.load(freq_file)['neg_class_freq'])).to(torch.float32).cuda())
hinge_loss = SoftMarginHingeEmbeddingLoss(margin=0.2, class_counts=class_weights)
Why do I need to input class weight as class count into hinge loss? By the way, the class weights is two-dimension which is not suitable for the hinge_loss.
No such file or directory: '../data/voc/voc_labels.txt'.
What is this label?
Hi everyone, could you please help to figure out this error? Thanks!
Traceback (most recent call last):
File "train.py", line 281, in
main(args)
File "train.py", line 223, in main
loss_2 = hinge_loss(x, y)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/host/home/yong/Documents/LMPT/lmpt/csel.py", line 25, in forward
class_weights = (1 / self.class_counts) ** self.gamma / torch.sum((1 / self.class_counts) ** self.gamma, dim=2)
IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)
Some of the code is different from the paper.
Computing
In the paper
Computing μ
In the paper,
In the code
There is an addition softmax operation.
Can not execute.
because self.class_counts has value 0.
I wondering if there are any issues with the implementation of the CSE loss function? thanks!
Hi,
Thanks for your excellent work for long-tailed multi-label visual recognition.
I am little confused about the calculation of prediction probability as shown below (formula 2). For example, let us assume that there exist three labels (i=a,b or c) in an image. We hope the prediction probability of the three labels are high enough. However, the prediction probability is normalized by the sum of all label classes like softmax, which can decline the prediction probability significantly when several labels exist. It seems really strange. Could you please give me some instructions?
Best regards
Thank you for your excellent work, could you please provide the class_freq.pkl file for voc and coco? Looking forward to your reply!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.