<p>I have read <a href="https://arxiv.org/pdf/2002.10857.pdf" rel="nofollow noreferrer">the paper about circle loss</a> for neural networks. I may have missed something, but I didn't find the way to compute the positive similarity and the negative similarity in the case of circle loss.</p>
<p>The paper gives the equations for AM-SoftMax and Triplet loss, that can be computed from a unified loss function:</p>
<p><a href="https://i.sstatic.net/VvSYP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VvSYP.png" alt="Loss Function" /></a></p>
<p>For example, in the case of AM-SoftMax, the positive and negative similarities are computed by the following way, <code>w</code> being the weights of the last fully connected layer, and <code>x</code> being the inputs of this last layer:</p>
<p><a href="https://i.sstatic.net/TLXCt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TLXCt.png" alt="positive similarity" /></a></p>
<p><a href="https://i.sstatic.net/V495C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/V495C.png" alt="negative similarity" /></a></p>
<p>So my questions are:</p>
<ol>
<li><p>Should I compute the similarities for circle loss by the same way the paper compute them for AM-SoftMax ?</p>
</li>
<li><p>Should I compute the forward pass of the last fully connected layer with a standard product: <code>output[j] += weight[i][j] * input[i]</code>, followed by a standard SoftMax function ? Or by another way ?</p>
</li>
</ol>

CC BY-SA 4.0
2022-03-05T23:50:46.253Z
Hello. Welcome to AISE. In general, each post should contain exactly one question. As a rule of thumb, if you can't put your **specific question** in the title (because maybe you have more than 1), then your post might be too broad. Moreover, note that programming questions are off-topic. However, if you're only trying to understand how the theory is connected to the code, then your questions are fine for our site.
nbro
CC BY-SA 4.0
2022-03-06T03:43:17.650Z
I have reformulated my question, focalizing on the two problems I have with circle loss computation.
Bertrand125
<neural-networks><loss>
How to compute circle loss?
Bertrand125
# How to compute circle loss?

(Asked by: username_0 on 2022-03-05)

I have read [the paper about circle loss](https://arxiv.org/pdf/2002.10857.pdf) for neural networks. I may have missed something, but I didn't find the way to compute the positive similarity and the negative similarity in the case of circle loss.

The paper gives the equations for AM-SoftMax and Triplet loss, that can be computed from a unified loss function:

[![Loss Function](https://i.sstatic.net/VvSYP.png)](https://i.sstatic.net/VvSYP.png)

For example, in the case of AM-SoftMax, the positive and negative similarities are computed by the following way, `w` being the weights of the last fully connected layer, and `x` being the inputs of this last layer:

[![positive similarity](https://i.sstatic.net/TLXCt.png)](https://i.sstatic.net/TLXCt.png)

[![negative similarity](https://i.sstatic.net/V495C.png)](https://i.sstatic.net/V495C.png)

So my questions are:

1. Should I compute the similarities for circle loss by the same way the paper compute them for AM-SoftMax ?
2. Should I compute the forward pass of the last fully connected layer with a standard product: `output[j] += weight[i][j] * input[i]`, followed by a standard SoftMax function ? Or by another way ?

**Tags:** neural-networks, loss

> **Comments:**
> **username_1**: Hello. Welcome to AISE. In general, each post should contain exactly one question. As a rule of thumb, if you can't put your **specific question** in the title (because maybe you have more than 1), then your post might be too broad. Moreover, note that programming questions are off-topic. However, if you're only trying to understand how the theory is connected to the code, then your questions are fine for our site.  
> **username_0**: I have reformulated my question, focalizing on the two problems I have with circle loss computation.  

---

## 0 answers

