2014-12-02 25 views
0

我正在尋找用於圖像處理的AdaptiveMetropolis步驟方法的示例或教程。適用於Metropolis的示例/教程使用PyMC的圖像

我到目前爲止發現的唯一一個模糊的圖像相關資源是這個天文學dissertation和相關的GitHub repo

這個較寬的question似乎沒有提供PyMC示例代碼。

在模擬陣列上尋找峯值怎麼辦?

import numpy as np 
from matplotlib import pyplot as plt 

sz = (12,18) 
data_input = np.random.normal(loc=5.0, size=sz) 
data_input[7:10, 2:6] = np.random.normal(loc=100.0, size=(3,4)) 

fig = plt.figure() 
ax = fig.add_subplot(1,1,1) 
im = ax.imshow(data_input) 
ax.set_title("input") 

enter image description here

回答

1

我知道的最接近的是在這裏:http://nbviewer.ipython.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter5_LossFunctions/LossFunctions.ipynb(見 示例:在觀測黑暗的世界Kaggle大賽)

在這個線程你問一個具體問題:https://github.com/pymc-devs/pymc/issues/653約找到一個陣列在圖像中。這是對一個模型的第一次嘗試:

在這種情況下,您似乎試圖估計高斯噪聲的二維均勻分佈。你必須轉化爲實際的模型中,這但這將是一個想法:

lower_x〜DiscreteUniform(0,20)

upper_x〜DiscreteUniform(0,20)

lower_y〜 DiscreteUniform(0,20)

upper_y〜DiscreteUniform(0,20)

高度〜正常(100,1)

噪聲〜InvGamma(1,1)

意味着=零((20,20))

手段[​​[lower_x:upper_x,lower_y:upper_y] =高度#這需要是 確定性

數據〜正常(畝=手段,SD =噪聲)

這可能是更好的代碼upper_x作爲偏移,然後做lower_x:lower_x + offset_x,否則需要的電勢來執行lower_x < upper_x 。