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

Function densecrf

examples/demo_densecrf.py:6–24  ·  view source on GitHub ↗

input parameters: I : a numpy array of shape [H, W, C], where C should be 3. type of I should be np.uint8, and the values are in [0, 255] P : a probability map of shape [H, W, L], where L is the number of classes type of P should be np.float32

(I, P, param)

Source from the content-addressed store, hash-verified

4import matplotlib.pyplot as plt
5
6def densecrf(I, P, param):
7 """
8 input parameters:
9 I : a numpy array of shape [H, W, C], where C should be 3.
10 type of I should be np.uint8, and the values are in [0, 255]
11 P : a probability map of shape [H, W, L], where L is the number of classes
12 type of P should be np.float32
13 param: a tuple giving parameters of CRF (w1, alpha, beta, w2, gamma, it), where
14 w1 : weight of bilateral term, e.g. 10.0
15 alpha : spatial distance std, e.g., 80
16 beta : rgb value std, e.g., 15
17 w2 : weight of spatial term, e.g., 3.0
18 gamma : spatial distance std for spatial term, e.g., 3
19 it : iteration number, e.g., 5
20 output parameters:
21 out : a numpy array of shape [H, W], where pixel values represent class indices.
22 """
23 out = denseCRF.densecrf(I, P, param)
24 return out
25
26def convert_label_to_probability_map(label, color_list):
27 [H, W, _] = label.shape

Callers 2

demo_densecrf1Function · 0.85
demo_densecrf2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected