-
Notifications
You must be signed in to change notification settings - Fork 2
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
SCALE + ASH methods #88
base: master
Are you sure you want to change the base?
Conversation
Added safeguard for preventing react and scale to be used simultaneously
Note: SCALE has poor performances on CIFAR10 vs SVHN because the penultimate layer has dimension 64 only on the tested resnet18
+ safeguards to prevent using ash with react and scale
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice big PR!
) | ||
def test_ash(detector_name, auroc_thr, fpr95_thr): | ||
""" | ||
Test ASH + [MLS, MSP, Energy, ODIN, Entropy] on toy blobs OOD dataset-wise task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you test Entropy and MSP, as suggested in the docstring here? BTW, we could now add GEN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Entropy and MSP relies on softmax and seems to induce numerical instabilities and Nans. It is the same for GEN. Maybe we should put in the doc that ASH should not be used with Entropy MSP and GEN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, indeed it can be good to add a warning message somewhere to warn users about ASH
Co-authored-by: cofri <[email protected]>
Co-authored-by: cofri <[email protected]>
Implements both ASH and SCALE baselines at the same time because they are very similar.
SCALE method
SCALE method basically consists of re-using existing logit-based OOD methods, but with penultimate layer activations scaled. Let$a$ be the activation vector, and $P_p(a)$ the $p$ -th percentile of $a$ 's values. The scaling is computed using the formula
$s = \exp(\frac{\sum_{i} a_i}{\sum_{a_i > P_p(a)} a_i})$
Here, we focus on a Resnet trained on CIFAR10, challenged on SVHN.
Reference
Scaling for Training Time and Post-hoc Out-of-distribution Detection Enhancement, ICLR 2024
https://arxiv.org/abs/2111.12797
ASH method
This notebook aims at evaluating the ASH method.
ASH method basically consists of re-using existing logit-based OOD methods, but with penultimate layer activations scaled and pruned. Let$a$ be the activation vector, and $P_p(a)$ the $p$ -th percentile of $a$ 's values. The scaling is computed using the same formula as above. The activation vector is pruned for values $a_i \leq P_p(a)$ .
Here, we focus on a Resnet trained on CIFAR10, challenged on SVHN.
Reference
Extremely Simple Activation Shaping for Out-of-Distribution Detection, ICLR 2023
http://arxiv.org/abs/2209.09858