论文阅读 (105):Out-of-distribution detection with deep nearest neighbors (2022 ICML)

本文介绍了一种基于深度学习的OOD检测方法,利用非参数近邻距离,无需分布假设,通过计算测试样本与训练集嵌入的距离进行判断。决策函数基于样本与训练集中第k个最近邻的距离。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 概述

1.1 要点

题目:深度近邻分布外检测 (Out-of-distribution detection with deep nearest neighbors)

方法:本文探索了非参数近邻距离在OOD检测中的使用,其不需要任何分布假设,且取得了优异性能。图1展示了所提出KNN-OOD检测方法的示意。

图1:近邻OOD检测框架示意

1.2 代码

https://github.com/deeplearning-wisc/knn-ood

1.3 引用

@inproceedings{Sun:2022:2082720840,
author		=	{Sun, Yi You and Ming, Yi Fei and Zhu, Xiao Jin and Li, Yi Xuan},
title		=	{Out-of-distribution detection with deep nearest neighbors},
booktitle	=	{{ICML}},
pages		=	{20827--20840},
year		=	{2022},
url			=	{https://proceedings.mlr.press/v162/sun22d/sun22d.pdf}
}

2 深度近邻OOD检测

本节将描述基于近邻的OOD检测方法,其利用特征嵌入且假设测试OOD样本与ID数据的差异足够大。

z = ϕ ( x ) / ∥ ϕ ( x ) ∥ 2 \mathbf{z}=\phi(\mathbf{x})/\|\phi(\mathbf{x})\|_2 z=ϕ(x)/∥ϕ(x)2表示标准化的logits特征,其中 ϕ : X ↦ R m \phi:\mathcal{X}\mapsto\mathbb{R}^m ϕ:XRm是一个特征编码器。令 Z n = ( z 1 , z 2 , … , z n ) \mathbb{Z}_n=(\mathbf{z}_1,\mathbf{z}_2,\dots,\mathbf{z}_n) Zn=(z1,z2,,zn)表示训练集的嵌入集合。在测试期间,导出测试样本 x ∗ \mathbf{x}^* x z ∗ \mathbf{z}^* z,并计算其到 z i ∈ Z n \mathbf{z}_i\in\mathbb{Z}_n ziZn的欧式距离 ∥ z i − z ∗ ∥ \| \mathbf{z}_i-\mathbf{z}^* \| ziz。接下来按照距离的升序重排列 Z n \mathbb{Z}_n Zn,得到 Z n ′ = ( z ( 1 ) , z ( 2 ) , … , z ( n ) ) \mathbb{Z}_n'=(\mathbf{z}_{(1)},\mathbf{z}_{(2)},\dots,\mathbf{z}_{(n)}) Zn=(z(1),z(2),,z(n))。用于OOD检测的决策函数给定为:
G ( z ∗ ; k ) = 1 { − r k ( z ∗ ) ≥ λ } , G(\mathbf{z}^*;k)=\mathbf{1}\{-r_k(\mathbf{z}^*)\geq\lambda\}, G(z;k)=1{rk(z)λ},其中 − r k ( z ∗ ) = ∥ z ∗ − z ( k ) ∥ 2 -r_k(\mathbf{z}^*)=\|\mathbf{z}^*-\mathbf{z}_{(k)}\|_2 rk(z)=zz(k)2,以及 1 { ⋅ } \mathbf{1}\{\cdot\} 1{}是指示函数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值