def clean_contour(prob, c_input):
# Smaller areas with lower prob are very likely to be false positives
wt_mor = binary_dilation((c_input > 0).astype(np.float32), iterations=10)
labels = measure.label(wt_mor)
w_area = []
for l in range(1, np.amax(labels) + 1):
w_area.append(np.sum(prob[labels == l]))
if len(w_area) > 0:
max_area = np.amax(w_area)
for l in range(len(w_area)):
if w_area[l] < max_area / 2.0:
c_input[labels == l + 1] = 0
return c_input
评论列表
文章目录