MCPcopy Create free account
hub / github.com/aigc3d/LHM / FPS

Function FPS

engine/SegmentAPI/SAM.py:58–77  ·  view source on GitHub ↗
(sample, num)

Source from the content-addressed store, hash-verified

56
57
58def FPS(sample, num):
59 n = sample.shape[0]
60 center = np.mean(sample, axis=0)
61 select_p = []
62 L = []
63 for i in range(n):
64 L.append(distance(sample[i], center))
65 p0 = np.argmax(L)
66 select_p.append(p0)
67 L = []
68 for i in range(n):
69 L.append(distance(p0, sample[i]))
70 select_p.append(np.argmax(L))
71 for i in range(num - 2):
72 for p in range(n):
73 d = distance(sample[select_p[-1]], sample[p])
74 if d <= L[p]:
75 L[p] = d
76 select_p.append(np.argmax(L))
77 return select_p, sample[select_p]
78
79
80def fill_mask(alpha):

Callers

nothing calls this directly

Calls 1

distanceFunction · 0.85

Tested by

no test coverage detected