How to use the stardist.non_maximum_suppression function in stardist

To help you get started, we’ve selected a few stardist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mpicbg-csbd / stardist / tests / _old_test_nms.py View on Github external
import numpy as np
from stardist import non_maximum_suppression

n=128

prob = np.random.uniform(0,1,(n,n))
coord = np.random.uniform(0,10,(n,n,2,32))

inds = non_maximum_suppression(coord, prob, nms_thresh =.3)
inds = non_maximum_suppression(coord, prob, nms_thresh =.5)
inds = non_maximum_suppression(coord, prob, nms_thresh =.7)
github mpicbg-csbd / stardist / tests / test_nms2D.py View on Github external
def test_bbox_search(img):
    prob = edt_prob(img)
    dist = star_dist(img, n_rays=32, mode="cpp")
    coord = dist_to_coord(dist)
    nms_a = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=False)
    nms_b = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=True)
    check_similar(nms_a, nms_b)
github mpicbg-csbd / stardist / tests / test_nms2D.py View on Github external
def test_bbox_search(img):
    prob = edt_prob(img)
    dist = star_dist(img, n_rays=32, mode="cpp")
    coord = dist_to_coord(dist)
    nms_a = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=False)
    nms_b = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=True)
    check_similar(nms_a, nms_b)
github mpicbg-csbd / stardist / tests / test_nms2D.py View on Github external
def test_acc(img):
    prob = edt_prob(img)
    dist = star_dist(img, n_rays=32, mode="cpp")
    coord = dist_to_coord(dist)
    points = non_maximum_suppression(coord, prob, prob_thresh=0.4)
    img2 = polygons_to_label(coord, prob, points, shape=img.shape)
    m = matching(img, img2)
    acc = m.accuracy
    print("accuracy {acc:.2f}".format(acc=acc))
    assert acc > 0.9