I am using gaussian mixture model
in sklearn
(python).
A image is fitted on gaussian mixture model
. Then, it will be clustered.
(ex. component = 3, so some area is 0, and the others 1, 2) A tree area was 0, sky area was 1. But, I execute again, a tree area is 1. I don't understand why it is changed? Is there a way to fix the clustering??
Here are some codes.
gmm = GaussianMixture(n_components=3, covariance_type="tied")
gmm = gmm.fit(img)
cluster = gmm.predict(img)
cluster = cluster.reshape(old_shape[0], old_shape[1])
imshow(cluster)
data = np.array(cluster)