{"action":"created","issue":{"url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/4","repository_url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch","labels_url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/4/comments","events_url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/4/events","html_url":"https://github.com/MuggleWang/CosFace_pytorch/issues/4","id":351789861,"node_id":"MDU6SXNzdWUzNTE3ODk4NjE=","number":4,"title":"CosFace Layer Accuracy","user":{"login":"abnera","id":19192433,"node_id":"MDQ6VXNlcjE5MTkyNDMz","avatar_url":"https://avatars3.githubusercontent.com/u/19192433?v=4","gravatar_id":"","url":"https://api.github.com/users/abnera","html_url":"https://github.com/abnera","followers_url":"https://api.github.com/users/abnera/followers","following_url":"https://api.github.com/users/abnera/following{/other_user}","gists_url":"https://api.github.com/users/abnera/gists{/gist_id}","starred_url":"https://api.github.com/users/abnera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abnera/subscriptions","organizations_url":"https://api.github.com/users/abnera/orgs","repos_url":"https://api.github.com/users/abnera/repos","events_url":"https://api.github.com/users/abnera/events{/privacy}","received_events_url":"https://api.github.com/users/abnera/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-18T04:38:30Z","updated_at":"2018-08-20T08:59:12Z","closed_at":null,"author_association":"NONE","body":"I understand the CosFace layer is applied to the feature vector of a given model. Then the output of `cosface` is then passed to the criterion (`cross-entropy`) in order to the loss. \r\n\r\nHowever, how to calculate accuracy is I have a validation dataset that is a classification problem. I know that for LFW we use the features and cosine similarity but I want regular classification accuracy assuming both the train and val have the same classes. I tried using the output of `cosface` layer as the logits for accuracy metric since they have same shape as target/labels but that is leading to 0% accuracy even if the loss seems to be training properly and same problem with just a linear + cross-entropy give good results. \r\n\r\nBasically, I want to use the output of `cosface` layer to calculate train and validation accuracy.\r\n\r\nAlso how to select `s` parameter if you have any thoughts. "},"comment":{"url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/comments/414246844","html_url":"https://github.com/MuggleWang/CosFace_pytorch/issues/4#issuecomment-414246844","issue_url":"https://api.github.com/repos/MuggleWang/CosFace_pytorch/issues/4","id":414246844,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDI0Njg0NA==","user":{"login":"MuggleWang","id":22472622,"node_id":"MDQ6VXNlcjIyNDcyNjIy","avatar_url":"https://avatars1.githubusercontent.com/u/22472622?v=4","gravatar_id":"","url":"https://api.github.com/users/MuggleWang","html_url":"https://github.com/MuggleWang","followers_url":"https://api.github.com/users/MuggleWang/followers","following_url":"https://api.github.com/users/MuggleWang/following{/other_user}","gists_url":"https://api.github.com/users/MuggleWang/gists{/gist_id}","starred_url":"https://api.github.com/users/MuggleWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MuggleWang/subscriptions","organizations_url":"https://api.github.com/users/MuggleWang/orgs","repos_url":"https://api.github.com/users/MuggleWang/repos","events_url":"https://api.github.com/users/MuggleWang/events{/privacy}","received_events_url":"https://api.github.com/users/MuggleWang/received_events","type":"User","site_admin":false},"created_at":"2018-08-20T08:59:12Z","updated_at":"2018-08-20T08:59:12Z","author_association":"OWNER","body":"Variable `cosine`  is inner product of feature `input` and class weight `self.weight`.  Assuming we get only one feature, which means dim of `input` is `1*512`. Assuming number of classes is `c`, then dim of `self.weight` is 'c*512. Dim of `cosine` is '1*c'. Each value in `cosine` means cosine similarity of the feature and `c` weights.\r\nOutput of this layer is cosine minus m in label of the feature. It reduces the confidence rate at the feature label."}}
{"actor":{"display_login":"MuggleWang"}}