The paper addresses the issue of detecting out-of-distribution samples, which is crucial in many real-world machine learning applications. Deep neural networks are known to be overconfident in their predictions, often failing to distinguish between in-distribution and out-of-distribution samples. To improve this, the authors propose a novel training method for classifiers that enhances the detection performance without compromising classification accuracy. The method introduces a new loss function, called the confidence loss, which forces the classifier to be less confident on out-of-distribution samples. Additionally, a generative adversarial network (GAN) is used to implicitly generate effective training samples for out-of-distribution detection. The joint training of the classifier and GAN alternates between minimizing the classifier's loss and the GAN's loss, leading to improved detection performance. The effectiveness of the proposed method is demonstrated using deep convolutional neural networks on various image datasets, showing significant improvements over existing threshold-based detectors.The paper addresses the issue of detecting out-of-distribution samples, which is crucial in many real-world machine learning applications. Deep neural networks are known to be overconfident in their predictions, often failing to distinguish between in-distribution and out-of-distribution samples. To improve this, the authors propose a novel training method for classifiers that enhances the detection performance without compromising classification accuracy. The method introduces a new loss function, called the confidence loss, which forces the classifier to be less confident on out-of-distribution samples. Additionally, a generative adversarial network (GAN) is used to implicitly generate effective training samples for out-of-distribution detection. The joint training of the classifier and GAN alternates between minimizing the classifier's loss and the GAN's loss, leading to improved detection performance. The effectiveness of the proposed method is demonstrated using deep convolutional neural networks on various image datasets, showing significant improvements over existing threshold-based detectors.