SlideShare a Scribd company logo
1 of 22
Download to read offline
bayesImageS: an R package for Bayesian image analysis
Matt Moores
@MooresMt
https://mooresm.github.io/bayesImageS
NIASRA, University of Wollongong, NSW, Australia
useR! 2018
1 / 22
Image Segmentation
Classifying the observed pixel intensities y := {yi }n
i=1 ∈ Rn
according to a set of latent labels z := {zi }n
i=1 ∈ [1, . . . , k]n
Assuming additive Gaussian noise:
yi | zi = j ∼ N µj, σ2
j
The resulting augmented likelihood is a mixture of Gaussians:
p(y, z | µ, σ2
, β) =
n
i=1
p yi | µzi , σ2
zi
p(zi | zi , β)
2 / 22
Rydén & Titterington (1998) J. Comput. Graph. Stat. 7(2): 194–211.
Synthetic Data
z <- sample.int(3, 49, TRUE)
mu <- c(-1, 0, 1)
sigma <- rep(0.3, 3)
y <- rnorm(49, mu[z], sigma[z])
2
4
6
Y
−1
0
1
Z
0.0
0.2
0.4
0.6
density
Component
Means
−1
0
1
3 / 22
Mixture Model
library(bayesImageS)
lPriors <- list(k=3, mu=c(-1,0,1), mu.sd=rep(0.25,3),
sigma=rep(0.5,3), sigma.nu=rep(5,3), lambda=rep(1,3))
mix.fit <- gibbsGMM(y, priors=lPriors)
mu[1] mu[2] mu[3]
0 200 400 600 800 1000 0 200 400 600 800 1000 0 200 400 600 800 1000
0.4
0.8
1.2
1.6
−0.8
−0.4
0.0
0.4
−1.50
−1.25
−1.00
−0.75
−0.50
mu[1] mu[2] mu[3]
−1.4 −1.2 −1.0 −0.8 −0.6 −0.4 −0.8 −0.4 0.0 0.4 0.4 0.8 1.2 1.6
Estimated
True
4 / 22
Pixel Classification
Ground Truth Classification
5 / 22
Potts model
In many images, neighbouring pixels tend to share the same label.
This tendency can be represented using a hidden Markov random field:
p(zi | zi , β) =
exp{β i∼ δ(zi , z )}
k
j=1 exp{β i∼ δ(j, z )}
where:
β is the inverse temperature parameter,
i ∼ are the neighbours of pixel i,
and δ(x, y) is the Kronecker delta function.
6 / 22
Potts (1952) Proceedings of the Cambridge Philosophical Society 48(1)
Inverse Temperature
7 / 22
Synthetic Data
Using the Swendsen-Wang algorithm to simulate from the Potts model with known β:
mask <- matrix(1, nrow=7, ncol=7)
neigh <- getNeighbors(mask, c(2,2,0,0))
blocks <- getBlocks(mask, 2)
k <- 3
beta <- 0.88
res.sw <- swNoData(beta, k, neigh, blocks, niter=200)
z <- matrix(max.col(res.sw$z)[1:nrow(neigh)], nrow=nrow(mask))
y <- rnorm(49, mu[z], sigma[z])
8 / 22
Fitting the Model
lPriors <- list(k=3, mu=c(-1,0,1), mu.sd=rep(0.25,3),
sigma=rep(0.5,3), sigma.nu=rep(5,3), beta=c(0,2))
mh <- list(algorithm="ex",bandwidth=0.001,auxiliary=200)
mrf.fit <- mcmcPotts(y, neigh, blocks, lPriors, mh, niter=500, nburn=250)
0.0
0.5
1.0
0 100 200 300 400 500
beta
beta
0.0 0.5 1.0
Estimated
True
9 / 22
Pixel Classification
Ground Truth Classification
10 / 22
Intractable Likelihood
p(β|z) =
C−1(β)eβS(z)π(β)
β C−1(β)eβS(z)π(dβ)
(1)
The normalising constant has computational complexity O(nkn), since it involves a sum over all
possible combinations of the labels z ∈ Z:
C(β) =
z∈Z
eβS(z)
(2)
S(z) is the sufficient statistic of the Potts model:
S(z) =
i∼ ∈E
δ(zi , z ) (3)
where E is the set of all unique neighbour pairs.
11 / 22
Algorithms for β
The argument mh$alg selects which algorithm to use for sampling from p(β|z):
pseudolikelihood
path sampling (thermodynamic integration)
approximate exchange algorithm (AEA)
approximate Bayesian computation (ABC-MCMC and ABC-SMC)
Bayesian indirect likelihood (BIL)
12 / 22
Moores, Drovandi, Mengersen & Robert (2015) Stat. Comput. 25(1): 23–33.
Moores, Pettitt & Mengersen (2015; v2 2018) arXiv:1503.08066 [stat.CO]
Satellite Remote Sensing
−3050000
−3045000
−3040000
−3035000
−3030000
490000 495000 500000 505000 510000 515000
−1.0 −0.5 0.0 0.5 1.0
NDVI
Frequency −1.0 −0.5 0.0 0.5 1.0
050000100000150000
13 / 22
Image segmentation with k = 5 labels
14 / 22
Posterior Distributions
Pixel Intensity
Density
−1.0 −0.5 0.0 0.5 1.0
0.00.51.01.52.0
1.193 1.194 1.195 1.196
0200400600800
N = 450 Bandwidth = 0.0001203Density
AEA
BIL
ABC
15 / 22
Segmentation of Anatomical Structures
16 / 22
Radiography courtesy of Cathy Hargrave, Radiation Oncology Mater Centre, Queensland Health
External Field Prior
p(zi |zi∼ , β, µ, σ2
, yi ) =
exp {αi,zi + π(αi,zi )}
k
j=1 exp {αi,j + π(αi,j)}
π(zi |zi∼ , β) (4)
Isotropic translation:
π(αi,j) = log



1
nj h∈j
φ ∆(h, i)|µ∆ = 1.2, σ2
∆ = 7.32



(5)
where
nj is the number of voxels in object j
h ∈ j are the voxels in object j
∆(u, v) is the Euclidean distance between the coordinates of pixel u and pixel v
µ∆, σ2
∆ are parameters that describe the level of spatial variability of the object j
17 / 22
Patient- and Organ-Specific Prior
αi (prostate) ∼ MVN






0.1
−0.5
0.2


 ,



4.12 0 0
0 2.92 0
0 0 0.92






18 / 22
Seminal Vesicles
αi (SV) ∼ MVN






1.2
−0.7
−0.9


 ,



7.32 0 0
0 4.52 0
0 0 1.92






19 / 22
Gaussian Random Field
20 / 22
Results
−300 −250 −200 −150
150200250300
right−left (mm)
posterior−anterior(mm)
−300 −250 −200 −150
150200250300
right−left (mm)
posterior−anterior(mm)
21 / 22
Moores, Hargrave, Deegan, Poulsen, Harden & Mengersen (2015) CSDA 86: 27–41.
Summary
bayesImageS can be used for segmentation of 2D and 3D images:
Update labels using chequerboard Gibbs sampling or Swendsen-Wang
Posterior for β using the exchange algorithm, ABC, pseudolikelihood, path sampling, or BIL
Fast implementation using RcppArmadillo
Parallelism using OpenMP
PkgDown documentation: https://mooresm.github.io/bayesImageS
Version 0.5-2 currently available on CRAN: https://CRAN.R-project.org/package=bayesImageS
22 / 22

More Related Content

What's hot

Copy Move Forgery Detection Using GLCM Based Statistical Features
Copy Move Forgery Detection Using GLCM Based Statistical Features Copy Move Forgery Detection Using GLCM Based Statistical Features
Copy Move Forgery Detection Using GLCM Based Statistical Features ijcisjournal
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)VARUN KUMAR
 
Performance Analysis of CRT for Image Encryption
Performance Analysis of CRT for Image Encryption Performance Analysis of CRT for Image Encryption
Performance Analysis of CRT for Image Encryption ijcisjournal
 
対応点を用いないローリングシャッタ歪み補正と映像安定化論文
対応点を用いないローリングシャッタ歪み補正と映像安定化論文対応点を用いないローリングシャッタ歪み補正と映像安定化論文
対応点を用いないローリングシャッタ歪み補正と映像安定化論文doboncho
 
Fourier basics
Fourier basicsFourier basics
Fourier basicsNGHIPHAM14
 
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...Hsien-Hsin Sean Lee, Ph.D.
 
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERS
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERSINFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERS
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERSZac Darcy
 
無限インパルス応答システムによる拡張バイラテラルフィルタ論文
無限インパルス応答システムによる拡張バイラテラルフィルタ論文無限インパルス応答システムによる拡張バイラテラルフィルタ論文
無限インパルス応答システムによる拡張バイラテラルフィルタ論文doboncho
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)Kobkrit Viriyayudhakorn
 
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...Patrick Diehl
 
Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...journal ijrtem
 
Dynamic shear stress evaluation on micro turning tool using photoelasticity
Dynamic shear stress evaluation on micro turning tool using photoelasticityDynamic shear stress evaluation on micro turning tool using photoelasticity
Dynamic shear stress evaluation on micro turning tool using photoelasticitySoumen Mandal
 
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...ijrap
 

What's hot (19)

Copy Move Forgery Detection Using GLCM Based Statistical Features
Copy Move Forgery Detection Using GLCM Based Statistical Features Copy Move Forgery Detection Using GLCM Based Statistical Features
Copy Move Forgery Detection Using GLCM Based Statistical Features
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)
 
Performance Analysis of CRT for Image Encryption
Performance Analysis of CRT for Image Encryption Performance Analysis of CRT for Image Encryption
Performance Analysis of CRT for Image Encryption
 
Families of Triangular Norm Based Kernel Function and Its Application to Kern...
Families of Triangular Norm Based Kernel Function and Its Application to Kern...Families of Triangular Norm Based Kernel Function and Its Application to Kern...
Families of Triangular Norm Based Kernel Function and Its Application to Kern...
 
対応点を用いないローリングシャッタ歪み補正と映像安定化論文
対応点を用いないローリングシャッタ歪み補正と映像安定化論文対応点を用いないローリングシャッタ歪み補正と映像安定化論文
対応点を用いないローリングシャッタ歪み補正と映像安定化論文
 
ISCAS2013_v5
ISCAS2013_v5ISCAS2013_v5
ISCAS2013_v5
 
Me 530 assignment 2
Me 530 assignment 2Me 530 assignment 2
Me 530 assignment 2
 
CMU_13
CMU_13CMU_13
CMU_13
 
Fourier basics
Fourier basicsFourier basics
Fourier basics
 
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
Lec8 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Qui...
 
Thesis defense
Thesis defenseThesis defense
Thesis defense
 
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERS
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERSINFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERS
INFLUENCE OF OVERLAYERS ON DEPTH OF IMPLANTED-HETEROJUNCTION RECTIFIERS
 
Lecture8 xing
Lecture8 xingLecture8 xing
Lecture8 xing
 
無限インパルス応答システムによる拡張バイラテラルフィルタ論文
無限インパルス応答システムによる拡張バイラテラルフィルタ論文無限インパルス応答システムによる拡張バイラテラルフィルタ論文
無限インパルス応答システムによる拡張バイラテラルフィルタ論文
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
 
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...
Quasistatic Fracture using Nonliner-Nonlocal Elastostatics with an Analytic T...
 
Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...
 
Dynamic shear stress evaluation on micro turning tool using photoelasticity
Dynamic shear stress evaluation on micro turning tool using photoelasticityDynamic shear stress evaluation on micro turning tool using photoelasticity
Dynamic shear stress evaluation on micro turning tool using photoelasticity
 
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...
An Approach to Optimize Regimes of Manufacturing of Complementary Horizontal ...
 

Similar to bayesImageS: an R package for Bayesian image analysis

Patch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective DivergencesPatch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective DivergencesFrank Nielsen
 
QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017Fred J. Hickernell
 
A new method of gridding for spot detection in microarray images
A new method of gridding for spot detection in microarray imagesA new method of gridding for spot detection in microarray images
A new method of gridding for spot detection in microarray imagesAlexander Decker
 
Bayesian inference on mixtures
Bayesian inference on mixturesBayesian inference on mixtures
Bayesian inference on mixturesChristian Robert
 
Precomputation for SMC-ABC with undirected graphical models
Precomputation for SMC-ABC with undirected graphical modelsPrecomputation for SMC-ABC with undirected graphical models
Precomputation for SMC-ABC with undirected graphical modelsMatt Moores
 
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...Matt Moores
 
Optimal nonlocal means algorithm for denoising ultrasound image
Optimal nonlocal means algorithm for denoising ultrasound imageOptimal nonlocal means algorithm for denoising ultrasound image
Optimal nonlocal means algorithm for denoising ultrasound imageAlexander Decker
 
11.optimal nonlocal means algorithm for denoising ultrasound image
11.optimal nonlocal means algorithm for denoising ultrasound image11.optimal nonlocal means algorithm for denoising ultrasound image
11.optimal nonlocal means algorithm for denoising ultrasound imageAlexander Decker
 
Iaetsd vlsi implementation of gabor filter based image edge detection
Iaetsd vlsi implementation of gabor filter based image edge detectionIaetsd vlsi implementation of gabor filter based image edge detection
Iaetsd vlsi implementation of gabor filter based image edge detectionIaetsd Iaetsd
 
Approximate Bayesian computation for the Ising/Potts model
Approximate Bayesian computation for the Ising/Potts modelApproximate Bayesian computation for the Ising/Potts model
Approximate Bayesian computation for the Ising/Potts modelMatt Moores
 
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.51e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5Dr. I. Uma Maheswari Maheswari
 
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error norm
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error normRobust Super-Resolution by minimizing a Gaussian-weighted L2 error norm
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error normTuan Q. Pham
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and RepresentationAmnaakhaan
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 

Similar to bayesImageS: an R package for Bayesian image analysis (20)

Steven Duplij, "Polyadic rings of p-adic integers"
Steven Duplij, "Polyadic rings of p-adic integers"Steven Duplij, "Polyadic rings of p-adic integers"
Steven Duplij, "Polyadic rings of p-adic integers"
 
Patch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective DivergencesPatch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective Divergences
 
QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
A new method of gridding for spot detection in microarray images
A new method of gridding for spot detection in microarray imagesA new method of gridding for spot detection in microarray images
A new method of gridding for spot detection in microarray images
 
Control chap10
Control chap10Control chap10
Control chap10
 
Lec-3 DIP.pptx
Lec-3 DIP.pptxLec-3 DIP.pptx
Lec-3 DIP.pptx
 
Bayesian inference on mixtures
Bayesian inference on mixturesBayesian inference on mixtures
Bayesian inference on mixtures
 
Precomputation for SMC-ABC with undirected graphical models
Precomputation for SMC-ABC with undirected graphical modelsPrecomputation for SMC-ABC with undirected graphical models
Precomputation for SMC-ABC with undirected graphical models
 
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...
bayesImageS: Bayesian computation for medical Image Segmentation using a hidd...
 
Optimal nonlocal means algorithm for denoising ultrasound image
Optimal nonlocal means algorithm for denoising ultrasound imageOptimal nonlocal means algorithm for denoising ultrasound image
Optimal nonlocal means algorithm for denoising ultrasound image
 
11.optimal nonlocal means algorithm for denoising ultrasound image
11.optimal nonlocal means algorithm for denoising ultrasound image11.optimal nonlocal means algorithm for denoising ultrasound image
11.optimal nonlocal means algorithm for denoising ultrasound image
 
Iaetsd vlsi implementation of gabor filter based image edge detection
Iaetsd vlsi implementation of gabor filter based image edge detectionIaetsd vlsi implementation of gabor filter based image edge detection
Iaetsd vlsi implementation of gabor filter based image edge detection
 
Approximate Bayesian computation for the Ising/Potts model
Approximate Bayesian computation for the Ising/Potts modelApproximate Bayesian computation for the Ising/Potts model
Approximate Bayesian computation for the Ising/Potts model
 
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.51e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5
1e. Pedagogy of Mathematics (Part II) - Set language introduction and Ex.1.5
 
Symmetrical2
Symmetrical2Symmetrical2
Symmetrical2
 
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error norm
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error normRobust Super-Resolution by minimizing a Gaussian-weighted L2 error norm
Robust Super-Resolution by minimizing a Gaussian-weighted L2 error norm
 
Image Acquisition and Representation
Image Acquisition and RepresentationImage Acquisition and Representation
Image Acquisition and Representation
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 

More from Matt Moores

Bayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsBayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsMatt Moores
 
Exploratory Analysis of Multivariate Data
Exploratory Analysis of Multivariate DataExploratory Analysis of Multivariate Data
Exploratory Analysis of Multivariate DataMatt Moores
 
R package bayesImageS: Scalable Inference for Intractable Likelihoods
R package bayesImageS: Scalable Inference for Intractable LikelihoodsR package bayesImageS: Scalable Inference for Intractable Likelihoods
R package bayesImageS: Scalable Inference for Intractable LikelihoodsMatt Moores
 
Importing satellite imagery into R from NASA and the U.S. Geological Survey
Importing satellite imagery into R from NASA and the U.S. Geological SurveyImporting satellite imagery into R from NASA and the U.S. Geological Survey
Importing satellite imagery into R from NASA and the U.S. Geological SurveyMatt Moores
 
Accelerating Pseudo-Marginal MCMC using Gaussian Processes
Accelerating Pseudo-Marginal MCMC using Gaussian ProcessesAccelerating Pseudo-Marginal MCMC using Gaussian Processes
Accelerating Pseudo-Marginal MCMC using Gaussian ProcessesMatt Moores
 
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...Matt Moores
 
Bayesian modelling and computation for Raman spectroscopy
Bayesian modelling and computation for Raman spectroscopyBayesian modelling and computation for Raman spectroscopy
Bayesian modelling and computation for Raman spectroscopyMatt Moores
 
Final PhD Seminar
Final PhD SeminarFinal PhD Seminar
Final PhD SeminarMatt Moores
 
Pre-computation for ABC in image analysis
Pre-computation for ABC in image analysisPre-computation for ABC in image analysis
Pre-computation for ABC in image analysisMatt Moores
 
Variational Bayes
Variational BayesVariational Bayes
Variational BayesMatt Moores
 
Informative Priors for Segmentation of Medical Images
Informative Priors for Segmentation of Medical ImagesInformative Priors for Segmentation of Medical Images
Informative Priors for Segmentation of Medical ImagesMatt Moores
 

More from Matt Moores (13)

Bayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsBayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse Problems
 
Exploratory Analysis of Multivariate Data
Exploratory Analysis of Multivariate DataExploratory Analysis of Multivariate Data
Exploratory Analysis of Multivariate Data
 
R package bayesImageS: Scalable Inference for Intractable Likelihoods
R package bayesImageS: Scalable Inference for Intractable LikelihoodsR package bayesImageS: Scalable Inference for Intractable Likelihoods
R package bayesImageS: Scalable Inference for Intractable Likelihoods
 
Importing satellite imagery into R from NASA and the U.S. Geological Survey
Importing satellite imagery into R from NASA and the U.S. Geological SurveyImporting satellite imagery into R from NASA and the U.S. Geological Survey
Importing satellite imagery into R from NASA and the U.S. Geological Survey
 
Accelerating Pseudo-Marginal MCMC using Gaussian Processes
Accelerating Pseudo-Marginal MCMC using Gaussian ProcessesAccelerating Pseudo-Marginal MCMC using Gaussian Processes
Accelerating Pseudo-Marginal MCMC using Gaussian Processes
 
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
 
Bayesian modelling and computation for Raman spectroscopy
Bayesian modelling and computation for Raman spectroscopyBayesian modelling and computation for Raman spectroscopy
Bayesian modelling and computation for Raman spectroscopy
 
Final PhD Seminar
Final PhD SeminarFinal PhD Seminar
Final PhD Seminar
 
Intro to ABC
Intro to ABCIntro to ABC
Intro to ABC
 
Pre-computation for ABC in image analysis
Pre-computation for ABC in image analysisPre-computation for ABC in image analysis
Pre-computation for ABC in image analysis
 
Variational Bayes
Variational BayesVariational Bayes
Variational Bayes
 
Parallel R
Parallel RParallel R
Parallel R
 
Informative Priors for Segmentation of Medical Images
Informative Priors for Segmentation of Medical ImagesInformative Priors for Segmentation of Medical Images
Informative Priors for Segmentation of Medical Images
 

Recently uploaded

Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Boston Institute of Analytics
 
Rithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfRithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfrahulyadav957181
 
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelDecoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelBoston Institute of Analytics
 
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...Jack Cole
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Cathrine Wilhelmsen
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectBoston Institute of Analytics
 
knowledge representation in artificial intelligence
knowledge representation in artificial intelligenceknowledge representation in artificial intelligence
knowledge representation in artificial intelligencePriyadharshiniG41
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Boston Institute of Analytics
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...boychatmate1
 
Principles and Practices of Data Visualization
Principles and Practices of Data VisualizationPrinciples and Practices of Data Visualization
Principles and Practices of Data VisualizationKianJazayeri1
 
IBEF report on the Insurance market in India
IBEF report on the Insurance market in IndiaIBEF report on the Insurance market in India
IBEF report on the Insurance market in IndiaManalVerma4
 
DATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etcDATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etclalithasri22
 
Statistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfStatistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfnikeshsingh56
 
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfWorld Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfsimulationsindia
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxaleedritatuxx
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksdeepakthakur548787
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBoston Institute of Analytics
 

Recently uploaded (20)

Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
 
Rithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfRithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdf
 
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelDecoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
 
Data Analysis Project: Stroke Prediction
Data Analysis Project: Stroke PredictionData Analysis Project: Stroke Prediction
Data Analysis Project: Stroke Prediction
 
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...
why-transparency-and-traceability-are-essential-for-sustainable-supply-chains...
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis Project
 
knowledge representation in artificial intelligence
knowledge representation in artificial intelligenceknowledge representation in artificial intelligence
knowledge representation in artificial intelligence
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
 
Principles and Practices of Data Visualization
Principles and Practices of Data VisualizationPrinciples and Practices of Data Visualization
Principles and Practices of Data Visualization
 
IBEF report on the Insurance market in India
IBEF report on the Insurance market in IndiaIBEF report on the Insurance market in India
IBEF report on the Insurance market in India
 
DATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etcDATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etc
 
Statistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfStatistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdf
 
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfWorld Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing works
 
Insurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis ProjectInsurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis Project
 
2023 Survey Shows Dip in High School E-Cigarette Use
2023 Survey Shows Dip in High School E-Cigarette Use2023 Survey Shows Dip in High School E-Cigarette Use
2023 Survey Shows Dip in High School E-Cigarette Use
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
 

bayesImageS: an R package for Bayesian image analysis

  • 1. bayesImageS: an R package for Bayesian image analysis Matt Moores @MooresMt https://mooresm.github.io/bayesImageS NIASRA, University of Wollongong, NSW, Australia useR! 2018 1 / 22
  • 2. Image Segmentation Classifying the observed pixel intensities y := {yi }n i=1 ∈ Rn according to a set of latent labels z := {zi }n i=1 ∈ [1, . . . , k]n Assuming additive Gaussian noise: yi | zi = j ∼ N µj, σ2 j The resulting augmented likelihood is a mixture of Gaussians: p(y, z | µ, σ2 , β) = n i=1 p yi | µzi , σ2 zi p(zi | zi , β) 2 / 22 Rydén & Titterington (1998) J. Comput. Graph. Stat. 7(2): 194–211.
  • 3. Synthetic Data z <- sample.int(3, 49, TRUE) mu <- c(-1, 0, 1) sigma <- rep(0.3, 3) y <- rnorm(49, mu[z], sigma[z]) 2 4 6 Y −1 0 1 Z 0.0 0.2 0.4 0.6 density Component Means −1 0 1 3 / 22
  • 4. Mixture Model library(bayesImageS) lPriors <- list(k=3, mu=c(-1,0,1), mu.sd=rep(0.25,3), sigma=rep(0.5,3), sigma.nu=rep(5,3), lambda=rep(1,3)) mix.fit <- gibbsGMM(y, priors=lPriors) mu[1] mu[2] mu[3] 0 200 400 600 800 1000 0 200 400 600 800 1000 0 200 400 600 800 1000 0.4 0.8 1.2 1.6 −0.8 −0.4 0.0 0.4 −1.50 −1.25 −1.00 −0.75 −0.50 mu[1] mu[2] mu[3] −1.4 −1.2 −1.0 −0.8 −0.6 −0.4 −0.8 −0.4 0.0 0.4 0.4 0.8 1.2 1.6 Estimated True 4 / 22
  • 5. Pixel Classification Ground Truth Classification 5 / 22
  • 6. Potts model In many images, neighbouring pixels tend to share the same label. This tendency can be represented using a hidden Markov random field: p(zi | zi , β) = exp{β i∼ δ(zi , z )} k j=1 exp{β i∼ δ(j, z )} where: β is the inverse temperature parameter, i ∼ are the neighbours of pixel i, and δ(x, y) is the Kronecker delta function. 6 / 22 Potts (1952) Proceedings of the Cambridge Philosophical Society 48(1)
  • 8. Synthetic Data Using the Swendsen-Wang algorithm to simulate from the Potts model with known β: mask <- matrix(1, nrow=7, ncol=7) neigh <- getNeighbors(mask, c(2,2,0,0)) blocks <- getBlocks(mask, 2) k <- 3 beta <- 0.88 res.sw <- swNoData(beta, k, neigh, blocks, niter=200) z <- matrix(max.col(res.sw$z)[1:nrow(neigh)], nrow=nrow(mask)) y <- rnorm(49, mu[z], sigma[z]) 8 / 22
  • 9. Fitting the Model lPriors <- list(k=3, mu=c(-1,0,1), mu.sd=rep(0.25,3), sigma=rep(0.5,3), sigma.nu=rep(5,3), beta=c(0,2)) mh <- list(algorithm="ex",bandwidth=0.001,auxiliary=200) mrf.fit <- mcmcPotts(y, neigh, blocks, lPriors, mh, niter=500, nburn=250) 0.0 0.5 1.0 0 100 200 300 400 500 beta beta 0.0 0.5 1.0 Estimated True 9 / 22
  • 10. Pixel Classification Ground Truth Classification 10 / 22
  • 11. Intractable Likelihood p(β|z) = C−1(β)eβS(z)π(β) β C−1(β)eβS(z)π(dβ) (1) The normalising constant has computational complexity O(nkn), since it involves a sum over all possible combinations of the labels z ∈ Z: C(β) = z∈Z eβS(z) (2) S(z) is the sufficient statistic of the Potts model: S(z) = i∼ ∈E δ(zi , z ) (3) where E is the set of all unique neighbour pairs. 11 / 22
  • 12. Algorithms for β The argument mh$alg selects which algorithm to use for sampling from p(β|z): pseudolikelihood path sampling (thermodynamic integration) approximate exchange algorithm (AEA) approximate Bayesian computation (ABC-MCMC and ABC-SMC) Bayesian indirect likelihood (BIL) 12 / 22 Moores, Drovandi, Mengersen & Robert (2015) Stat. Comput. 25(1): 23–33. Moores, Pettitt & Mengersen (2015; v2 2018) arXiv:1503.08066 [stat.CO]
  • 13. Satellite Remote Sensing −3050000 −3045000 −3040000 −3035000 −3030000 490000 495000 500000 505000 510000 515000 −1.0 −0.5 0.0 0.5 1.0 NDVI Frequency −1.0 −0.5 0.0 0.5 1.0 050000100000150000 13 / 22
  • 14. Image segmentation with k = 5 labels 14 / 22
  • 15. Posterior Distributions Pixel Intensity Density −1.0 −0.5 0.0 0.5 1.0 0.00.51.01.52.0 1.193 1.194 1.195 1.196 0200400600800 N = 450 Bandwidth = 0.0001203Density AEA BIL ABC 15 / 22
  • 16. Segmentation of Anatomical Structures 16 / 22 Radiography courtesy of Cathy Hargrave, Radiation Oncology Mater Centre, Queensland Health
  • 17. External Field Prior p(zi |zi∼ , β, µ, σ2 , yi ) = exp {αi,zi + π(αi,zi )} k j=1 exp {αi,j + π(αi,j)} π(zi |zi∼ , β) (4) Isotropic translation: π(αi,j) = log    1 nj h∈j φ ∆(h, i)|µ∆ = 1.2, σ2 ∆ = 7.32    (5) where nj is the number of voxels in object j h ∈ j are the voxels in object j ∆(u, v) is the Euclidean distance between the coordinates of pixel u and pixel v µ∆, σ2 ∆ are parameters that describe the level of spatial variability of the object j 17 / 22
  • 18. Patient- and Organ-Specific Prior αi (prostate) ∼ MVN       0.1 −0.5 0.2    ,    4.12 0 0 0 2.92 0 0 0 0.92       18 / 22
  • 19. Seminal Vesicles αi (SV) ∼ MVN       1.2 −0.7 −0.9    ,    7.32 0 0 0 4.52 0 0 0 1.92       19 / 22
  • 21. Results −300 −250 −200 −150 150200250300 right−left (mm) posterior−anterior(mm) −300 −250 −200 −150 150200250300 right−left (mm) posterior−anterior(mm) 21 / 22 Moores, Hargrave, Deegan, Poulsen, Harden & Mengersen (2015) CSDA 86: 27–41.
  • 22. Summary bayesImageS can be used for segmentation of 2D and 3D images: Update labels using chequerboard Gibbs sampling or Swendsen-Wang Posterior for β using the exchange algorithm, ABC, pseudolikelihood, path sampling, or BIL Fast implementation using RcppArmadillo Parallelism using OpenMP PkgDown documentation: https://mooresm.github.io/bayesImageS Version 0.5-2 currently available on CRAN: https://CRAN.R-project.org/package=bayesImageS 22 / 22