K-means Classification Error

I’m trying to run an unsupervised classification (k-means) on my Sentinel-2 1C Product and got an error saying “The combination of ROI and valid pixel masks contain 0 pixel. These are too few to initialise the clustering” .

Wondering if anyone know what that means? does it have to do with my image being 1C ?


have you limited your classification to a ROI? Have you selected something here?


Thank you ABraun for the reply! The ROI-mask drop down menu was empty and there was nothing to select. I’m not sure what masks it is referring to.

hmm. Did you check if the subset contains valid data?

You can also check the band properties of the input bands. Maybe there is something entered in the “valid pixel expression” which might cause the error. In most cases, you can delete this expression from the properties.

I’m a bit of a beginner. Can you please tell me how exactly do I delete the expression?

I will do that then run the classification again


Right-click on the band and select Properties


In the window, you find the Valid Pixel Expression

It is often used to grant for correct pixels and to mask out invalid ones, but in your case, you can probably click inside the expression and simply delete it for all bands which you want to use in the classification.


Dont forget to select File > Save Product after you changed these values to make the changes permanent. Then you run agian the classification.