Enabling Reliable and Adaptive AI on Security-Critical Applications by Handling Out-of-distribution Data