Skip to content

Commit

Permalink
Use more basic kmeans2
Browse files Browse the repository at this point in the history
Directly returns labels, and doesnt use special termination check
  • Loading branch information
kugelrund committed Jul 24, 2020
1 parent 4370c10 commit 746ca19
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mesh_segmentation/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,11 @@ def segment_mesh(mesh, k, coefficients, action, ev_method):
# compute association matrix
Q = V.dot(V.transpose())
# compute initial guess for clustering
initial_clusters = _initial_guess(Q, k)
initial_centroids = _initial_guess(Q, k)

print("mesh_segmentation: Applying kmeans...")
# apply kmeans
cluster_res,_ = scipy.cluster.vq.kmeans(V, V[initial_clusters,:])
# get identification vector
idx,_ = scipy.cluster.vq.vq(V, cluster_res)
_, idx = scipy.cluster.vq.kmeans2(V, V[initial_centroids,:], iter=50)

print("mesh_segmentation: Done clustering!")
# perform action with the clustering result
Expand Down

0 comments on commit 746ca19

Please sign in to comment.