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

Softmax in the last layer #12

Closed
cijerezg opened this issue Sep 6, 2020 · 2 comments
Closed

Softmax in the last layer #12

cijerezg opened this issue Sep 6, 2020 · 2 comments

Comments

@cijerezg
Copy link

cijerezg commented Sep 6, 2020

Did you use a Softmax in the very last layer? I see that last layer is a fully connected (nn.Linear).

@cijerezg cijerezg closed this as completed Sep 6, 2020
@cijerezg
Copy link
Author

cijerezg commented Sep 6, 2020

I didn't realize I just needed to apply that extra separately.

@kfarivar
Copy link

kfarivar commented Apr 5, 2021

I have this problem too. I stil don't see any softmax used on the output, so I get this error when testing (and training) the pretrained network.
python train.py --test_phase 1 --pretrained 1 --classifier resnet18

The `preds` should be probabilities, but values were detected outside of [0,1] range.
which is a reasonable error. :)

this is the part of code that is problematic:

accuracy = self.accuracy(predictions, labels)

what function should be used on the output of the model ? why is this not in your codes ?

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

2 participants