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

Temperature scaling on segmentation tasks #23

Open
Karol-G opened this issue Mar 23, 2021 · 1 comment
Open

Temperature scaling on segmentation tasks #23

Karol-G opened this issue Mar 23, 2021 · 1 comment

Comments

@Karol-G
Copy link

Karol-G commented Mar 23, 2021

Hi,

I wanted to apply temperature scaling to a segmentation task with 1 class (So a pixel belongs to this class or not).
Instead of CrossEntropyLoss I am using BCEWithLogitsLoss and I had to disable _ECELoss due to some bugs I could not fix.
However, the actual evaluation score performance is much worse after temperature scaling then before.
Furthermore, I noticed that the temperature during optimization becomes very high.
What are your thoughts on this?
It does not seems correct that the temperature becomes this high?
Is temperature scaling simply not suited for segmentation? Did you do tests on some segmentation tasks?

-----
Skipped about 10 steps here
-----
self.temperature:  Parameter containing:
tensor([3.4501], requires_grad=True)
self.temperature:  Parameter containing:
tensor([7.5331], requires_grad=True)
self.temperature:  Parameter containing:
tensor([15.8106], requires_grad=True)
self.temperature:  Parameter containing:
tensor([49.7303], requires_grad=True)
self.temperature:  Parameter containing:
tensor([975.0599], requires_grad=True)
self.temperature:  Parameter containing:
tensor([8138381.], requires_grad=True)
self.temperature:  Parameter containing:
tensor([16275787.], requires_grad=True)
self.temperature:  Parameter containing:
tensor([24413192.], requires_grad=True)
self.temperature:  Parameter containing:
tensor([32550598.], requires_grad=True)
self.temperature:  Parameter containing:
tensor([40688004.], requires_grad=True)
self.temperature:  Parameter containing:
tensor([40688004.], requires_grad=True)
Optimal temperature: 40688004.000
After temperature - NLL: 0.693

Best
Karol

@Karol-G Karol-G changed the title Temperature scaling for segmentation tasks Temperature scaling on segmentation tasks Mar 23, 2021
@hmeine
Copy link

hmeine commented Mar 30, 2021

We use if for segmentation, with the CrossEntropyLoss. However, I have problems with the L-BFGS myself – I believe it is because the loss is locally linear around the starting temperature; the loss is evaluated many times, although only one optimizer step is performed, and it fails to go far from the starting point.

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