Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the Loss function. #7

Open
HarminDo opened this issue Mar 27, 2019 · 1 comment
Open

About the Loss function. #7

HarminDo opened this issue Mar 27, 2019 · 1 comment

Comments

@HarminDo
Copy link

In the paper, the author said "... , which the cross-entropy loss L^attr is applied for pedestrain attribute recognition." However, in your code, the loss function is BCEWithLogitsLoss. Could you give the reason about it?

@HarminDo
Copy link
Author

HarminDo commented Mar 28, 2019

Sorry, I asked a stupid question. The BCEWithLogitsLoss in Pytorch is according with the SigmoidCrossEntropyLoss in Caffe. But I have another question. Why are the weights in your paper those values? How do you figure out the weights?
The weight I calculated is as follows:
[0.63371877 0.98601126 0.39297374 0.9494238 0.69839181 0.75289839
0.69963256 0.95700181 0.83599094 0.83235188 0.82602933 0.86278694
0.99040879 0.55656295 0.66098443 0.95031431 0.85723987 0.89706675
0.95695396 0.99496273 0.98239432 0.97219391 0.49214224 0.84040194
0.88946288 0.9938316 ]
My calculation is as follows:
pa_100k = sio.loadmat(matfile)
positive = np.zeros(26)
for label in pa_100k['train_label']: positive = positive + label
positive = positive / len(train_labels)
weight = np.exp(-positive)
print(weight)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant