2024年4月17日水曜日

MaxLogit

 MaxLogitの定義は以下の通り。

[2110.06207] Open-Set Recognition: a Good Closed-Set Classifier is All You Need? (arxiv.org)
known / unknown の AUC-ROC のみです。logit の閾値が Unknown の検出性能に大きく影響するでしょう。logit が小さいほど unknown となる定義です。

the maximum logit score (MLS) to provide our open-set score, i.e., S(y∈C|x) = maxj∈C wj · Φθ(x)

[1911.11132] Scaling Out-of-Distribution Detection for Real-World Settings (arxiv.org)
正負逆転していますので、大きいほどunknown?

This is problematic for the maximum softmax probability (MSP) baseline (Hendrycks & Gimpel, 2017), which uses the negative maximum softmax probability as the anomaly score, or − maxk exp f(x)k/ Σexp f(x)i = − maxk p(y=k|x), where f(x) is the unnormalized logits of classifier f on input x. Classifiers tend to have higher confidence on in-distribution examples than out-of-distribution examples, enabling OOD detection. 

we propose using the negative of the maximum unnormalized logit for an anomaly score − maxk f(x)k, which we call MaxLogit.

https://github.com/kkirchheim/pytorch-ood/blob/dev/src/pytorch_ood/detector/maxlogit.py 
正負逆転、negative の流儀です。

    def score(logits: Tensor) -> Tensor:
        return -logits.max(dim=1).values 

[2107.11264] Standardized Max Logits: A Simple yet Effective Approach for Identifying Unexpected Road Obstacles in Urban-Scene Segmentation (arxiv.org)
厳密には他の ML とは異なりますが、こちらも negative の流儀。

Note that we use the negative value of the final SML as the anomaly score. 

 [2311.05006] Familiarity-Based Open-Set Recognition Under Adversarial Attacks (arxiv.org)
最初の論文と同じ positive の定義です。この文献では、logit score に対する敵対的攻撃を Decrease the score of known categories と Increase the score of known categories の2種に区分しています。面白いですね。

the Maximum Logit Score (MLS) [22, 3]: SMLS(y∈F|x) := maxy fθ(x)y, which has outperformed the MSP score in prior work [22].

ARPL (Adversarial Reciprocal Point Learning) (Chen et al., 2020a; 2021)
コードを読むと、敵対的画像を用いないARPL のみの場合は MaxLogitを使用しています(+CS では SoftMaxを通しています)。最初の論文と同じ positive の定義です。実際、MNISTの例でLogit値を出力させると、inよりもoutの値が低くなります。

However,the various negative examples (unknown) are not providedfor  training  the  neural  network,  so  as  that  these  samplesobtain  lower  activation  magnitudes  from  the  neural  net-work than positive samples (known). 

MaxLogitを用いる手法では、正負に留意する必要がありそうです。


0 件のコメント:

コメントを投稿