Feature Extraction

Hi,
just wondering, if anyone can guide about finding the angles between extracted features and their corresponding class centers.

Hy @Angelina_Robert.
I don’t think so if there’s a proper guide for this specific topic but you can look at distance metrics which employ different techniques to find the similarities between feature. You can use cosine similarity which measure the angle between two vector project in a higher dimensional space.


It’s already available in pytorch

Also read this article too.

1 Like

Thanks, Usama_Hasan for your reply. I want to measure the angles between the features and their corresponding classes to find the spatial span. The idea has been motivated by " Deep Representation Learning on Long-tailed Data_ A Learnable Embedding Augmentation Perspective" paper but I could not find its code. Any help in this regard would be highly appreciated.
Cheers

Hy @Angelina_Robert, I will look to it, for now do you know the idea of L-Softmax or Angular Softmax, which adds a angle between classes in softmax.


1 Like

Thanks a lot, Usama_Hassan. I read this article long ago but again will have a look. Thanks again.

Cheers

Hi Usama_Hassan, Just wondering where is the calculation of angles in " Leethony/Additive-Margin-Softmax-Loss-Pytorch ". Could you please point me out that?
Cheers

My Bad, I mentioned the forked repo link. Check the loss_function.py in this repo.


The calculation looks like this.
numerator = self.s * torch.cos(torch.acos(torch.clamp(torch.diagonal(wf.transpose(0, 1)[labels]), -1.+self.eps, 1-self.eps)) + self.m)

Heaps of thanks. I m going to check that.

Cheers.