Anomaly detection은 크게 regular data로 generative modeling하는 방법, negative training data에 대해 discriminating 하는 방법으로 구분지어 생각할 수 있다. 그런데 이 두가지 접근은 각각 다른 failure mode를 가진다. 따라서 본 논문에서는 이 둘을 합치는 하이브리드 알고리즘을 연구 목표로 한다.
본 논문은 3개의 dense prediction을 recover하는 shared convolutional representation을 기반으로 한다.
The closed-set class posterior P(y|x) (기존 방식)
The dataset posterior P(d_in|x) (추가)
Unnormalized data likelihood P^(x) (추가)
이 때 2,3번은 standard training data, generic negative dataset 둘 다에서 학습된다.
이렇게 해서 얻은 두 prediction에 의해 하이브리드 anomaly score를 산출해서 natural image에 대해 dense open set recognition을 수행할 수 있다.
Loss function
custom loss 설계를 통해 backpropagation 시에 다루기 힘든 normalizing constant Z(θ)를 피함.
Evaluation Metrics
Open-mIoU(dense open-set performance를 위한 새로운 평가지표) 제시함.
1. Introduction
해결해야 할 문제
현대 딥러닝의 standard training procedure은 closed-set이기 때문에 심각한 안전 문제를 일으킬 수 있다. 예를 들어 unknown object가 도로에 등장했을 때 misclassification하게 되면 자율주행 자동차는 심각한 사고로 이어질 것이다. 이런 위험은 dense anomaly detection으로 semantic segmentation을 보완하여 완화할 수 있다. 실제 세계에서는 dense open-set recognition은 anomalous pixel에 대해 decision을 reject 할 수 있기 때문에 더욱 적합하다.
Discriminative appraches (classification confidence, binary classifier, Bayesian inference를 기반으로 함)
전체 input sapce에 대해 학습하는 것을 가정하기 때문에 unknown unknowns까지 포함될 수 있다.
본 논문에서 극복
이 연구에서는 두 접근법을 hybrid anomaly detector로 합친다. 두 가지 추가적인 예측으로 standard semantic segmentation model를 보완한다. (closed set 하에서의 class posterior 뿐만 아니라 거기에 이 두개 추가)
Unnormalized dense data likelihood p^(x)
Dense data posterior P(d_in|x)
두 예측은 모두 negative data를 써서 학습시킨다. 두 output을 join함으로써 정확하면서도 효과적인 dense anomaly detector DenseHybrid를 만든다.
Contribution
Pixel-level에서 end-to-end learning을 가능하게 하는 최초의 하이브리드 anomaly detector를 제안한다.
likelihood evaluation, off-the-shelf negative dataset을 활용한 discrimination 이 둘을 합친다.
우리의 실험은 minimal computational overhead임에도 불구하고 정확한 이상 탐지를 한다.
novel performance metric open-mIoU로 SOTA를 달성한다.
2. Related Work
(기존 연구들의 한계를 잘 짚어주어서 이 파트도 정리해 보았음)
Training data에서 벗어난 데이터를 탐지하는 것은 수십년 된 문제이다. machine learning 커뮤니티에서는 anomaly detection 또는 Out-of-distribution detection으로도 알려져 있다.
Early Image-wise approach
초기 image-wise approach에서는 max-softmax probability, input perturbations, ensembling, Bayesian uncertainty 등을 사용했음. 이후에는 broad negative dataset을 사용하거나 생성 기반 모델들로 학습시킨 데이터로부터 구분되게 학습하는 방식들 등이 좋은 성능을 보였음.
Generative approach
또 하나의 접근 방식은 Generative model에서 likelihood를 추정하는 것임.
이 방식은 anomalies가 inliers보다 더 높은 likelihood를 가질 수 있다는 문제가 있다.(Calibration문제 라고도 함)
추가 연구에 따르면 group-wise anomaly detection에서 더 나은 성능을 기대할 수 있지만 실질적으로 중요한 문제는 아님.
생성 모델은 negative training data에서 낮은 likelihood를 할당하는 방향으로 학습할 수도 있는데, 이 방법이 probability volume의 sub-optimal dispersion 문제를 완화해 줄 수 있음.
Image-wide anomaly detection approach
기존 생성 접근 방식은 dense likelihood estimate를 할 수 없었던 반면 max-softmax나 negative data로 discriminative training을 하는 방식은 dense prediction에 쉽게 적용할 수 있음.
많은 dense anomaly detector는 일반 training data에 negative data를 붙여서 mixed-content images로 학습됨.
Standard classification head와 features를 공유하는 OOD head에 의해 discriminative anomaly detection이 가능해짐. Shared feature는 OOD performance를 개선하고 baseline semantic segmentation model과 관련해 neglectable compuational overhead를 발생시킨다는 장점이 있음
최근 negative pixel에 대해 large softmax entropy를 갖게 하는 연구도 존재함.(Entropy maximization and meta classification for out-of-distribution detection in semantic segmentation, ICCV (2021))
Other approach
Anomalies는 feature space에서도 recognize될 수 있지만 subsampled된 feature representation 및 feature collapse로 인해 작은 물체 감지를 잘 못한다.
이전 접근 방식과 달리 input과 resynthesised image 사이의 dissimilarity에 따라 anomaly detector를 구현할 수 있다. 그러나 이 방법은 도로와 같은 균일한 배경에만 적잡하고 상당한 계산 오버헤드로 인해 실시간성이 떨어진다는 문제가 있다.
Our approach
본 논문의 접근은 Discriminative detection과 likelihood evaluation의hybrid combination이다. Discriminative OOD detection에 대한 기존 연구들도 있지만 그 접근들과는 달리 likelihood testing와의 시너지 효과를 통해 discriminative OOD detection을 개선함.
dense likelihood evaluation은 generative model을 discriminative feature에 fitting시키는 방식으로 수행되어 옴. 하지만 이 접근 방식은 two-phase training으로 인해 feature collapse에 취약하다. 또 작은 이상의 감지는 subsampling으로 인해 불안정해짐.
→ 따라서 기존 접근방식과는 달리 우리는 standard dense prediction model과 full resolution에서의 anomaly detection의 joint training을 수행함.
3. Method(Dense Recognition with Hybrid Anomaly Detector)
간단하게만 설명하면, standard dense classifier를 Dense Open-Set Recognition model로 확장해서 만들고 이 모델은 mixed content image로 학습된다.
3.1. Hybrid Anomaly Detection for Dense Prediction
Discriminative model P(y|x) = softmax(fθ2 (qθ1 (x)))에 의해 생성된 logits s으로 reinterpretation 한다. 즉 아래와 같이 input x와 label y의 unnormalized joint log-density로 reinterpret한다.
이 때 Z는 normalization constant를 나타낸다. 보통 이 Z를 계산하려면 모든 x,y에 대한 unnormalized joint density를 평가해야하므로 intractable하다. 이 연구는 효율적인 학습과 inference를 위해 z evaluation을 피한다.
어떻게 피하냐면, Standard discrimination prediction은 베이즈 룰에 의해 다음과 같이 표현할 수 있다.
따라서 unnormalized joint density (1)을 recover할 수 있고 primary discriminaive task와 logit을 공유할 수 있고, pretrained classifier를 이용할 수도 있다.
y를 marginalizing out 하여 dense likelihood p(x)를 아래와 같이 표현할 수 있다.
여기서 p(x)를 바로 구하는 걸 생각해 볼 수 있다. p(x)보다 낮으면 thresholding 해서 anomaly라고 분류하는 것이다. 그러나 이 방법은 당연히 over-generalization 문제가 있다. (outlier임에도 inlier보다 더 큰 likelihood를 갖게 될 수도 있다는 문제가 있다.) 그래서 학습 시에 negative data를 추가로 사용해서 likelihood를 최소화하는 방향으로 위 문제를 해결한다.
본 논문의 경우, 함수 g는 pre-logit에 적용하는 BN-ReLU-Conv1x1이고 이후에 non-linearity 함수 sigmoid를 통과한다. Anomaly는 오직 P(d_in|x)이 부분에서만 Detection 된다. inlier sample이면 높은 posterior를 가져야 하는데 실험을 통해 이 방식은 하이브리드 접근 방식에 비해 차선임을 보여준다. (아래 fig2)
fig 2는 toy problem에 대한 discriminative, generative detector의 단점을 보여준다. 파란색 점은 inlier data, 초록색 점은 negative data, 빨간색 점은 anomalous test data를 나타낸다. negative data가 sample space를 충분히 커버하지 못하는 경우 모델 P(d_in|x)은 inlier를 잘 구분하지 못한다.(왼쪽)
반면에 P(x)를 모델링하는 generative detector는 공간 중앙에 probability volume을 잘못 분배하는 경향이 있다. 하이브리드 모델에서 두 방식을 결합함으로써 앞선 두 문제를 해결한다.
본 논문에서의 하이브리드 모델은 P(d_out|x), p(x) 사이의 log-ratio 이다.
Z를 무시할 수 있는 이유
: ranking performance는 monotonic transformation(ex. logarithm, adding a constant)에 불변하기 때문이다. 다른 수식도 효과적일 수 있으며 이는 향후 흥미로운 해결 방안이다.
3.2. Dense Open-Set Recognition based on Hybrid Anomaly Detection
Fig 3에서 제안하는 open-set recognition setup에서의 inference 과정을 표현하였다.
먼저 RGB input이 hybrid dense model을 통과해서 pre-logit activation t와 s를 만든다.
그리고 closed-set class posterior P(y|x)=softmax(s) 를 구한다. (사진에서 노랑색)
unnormalized data likelihood p^(x)도 구한다. (사진에서 초록색)
별개의 head g는 pre-logits t를 dataset posterior P(d_out|x)로 바꾼다.
anomaly score s(x)는 마지막 두 분포 사이의 log ratio이다. (likelihood, data posterior)
최종 anomaly map은 threshold 되고, discriminative output과 합쳐져서 최종 dense open-set recognition map이 된다.
Discriminative Loss
(7)번 식이 closed world에서의 standard training에 해당되는 수식이다. 여기에 negative data D_out을 추가로 활용해서 P(d_in|x), p(x)를 설계하는데, negative pixel에 대해서는 저 두 값이 모두 낮은 확률값을 가져야 한다. 따라서 inlier에 대해서는 p(x) 즉 likelihood를 최대화, outliers에 대해서는 likelihood를 최소화하는 방향으로 학습한다.
본 논문에서는 loss의 upper bound를 다음과 같이 설계해서 normalization constant z를 피한다.
이렇게 (7),(12) 식을 비교했을 때 standard classification loss를 최소화하면 inlier pixel의 p(x)를 증가시키는 경향이 있지만 softmax output의 negative logarithm을 쓸 경우 correct class의 logit값을 키우는 경향이 있다.
또, p(x)는 inlier에 대해서만 학습시킬 수 있는데 이 방식은 Z를 approcimation하기 위해 MCMC sampling과 backpropagation을 거쳐야 하는 문제가 있다. 큰 이미지에 대해서는 사실상 불가능하다고 보면 됨.
따라서 본 논문에서는 hallucinate 대신에 negative samples를 활용해서 loss를 설계했다.
(15)처럼 joint loss로 설계해서 two phase가 아닌 하나의 loss로 통합하여 학습시킨다. 이 때 베타 하이퍼파라미터로 negative data의 영향을 조절할 수 있다.
fig 4는 학습 과정을 설명한 그림이다. Standard training 이미지에 negative object를 붙여서 만들어진 Mixed-content image가 Open Set recognition model에 들어간다. 각각의 output은 compound loss에 의해 최적화된다.
4. Measuring Dense Open-set Performance
본 논문에서는 Open-Set 성능 평가를 위한 open-IoU 메트릭을 새롭게 제시했다.
fig 5는 Open world confusion matrix를 보여준다. 부정확한 anomaly detection은 FP(노랑색), FN(빨간색)의 증가로 인해 영향을 받게 된다. (closed mIoU와 k inlier class에 대한 averaged open-IoU의 차이는 inaccurate anomaly detection 성능을 나타낸다. )
위 open_IoU로 성능을 측정하려면 K+1 labeled dataset으로 구성해야 한다. (ex. StreetHazards dataset)
0. Abstract
기존 Anomaly detection에 존재하는 한계
Anomaly detection은 크게 regular data로 generative modeling하는 방법, negative training data에 대해 discriminating 하는 방법으로 구분지어 생각할 수 있다. 그런데 이 두가지 접근은 각각 다른 failure mode를 가진다. 따라서 본 논문에서는 이 둘을 합치는 하이브리드 알고리즘을 연구 목표로 한다.
본 논문은 3개의 dense prediction을 recover하는 shared convolutional representation을 기반으로 한다.
이 때 2,3번은 standard training data, generic negative dataset 둘 다에서 학습된다.
이렇게 해서 얻은 두 prediction에 의해 하이브리드 anomaly score를 산출해서 natural image에 대해 dense open set recognition을 수행할 수 있다.
Loss function
custom loss 설계를 통해 backpropagation 시에 다루기 힘든 normalizing constant Z(θ)를 피함.
Evaluation Metrics
Open-mIoU(dense open-set performance를 위한 새로운 평가지표) 제시함.
1. Introduction
해결해야 할 문제
현대 딥러닝의 standard training procedure은 closed-set이기 때문에 심각한 안전 문제를 일으킬 수 있다. 예를 들어 unknown object가 도로에 등장했을 때 misclassification하게 되면 자율주행 자동차는 심각한 사고로 이어질 것이다. 이런 위험은 dense anomaly detection으로 semantic segmentation을 보완하여 완화할 수 있다. 실제 세계에서는 dense open-set recognition은 anomalous pixel에 대해 decision을 reject 할 수 있기 때문에 더욱 적합하다.
기존 연구들과 그 한계점
본 논문에서 극복
이 연구에서는 두 접근법을 hybrid anomaly detector로 합친다. 두 가지 추가적인 예측으로 standard semantic segmentation model를 보완한다. (closed set 하에서의 class posterior 뿐만 아니라 거기에 이 두개 추가)
두 예측은 모두 negative data를 써서 학습시킨다. 두 output을 join함으로써 정확하면서도 효과적인 dense anomaly detector DenseHybrid를 만든다.
Contribution
2. Related Work
(기존 연구들의 한계를 잘 짚어주어서 이 파트도 정리해 보았음)
Training data에서 벗어난 데이터를 탐지하는 것은 수십년 된 문제이다. machine learning 커뮤니티에서는 anomaly detection 또는 Out-of-distribution detection으로도 알려져 있다.
Early Image-wise approach
초기 image-wise approach에서는 max-softmax probability, input perturbations, ensembling, Bayesian uncertainty 등을 사용했음. 이후에는 broad negative dataset을 사용하거나 생성 기반 모델들로 학습시킨 데이터로부터 구분되게 학습하는 방식들 등이 좋은 성능을 보였음.
Generative approach
Image-wide anomaly detection approach
Other approach
Our approach
→ 따라서 기존 접근방식과는 달리 우리는 standard dense prediction model과 full resolution에서의 anomaly detection의 joint training을 수행함.
3. Method(Dense Recognition with Hybrid Anomaly Detector)
간단하게만 설명하면, standard dense classifier를 Dense Open-Set Recognition model로 확장해서 만들고 이 모델은 mixed content image로 학습된다.
3.1. Hybrid Anomaly Detection for Dense Prediction
Discriminative model P(y|x) = softmax(fθ2 (qθ1 (x)))에 의해 생성된 logits s으로 reinterpretation 한다. 즉 아래와 같이 input x와 label y의 unnormalized joint log-density로 reinterpret한다.
이 때 Z는 normalization constant를 나타낸다. 보통 이 Z를 계산하려면 모든 x,y에 대한 unnormalized joint density를 평가해야하므로 intractable하다. 이 연구는 효율적인 학습과 inference를 위해 z evaluation을 피한다.
어떻게 피하냐면, Standard discrimination prediction은 베이즈 룰에 의해 다음과 같이 표현할 수 있다.
따라서 unnormalized joint density (1)을 recover할 수 있고 primary discriminaive task와 logit을 공유할 수 있고, pretrained classifier를 이용할 수도 있다.
y를 marginalizing out 하여 dense likelihood p(x)를 아래와 같이 표현할 수 있다.
여기서 p(x)를 바로 구하는 걸 생각해 볼 수 있다. p(x)보다 낮으면 thresholding 해서 anomaly라고 분류하는 것이다. 그러나 이 방법은 당연히 over-generalization 문제가 있다. (outlier임에도 inlier보다 더 큰 likelihood를 갖게 될 수도 있다는 문제가 있다.) 그래서 학습 시에 negative data를 추가로 사용해서 likelihood를 최소화하는 방향으로 위 문제를 해결한다.
logit reinterpretation외에도 dataset poseterior P(d_in|x)에 non-linear transformation을 적용한다.
반면에 P(x)를 모델링하는 generative detector는 공간 중앙에 probability volume을 잘못 분배하는 경향이 있다. 하이브리드 모델에서 두 방식을 결합함으로써 앞선 두 문제를 해결한다.
본 논문에서의 하이브리드 모델은 P(d_out|x), p(x) 사이의 log-ratio 이다.![image](https://github.com/sy00n/DL_paper_review/assets/67910856/2ec0ae3e-2091-4908-82c3-f44cdcd0b69a)
3.2. Dense Open-Set Recognition based on Hybrid Anomaly Detection
본 논문에서는 loss의 upper bound를 다음과 같이 설계해서 normalization constant z를 피한다.
이렇게 (7),(12) 식을 비교했을 때 standard classification loss를 최소화하면 inlier pixel의 p(x)를 증가시키는 경향이 있지만 softmax output의 negative logarithm을 쓸 경우 correct class의 logit값을 키우는 경향이 있다.
또, p(x)는 inlier에 대해서만 학습시킬 수 있는데 이 방식은 Z를 approcimation하기 위해 MCMC sampling과 backpropagation을 거쳐야 하는 문제가 있다. 큰 이미지에 대해서는 사실상 불가능하다고 보면 됨.
따라서 본 논문에서는 hallucinate 대신에 negative samples를 활용해서 loss를 설계했다.
(15)처럼 joint loss로 설계해서 two phase가 아닌 하나의 loss로 통합하여 학습시킨다. 이 때 베타 하이퍼파라미터로 negative data의 영향을 조절할 수 있다.
4. Measuring Dense Open-set Performance
본 논문에서는 Open-Set 성능 평가를 위한 open-IoU 메트릭을 새롭게 제시했다.
![image](https://github.com/sy00n/DL_paper_review/assets/67910856/db3c7e8e-ad4c-4011-b288-db94752aeb89)
fig 5는 Open world confusion matrix를 보여준다. 부정확한 anomaly detection은 FP(노랑색), FN(빨간색)의 증가로 인해 영향을 받게 된다. (closed mIoU와 k inlier class에 대한 averaged open-IoU의 차이는 inaccurate anomaly detection 성능을 나타낸다. )
위 open_IoU로 성능을 측정하려면 K+1 labeled dataset으로 구성해야 한다. (ex. StreetHazards dataset)