MCPcopy Create free account
hub / github.com/ImprintLab/Medical-SAM2 / random_click

Function random_click

func_2d/utils.py:425–430  ·  view source on GitHub ↗
(mask, point_label = 1)

Source from the content-addressed store, hash-verified

423
424
425def random_click(mask, point_label = 1):
426 max_label = max(set(mask.flatten()))
427 if round(max_label) == 0:
428 point_label = round(max_label)
429 indices = np.argwhere(mask == max_label)
430 return point_label, indices[np.random.randint(len(indices))]
431
432def agree_click(mask, label = 1):
433 # max agreement position

Callers 1

__getitem__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected