kmeans_img
Performs KMeans clustering on the input image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
ndarray
|
Image to cluster. Shape (H, W, 3). |
required |
n_clust
|
int
|
Number of clusters. |
3
|
seed
|
int
|
Random seed. |
42
|
device
|
str
|
Device to use for computation. Options are 'cpu' or 'cuda'. If set to 'cuda', Cuml will be used for GPU acceleration. |
'cpu'
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Label image. Shape (H, W). |