MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / maxflow2d

Function maxflow2d

examples/demo_maxflow.py:8–24  ·  view source on GitHub ↗

maxflow for 2D image segmentation. Only binary segmentation is supported. input parameters: I : a numpy array of shape [H, W], or [H, W, C] where C should be 3. type of I should be np.float32 P : a probability map of shape [H, W, L], where L==2 is the nu

(I, P, param)

Source from the content-addressed store, hash-verified

6import matplotlib.pyplot as plt
7
8def maxflow2d(I, P, param):
9 """
10 maxflow for 2D image segmentation. Only binary segmentation is supported.
11 input parameters:
12 I : a numpy array of shape [H, W], or [H, W, C] where C should be 3.
13 type of I should be np.float32
14 P : a probability map of shape [H, W, L], where L==2 is the number of classes
15 type of P should be np.float32
16 param: a tuple giving parameters of CRF (lambda, sigma), where
17 lambda : weight of smooth term, e.g. 20.0
18 sigma : std intensity value, e.g., 10
19
20 output parameters:
21 lab : a numpy array of shape [H, W], where pixel values represent class indices.
22 """
23 lab = maxflow.maxflow2d(I, P, param)
24 return lab
25
26def interactive_maxflow2d(I, P, S, param):
27 """

Callers 1

demo_maxflowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected