/

K-means Clustering

Runs a simple unsupervised K-means clustering algorithm for classification.


Introduction

For more information, please read the block description.

Block type: PROCESSING

This block provides a k-means clustering algorithm. It creates a given number of clusters in an image and assigns each pixel to a cluster. Nodata pixels in the input dataset are not excluded during the clustering. If the nodata value has a large distance from all other pixels (measured by the Frobenius or L2 norm), all nodata pixels will likely form a separate cluster.

This block can only process images with a maximum size of 1.2GB, because the entire image is loaded at once into memory. Any image with a larger size will generate an error.

Supported parameters

  • n_clusters: The number of clusters for the K-means clustering. Number of classes in the output file. Default is 6.

  • n_iterations: The number of iterations for the K-means clustering. Default is 10.

  • n_sieve_pixels: Minimum number of pixels in each patch or group for the classification. Default is 64.

Example parameters using the SPOT Display (Streaming) as data source and then applying the K-Means Clustering:

{
  "oneatlas-spot-aoiclipped:1": {
    "bbox": null,
    "time": null,
    "limit": 3,
    "intersects": {
      "type": "Polygon",
      "coordinates": [
        [
          [
            18.42631,
            -33.912732
          ],
          [
            18.420799,
            -33.922741
          ],
          [
            18.44355,
            -33.924784
          ],
          [
            18.441069,
            -33.913781
          ],
          [
            18.42631,
            -33.912732
          ]
        ]
      ]
    },
    "zoom_level": 17
  },
  "k-means-clustering:1": {
    "n_clusters": 6,
    "n_iterations": 10,
    "n_sieve_pixels": 64
  }
}

Output format

Output and input format are identical. All metadata elements provided by the input dataset as properties are propagated to the output.

Capabilities

Input

Output

To know more please check the block capabilities specifications.