  Out-of-distribution (OOD) detection is a crucial task for ensuring the
reliability and robustness of machine learning models. Recent works have shown
that generative models often assign high confidence scores to OOD samples,
indicating that they fail to capture the semantic information of the data. To
tackle this problem, we take advantage of sample repairing and propose a novel
OOD detection framework, namely SR-OOD. Our framework leverages the idea that
repairing an OOD sample can reveal its semantic inconsistency with the
in-distribution data. Specifically, our framework consists of two components: a
sample repairing module and a detection module. The sample repairing module
applies erosion to an input sample and uses a generative adversarial network to
repair it. The detection module then determines whether the input sample is OOD
using a distance metric. Our framework does not require any additional data or
label information for detection, making it applicable to various scenarios. We
conduct extensive experiments on three image datasets: CIFAR-10, CelebA, and
Pokemon. The results demonstrate that our approach achieves superior
performance over the state-of-the-art generative methods in OOD detection.
