Advancing Out-of-Distribution Detection through Data Purification and Dynamic Activation Function Design