/monte_carlo_dropout

Uncertainty estimation in deep learning using monte carlo dropout with keras

Primary LanguagePythonMIT LicenseMIT

monte_carlo_dropout

Uncertainty estimation in deep learning using monte carlo dropout with keras.
In this sample, estimate uncertainty in CNN classification of dogs and cats images using monte carlo dropout.
I examined CNN using sigmoid and softmax. Some of the results are shown below. Note that P(dog) is the probability of being a dog.

mrc
fig. [CNN using sigmoid] std of predicted P(dog) vs predicted P(dog) when using a dog image for input.
mrc
fig. [CNN using sigmoid] std of predicted P(dog) vs predicted P(dog) when using a cat image for input.

mrc
fig. [CNN using softmax] std of predicted P(dog) vs predicted P(dog) when using a dog image for input.
mrc
fig. [CNN using softmax] std of predicted P(dog) vs predicted P(dog) when using a cat image for input.

The details are described in the blog below.
https://st1990.hatenablog.com/entry/2019/07/31/010010

dnn_uncertainty.py

  • estimate uncertainty in classification of dogs and cats.

montecarlo_dropout.py

  • Convert keras model to model which uses dropout in inference.

classifier_cnn.py

  • Create binary calassification CNN model with dropout and L2 regularization.

cifar10_data.py

  • Treat cifar10 data.

monte_carlo_dropout

MC DropoutでのDLの不確かさ評価(keras)。
このサンプルでは、犬猫画像のCNNでの分類の不確かさを評価する。
詳細は以下のブログ参照。
https://st1990.hatenablog.com/entry/2019/07/31/010010

dnn_uncertainty.py

犬猫分類の不確かさを評価する。

montecarlo_dropout.py

kerasモデルを推論時にdropoutを使えるモデルに変換する。

classifier_cnn.py

dropoutとL2正則化を使った二値分類CNNを作成する。

cifar10_data.py

cifar10のデータを扱う。