Suhee_Yoon-2_d8241add1.png Suhee Yoon 2024.02.13

[NeurIPS 2023] Out-of-Distribution Detection via Synthetic Outlier Generation Part 1

Data Intelligence (DI) Lab at LG AI Research presented their study titled “Diffusion-Based Semantic-Discrepant Outlier Generation for Out-of-Distribution Detection” [1] at the NeurIPS 2023 SyntheticData4ML Workshop. Together with researchers, the DI Lab also discussed various synthetic outlier generation methods and suitable detection approaches to improve out-of-distribution detection performance. To share some of the important insights gained along the way, we will explore the research paper LG AI Research has published, as well as some of the other meaningful ones that would be worthwhile to examine.

 

▶ Out-of-Distribution Detection via Synthetic Outlier Generation
ㆍ Part 1 DI Lab Suhee Yoon
ㆍ Part 2 DI Lab Sanghyu Yoon (Link)

 

Out-of-Distribution Detection

Out-of-Distribution (OOD) Detection is the problem of detecting whether a new given data point belongs to an existing In-Distribution (ID) or not. For many years, OOD Detection has been used in a variety of real world applications, including medical diagnostics, autonomous driving, prediction, and more. In particular, among several OOD Detection methodologies, the Outlier Exposure (OE) method, which utilizes an auxiliary OOD dataset, has gained traction due to its superior performance. The auxiliary OOD dataset provides additional information about discrepancies between the ID and the OOD and contributes significantly to the performance of the OOD Detector model. Due to its simple but effective performance improvements, there has been a recent surge in methodology research based on OE.

Diffusion-based Outlier Generation

The most important thing to consider for an OE approach utilizing auxiliary OOD datasets is the issue of acquiring outlier datasets in the real world. Determining whether a particular data point is an OOD or an ID is labor-intensive and costly. Therefore, to mitigate the aforementioned issues, many researchers have recently focused on synthetic dataset generation methodologies based on various generative AI models such as GAN and Diffusion. However, previous studies have mostly produced blurry image results and failed to generate more sophisticated OOD images. On the other hand, both of the papers we will introduce successfully employ diffusion models to generate photo-realistic outliers. Let’s take a closer look at these two works.

 

1. Diffusion-based Semantic-Discrepant Outlier Generation for Out-of-Distribution Detection


Figure 1. Full overview of proposed method[1]
(Top image) Generation of SD Outliers, (Bottom image) OOD Detection based on SD outliers

 

This study, published by LG AI Research DI Lab, defined two attributes that are important for creating an auxiliary OOD dataset as follows. (1) The generated dataset must be close enough to the ID, and (2) it must have semantic information that is clearly distinguishable from the ID. In other words, maintaining nuisance information unrelated to semantic content, such as background, while preserving semantic information can play an effective role in generating OOD datasets. This study presents the generation of Semantic-Discrepant (SD) outliers with these properties and a novel OOD Detection methodology that utilizes them.

 

Semantic-Discrepant Outlier Generation



This study proposes the generation of SD outliers that can be utilized for unsupervised OOD detection without label information. For this purpose, we leverage the state-of-the-art self-supervised clustering methodology, SCAN, that recently demonstrated SOTA clustering performance to obtain pseudo-label y~. For Din:={(x(i),y~(i) )}. Dout generation, we use the Classifier-Free Guidance Diffusion (CFG) model, a simple and effective conditional diffusion model that can be used without a separate classifier. We include Din:={(x(i),y~(i) )} as the input and use the above loss function to learn the diffusion model from scratch to optimize noise prediction ϵθ.

 

 

Next is Semantic-Discrepant Guidance, the main proposed method in this study. First, we add S amount of noise to x Din, much less than the original timestep T, to get an image xS that is more affected by corruption in the semantic part rather than the nuisance part. When denoising xS again, a different cluster label is randomly selected instead of the pseudo-label y~ of the image. The result is a realistic image of the outlier with key semantic information lost or deformed while the nuisance part is largely maintained DOut :={(x(i),y~(i) )}.

 

Figure 2. Outlier example using CIFAR10 Dataset[1]

 

Looking specifically at the generated images in Figure 2, we can see that the backgrounds are mostly maintained while various corruptions are made to key semantics, such as the car’s wheels disappearing, the bird’s legs going from two to four, and the dog’s head acquires a bird’s beak.

 

OOD Detection with Semantic-Discrepant Outlier

 

 

The above-mentioned loss, consisting of three terms, is employed for training the OOD Detector using an SD Outlier. The first term is a binary classification that distinguishes between the ID and OOD, and the remaining terms are multi-class classifications that match pseudo-labels for the ID and OOD respectively. For outliers, they are given a sufficiently low λ value to reduce their impact on learning, as their existing semantic information has been heavily modified.

 

 

A new method based on k Nearest Neighbours (kNNs)is proposed as a scoring method using the SD Outlier. In addition to the existing distance-based score, which is widely used in OOD Detection using only Din, we propose a voting-based score that utilizes the SD Outlier and DOut. The voting-based score method indicates the ratio of SD Outliers among nearest k training points that are close to the data point.

 

Figure 3. (ID) CIFAR10 OOD Detection AUROC (%) performance results[1]

 

When the proposed method in this paper is evaluated based on the CIFAR10 Dataset, the results are shown in Figure 3. In particular, the performance improvement when viewing CIFAR100 with OOD, which has the most similar class information to CIFAR10, is noteworthy as it is comparable to GT performance (98.2%).

 

Conclusion

Through the above paper, LG AI Research introduced the OOD Detection Framework that incorporates the Semantic-Discrepant Outlier Generation method. The core idea of the research is to successfully generate semantically corrupted outliers while maintaining the nuisance of the ID through a simple but effective method called Semantic-Discrepant Guidance. Currently, DI Lab at LG AI Research is expanding the scope of application of the proposed method to high-resolution datasets such as ImageNet by utilizing pre-trained generative AI models such as Stable Diffusion. This method is expected to effectively reduce the cost of labeling, while also significantly improving performance in real world industries.

 

2. Dream the Impossible: Outlier Imagination with Diffusion Models

In this study, we utilize Stable Diffusion, a pre-trained text-to-image model, to generate outliers in the presence of labels in the ID dataset. We argue that mapping text prompts for ID is easily achieved by utilizing class information in a text-conditioned latent space, whereas finding text prompts for outliers is more challenging. Therefore, in this paper, we propose a method that focuses on the long tail of the distribution of IDs and generates different outliers based on that perspective.

 

Figure 4. Overview of proposed method[2]

 

Learning the Text-Conditioned Latent Space

 



Figure 5. Classifier learning number text-conditioned visual latent space TSNE[2]

 

The core idea of this study begins with mapping the image embeddings of Din and token embeddings T(y) to the text-conditioned visual latent space in. Utilizing a separate classifier, the following loss function is designed to train so that each image embedding holds a high probability of aligning with the token embedding corresponding to its class label. After training, it can be observed, as shown in Figure 5, that images are well-mapped to each token embedding.

 

Outlier Imagination via Text-Conditioned Latent

A new outlier token is selected in the text-conditioned visual latent space in and a diffusion model is used to generate photo-realistic outliers in pixel-space. A new Outlier Token v is derived based on the low-likelihood part of ID embedding. First, the k Nearest Neighbors (kNNs) are calculated in the Training Dataset and the part with the largest (kNNs) distance is determined as the Boundary ID Point. Then, v is sampled at a distance of covariance σ2 from each Boundary ID Point centered on σ2I:v N(z1,σ2I).

 

To obtain an outlier image in pixel space, outlier embedding v is decoded using a diffusion model.

 

 

The generated synthetic outliers are used to regularize the classification model. The first term of the loss function below is responsible for the multi-class classification of the labels in the ID dataset, and the second term is responsible for the binary classification of the boundary ID points and the generated outliers. OOD Detection utilizes the score from the second term.

 

 

The proposed method of this study can be seen again in the capital code in Figure 6 below.

 

Figure 6. Proposed method of this study[2]

 

To validate the performance of the proposed method, we compared the results on various OOD datasets with the ImageNet-100 dataset as the ID. It outperformed existing outlier synthesis methods utilizing GAN, VOS, and NPOS. Looking at the generated outlier images, it's crucial to note, as emphasized in this paper, that the careful selection of σ2 is essential. Setting the covariance σ2 too small may generate ID images with the same label as zi, while setting it too large could produce ID images with a different label from zi.

 

Figure 7. (ID) ImageNet-100 OOD Detection performance results[2]

 

Figure 8. Example of outlier image generated by covariance[2]

 

Conclusion

This study proposed the DREAM-OOD Framework, which utilizes visual-text conditioned latent space information and diffusion models for photo-realistic outlier generation. First, outlier tokens were selected based on the low-likelihood area in the visual-text conditioned latent space and converted them to pixel-level using Stable Diffusion. While the proposed method has the advantage of generating various outliers by utilizing ID information, it is sensitive to the hyper-parameters required for outlier sampling and needs to be improved to be more robust. Additionally, the distance in the visual-text conditioned latent space and the actual pixel-level distance may not correspond to each other. This problem is common to most recently published Diffusion-Based Outlier Generation studies.

 

Discussion

We took a closer look at two papers presented at NeurIPS 2023 on diffusion-based outlier generation methods. Recently, generative AI-based models such as GPT-3 and Stable Diffusion have been performing well, and research on their application to OOD Detection has been actively conducted. Outlier generation research continues to expand as generation AI-based models can utilize a variety of source datasets, including image, speech, text, semantics, and more. Moreover, as mentioned in the preceding conclusion, when utilizing these source datasets, common issues arise. Research directions focusing on improving these issues are expected to be prominent in the future.

LG AI Research continues to present its successful research at global artificial intelligence conferences, including NeurIPS 2023. ‘LG AI Day’, LG booth, and ‘Tech Talk’ communicated and networked with practitioners and researchers on the latest research trends. In particular, LG AI Research’s DI Lab is expanding its research scope in various directions by utilizing pre-trained generative AI models, as discussed earlier. By defining and solving various real world problems, we plan to lead technological development through applied research. In the long run, we aim to contribute to creating meaningful changes and delivering impactful value in real world industries through AI technology.

 

▶ Diffusion-based Semantic-Discrepant Outlier Generation for Out-of-Distribution Detection (Link)

▶ Want to learn more about the NeurIPS 2023 Research Blog series? (Link)

참고

[1] Suhee Yoon, Sanghyu Yoon, et al. Diffusion-based Semantic-Discrepant Outlier Generation for Out-of-Distribution Detection. (NeurIPS 2023, Synthetic4ML Workshop)

[2] Du, Xuefeng, et al. Dream the impossible: Outlier imagination with diffusion models. (NeurIPS 2023) Zhang, Jingyang, et al. OpenOOD v1. 5: Enhanced Benchmark for Out-of-Distribution Detection. arXiv preprint arXiv:2306.09301, 2023.

[3] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models, 2020. Niv Cohen, Ron Abutbul, and Yedid Hoshen. Out-of-distribution detection without class labels. In European Conference on Computer Vision, pages 101-117. Springer, 2022.

[4] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations, 2017.

[5] Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Machine Learning, 2019.

[6] Jingyang Zhang, Nathan Inkawhich, Randolph Linderman, Yiran Chen, and Hai Li. Mixture outlier exposure: Towards out-of-distribution detection in fine-grained environments. In IEEE/CVF Winter Conference on Applications of Computer Vision, page 5531-5540, 2023.

[7] Qing Yu and Kiyoharu Aizawa. Unsupervised out-of-distribution detection by maximum classifier discrepancy. In IEEE/CVF international conference on computer vision, pages 9518-9526, 2019.

[8] Konstantin Kirchheim and Frank Ortmeier. On outlier exposure with generative models. In NeurIPS ML Safety Workshop, 2022.

[9] Wouter Van Gansbeke, Simon Vandenhende, Stamatios Georgoulis, Marc Proesmans, and Luc Van Gool. Scan: Learning to classify images without labels. In European conference on computer vision, pages 268-285. Springer, 2020.

[10] Du, Xuefeng, et al. Vos: Learning what you don't know by virtual outlier synthesis. arXiv preprint arXiv:2202.01197, 2022.