Class-wise thresholding for robust out-of-distribution detection