tensorflow / probability

Probabilistic reasoning and statistical analysis in TensorFlow
https://www.tensorflow.org/probability/
Apache License 2.0
4.23k stars 1.09k forks source link

Estimate prediction uncertainty in ResNet model using MC dropout #1596

Open akamil-etsy opened 2 years ago

akamil-etsy commented 2 years ago

is there a tutorial on how to apply TFP with popular vision models such as ResNet using MC dropout, and extract aleatoric & epistemic uncertainties. Perhaps something similar to this blog post Building a Bayesian deep learning classifier, or this notebook, based on Yarin Gal' work or similar

brianwa84 commented 2 years ago

If you have a resnet model with weight, layer, or spectral normalization on the dense layers, an easy approach might be to put a random fourier features GP layer at the top. If you look at the uncertainty baselines repository, they should have recent PRs showing how to they this with pretrained models. See also the recent paper about Plex https://arxiv.org/abs/2207.07411, which suggests using SNGP with batch ensemble at the top.

TFP has a Variational GP layer you could try if the RFF GP doesn't work well--you may need to regularize the inducing points somehow to avoid singularities.

You could take pretrained model activations and feed those into a VAE.

Depending how multi-class your label space is, you might benefit from this approach https://openreview.net/pdf?id=Id7hTt78FV

Brian Patton | Software Engineer | @.***

On Thu, Jul 28, 2022 at 11:17 PM akamil-etsy @.***> wrote:

is there a tutorial to apply Tensorflow Probability with popular pretrained computer vision models such as ResNet, we just need an uncertainty estimate with each prediction, similar to this excellent blog post on Building a Bayesian deep learning classifier https://towardsdatascience.com/building-a-bayesian-deep-learning-classifier-ece1845bc09, which is based on Yarin Gal work

I see examples for a lot of obscure academic models or toy models but not for the most popular ones like pretrained ResNet, where uncertainty estimates would be useful to a lot of people

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/probability/issues/1596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJFSI3D3GX4BZL56I3AX7LVWNENRANCNFSM547J6VLA . You are receiving this because you are subscribed to this thread.Message ID: @.***>