You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While creating a graphical model for solving computer vision problems, we often use contrast sensitive weights for edges in the graph - i.e., each edge factor is alpha*(some standard function, say potts). Is it possible to add only ONE function (potts) to the graphical model and create all the factors as some scalar multiplication of that function where the scalar is different for different edges?
In the examples that I found on GitHub python examples, factor corresponding to all the edges is always the same function. Right now I am doing the following, which takes a lot of time and memory -
Code snipet -
#edges is a numpy array with dim - e x 3. edges[i] is an edge b/w nodes - edges[i,0] and edges[i,1]. Contrast sensitive wt is edges[i,2]
e = len(edges)
P1 = 1
P2 = 12
k = 128
n = 375*1245
gm = opengm.gm(np.ones(n, dtype=opengm.label_type)*k,operator='adder')
for i in range(e):
cs_wt = edges[i,2]
f = opengm.SparseFunction(shape=[k,k],defaultValue=cs_wt*P2)
p1 = P1*cs_wt
for j in range(k):
f[j,j] = 0
f[j,j+1] = p1
f[j,j-1] = p1
#
pf_id = gm.addFunction(f)
gm.addFactor(pf_id, [int(edges[i, 0]), int(edges[i, 1])])
The text was updated successfully, but these errors were encountered:
While creating a graphical model for solving computer vision problems, we often use contrast sensitive weights for edges in the graph - i.e., each edge factor is alpha*(some standard function, say potts). Is it possible to add only ONE function (potts) to the graphical model and create all the factors as some scalar multiplication of that function where the scalar is different for different edges?
In the examples that I found on GitHub python examples, factor corresponding to all the edges is always the same function. Right now I am doing the following, which takes a lot of time and memory -
Code snipet -
The text was updated successfully, but these errors were encountered: