A General Framework for Uncertainty Estimation in Deep Learning